Applied patches from #2700

pull/34/head
Ludovic Marcotte 2014-04-09 10:57:56 -04:00
parent 371e5ead08
commit ab80e87a3f
3 changed files with 36 additions and 10 deletions

View File

@ -212,11 +212,18 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
accountsFolder = [userFolder lookupName: @"Mail" inContext: context acquire: NO];
currentFolder = [accountsFolder lookupName: @"0" inContext: context acquire: NO];
newFolder = [currentFolder lookupName: [NSString stringWithFormat: @"folder%@", [displayName stringByEncodingImap4FolderName]]
inContext: context
acquire: NO];
// If the parrent is 0 -> ok ; otherwise need to build the foldername based on parentId + displayName
if ([parentId isEqualToString: @"0"])
newFolder = [currentFolder lookupName: [NSString stringWithFormat: @"folder%@", [displayName stringByEncodingImap4FolderName]]
inContext: context
acquire: NO];
else
newFolder = [currentFolder lookupName: [NSString stringWithFormat: @"folder%@/%@", [[parentId stringByUnescapingURL] substringFromIndex: 5],
[displayName stringByEncodingImap4FolderName]]
inContext: context
acquire: NO];
// FIXME
// handle exists (status == 2)
// handle right synckey
@ -380,7 +387,17 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
inContext: context
acquire: NO];
error = [folderToUpdate renameTo: displayName];
// If parent is 0 or displayname is not changed it is either a rename of a folder in 0 or a move to 0
if ([parentId isEqualToString: @"0"] ||
([serverId hasSuffix: [NSString stringWithFormat: @"/%@", displayName]] && [parentId isEqualToString: @"0"]))
{
error = [folderToUpdate renameTo: [NSString stringWithFormat: @"/%@", [displayName stringByEncodingImap4FolderName]]];
}
else
{
error = [folderToUpdate renameTo: [NSString stringWithFormat: @"%@/%@", [[parentId stringByUnescapingURL] substringFromIndex: 5],
[displayName stringByEncodingImap4FolderName]]];
}
// Handle new name exist
if (!error)

1
NEWS
View File

@ -12,6 +12,7 @@ Bug fixes
- fixed iCal7 delegation issue with the "inbox" folder (#2489)
- fixed birth date validity checks (#1636)
- fixed URL handling (#2616)
- improved folder rename operations using ActiveSync (#2700)
2.2.3 (2014-04-03)
------------------

View File

@ -291,10 +291,18 @@ static NSString *defaultUserID = @"anyone";
path = [[imap4URL path] stringByDeletingLastPathComponent];
if (![path hasSuffix: @"/"])
path = [path stringByAppendingString: @"/"];
destURL = [[NSURL alloc] initWithScheme: [imap4URL scheme]
host: [imap4URL host]
path: [NSString stringWithFormat: @"%@%@",
path, [newName stringByEncodingImap4FolderName]]];
// If new name contains the path - dont't need to add
if ([newName rangeOfString: @"/"].location == NSNotFound)
destURL = [[NSURL alloc] initWithScheme: [imap4URL scheme]
host: [imap4URL host]
path: [NSString stringWithFormat: @"%@%@",
path, [newName stringByEncodingImap4FolderName]]];
else
destURL = [[NSURL alloc] initWithScheme: [imap4URL scheme]
host: [imap4URL host]
path: [NSString stringWithFormat: @"%@",
[newName stringByEncodingImap4FolderName]]];
[destURL autorelease];
error = [imap4 moveMailboxAtURL: imap4URL
toURL: destURL];