From 9ec0b9d3d6c1c9928f2537ff47580ee9e1058753 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Mon, 13 Aug 2012 03:58:14 +0000 Subject: [PATCH] Monotone-Parent: 2fea5fbc833aa109f5048dda8ddd9884c91385e1 Monotone-Revision: 3227626c75075b7ce019ef85ce3b7ddbd4c461f7 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-08-13T03:58:14 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 ++++++ OpenChange/MAPIStoreMailFolder.m | 15 +++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1f12a81d7..2a7273d57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2012-08-12 Wolfgang Sourdeau + * OpenChange/MAPIStoreMailFolder.m (-moveToFolder:withName:): if + the new name is not provided (unlikely), the computed new name + must not have the "folder" prefix. + We now also make use of -[MAPIStoreMapping updateID:withURL:] to + change the references in the mapping database. + * OpenChange/MAPIStoreFolder.m (-objectId): folder keys always end with a "/" by convention. diff --git a/OpenChange/MAPIStoreMailFolder.m b/OpenChange/MAPIStoreMailFolder.m index 01907accb..a415a814e 100644 --- a/OpenChange/MAPIStoreMailFolder.m +++ b/OpenChange/MAPIStoreMailFolder.m @@ -1009,13 +1009,16 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP) enum mapistore_error rc; NSURL *folderURL, *newFolderURL; SOGoMailFolder *targetSOGoFolder; + NSString *newURL; NSException *error; + MAPIStoreMapping *mapping; if ([targetFolder isKindOfClass: MAPIStoreMailFolderK]) { folderURL = [sogoObject imap4URL]; if (!newFolderName) - newFolderName = [sogoObject nameInContainer]; + newFolderName = [[sogoObject nameInContainer] + substringFromIndex: 6]; /* length of "folder" */ targetSOGoFolder = [targetFolder sogoObject]; newFolderURL = [NSURL URLWithString: newFolderName relativeToURL: [targetSOGoFolder imap4URL]]; @@ -1025,7 +1028,15 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP) if (error) rc = MAPISTORE_ERR_DENIED; else - rc = MAPISTORE_SUCCESS; + { + rc = MAPISTORE_SUCCESS; + mapping = [self mapping]; + newURL = [NSString stringWithFormat: @"%@folder%@/", + [targetFolder url], + [newFolderName stringByEscapingURL]]; + [mapping updateID: [self objectId] + withURL: newURL]; + } } else rc = MAPISTORE_ERR_DENIED;