Merge pull request #75 from Zentyal/ejhernandez/move-mail-folder-with-reserved-chars

oc-mail: Move mail folders with reserved chars
This commit is contained in:
Enrique J. Hernández 2015-01-26 23:39:15 +01:00
commit 2dcb8fa732

View file

@ -1250,7 +1250,7 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP)
NGImap4Connection *connection; NGImap4Connection *connection;
NGImap4Client *client; NGImap4Client *client;
NSString *newURL, *parentDBFolderPath, *childKey, *folderIMAPName, NSString *newURL, *parentDBFolderPath, *childKey, *folderIMAPName,
*urlNamePart, *newFolderIMAPName; *urlNamePart, *newFolderIMAPName, *newFolderDBName;
NSException *error; NSException *error;
MAPIStoreMapping *mapping; MAPIStoreMapping *mapping;
NSDictionary *result; NSDictionary *result;
@ -1263,7 +1263,8 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP)
targetSOGoFolder = [targetFolder sogoObject]; targetSOGoFolder = [targetFolder sogoObject];
if (isMove) if (isMove)
{ {
urlNamePart = [newFolderName stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]; /* Mimetise [SOGoMailFolderK imap4URLString] */
urlNamePart = [[newFolderName stringByEncodingImap4FolderName] stringByEscapingURL];
newFolderURL = [NSURL URLWithString: urlNamePart newFolderURL = [NSURL URLWithString: urlNamePart
relativeToURL: [targetSOGoFolder imap4URL]]; relativeToURL: [targetSOGoFolder imap4URL]];
error = [[sogoObject imap4Connection] error = [[sogoObject imap4Connection]
@ -1275,8 +1276,9 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP)
{ {
rc = MAPISTORE_SUCCESS; rc = MAPISTORE_SUCCESS;
mapping = [self mapping]; mapping = [self mapping];
newFolderDBName = [[newFolderName stringByEncodingImap4FolderName] asCSSIdentifier];
newURL = [NSString stringWithFormat: @"%@folder%@/", newURL = [NSString stringWithFormat: @"%@folder%@/",
[targetFolder url], urlNamePart]; [targetFolder url], newFolderDBName];
[mapping updateID: [self objectId] withURL: newURL]; [mapping updateID: [self objectId] withURL: newURL];
parentDBFolderPath = [[targetFolder dbFolder] path]; parentDBFolderPath = [[targetFolder dbFolder] path];
if (!parentDBFolderPath) if (!parentDBFolderPath)
@ -1284,7 +1286,7 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP)
[dbFolder changePathTo: [NSString stringWithFormat: [dbFolder changePathTo: [NSString stringWithFormat:
@"%@/folder%@", @"%@/folder%@",
parentDBFolderPath, parentDBFolderPath,
newFolderName]]; newFolderDBName]];
} }
} }
else else