From dba17fbcbcd3c8725385df5273911499a6321bdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20J=2E=20Hern=C3=A1ndez=20Blasco?= Date: Tue, 16 Dec 2014 23:39:42 +0100 Subject: [PATCH] Create child folder objects using parent context for real We activate the user for the context using the root folder context as there are times where the active user is not matching with the one stored in the application context and SOGo object is storing cached data with the wrong user leading to create folders in wrong mailboxes, etc. As this application is single-threaded, no problems are expected. Indeed, the same code is available at getting the root folder (ie INBOX). --- OpenChange/MAPIStoreFolder.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenChange/MAPIStoreFolder.m b/OpenChange/MAPIStoreFolder.m index 644f88965..15f3ca431 100644 --- a/OpenChange/MAPIStoreFolder.m +++ b/OpenChange/MAPIStoreFolder.m @@ -29,6 +29,7 @@ #import #import #import +#import #import #import #import @@ -235,6 +236,11 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe if ([[self folderKeys] containsObject: folderKey]) { woContext = [[self userContext] woContext]; + /* We activate the user for the context using the root folder + context as there are times where the active user is not + matching with the one stored in the application context + and SOGo object is storing cached data with the wrong user */ + [[self userContext] activateWithUser: [woContext activeUser]]; sogoFolder = [sogoObject lookupName: folderKey inContext: woContext acquire: NO]; if (sogoFolder && ![sogoFolder isKindOfClass: NSExceptionK])