diff --git a/OpenChange/MAPIStoreCalendarFolder.m b/OpenChange/MAPIStoreCalendarFolder.m index 5f57c0560..2e131387b 100644 --- a/OpenChange/MAPIStoreCalendarFolder.m +++ b/OpenChange/MAPIStoreCalendarFolder.m @@ -63,19 +63,15 @@ SOGoAppointmentObject *newEntry; NSString *name; - //[self logWithFormat: @"METHOD '%s' (%d)", __FUNCTION__, __LINE__]; + [[self userContext] activate]; name = [NSString stringWithFormat: @"%@.ics", [SOGoObject globallyUniqueObjectId]]; newEntry = [SOGoAppointmentObject objectWithName: name inContainer: sogoObject]; [newEntry setIsNew: YES]; - /* the WOContext is required here for resolving notification pages */ - [newEntry setContext: [[self userContext] woContext]]; newMessage = [MAPIStoreCalendarMessage mapiStoreObjectWithSOGoObject: newEntry inContainer: self]; - - return newMessage; } diff --git a/OpenChange/MAPIStoreCalendarMessage.m b/OpenChange/MAPIStoreCalendarMessage.m index f5d00e8d4..9e2952102 100644 --- a/OpenChange/MAPIStoreCalendarMessage.m +++ b/OpenChange/MAPIStoreCalendarMessage.m @@ -577,7 +577,7 @@ static Class NSArrayK, MAPIStoreAppointmentWrapperK; } } -- (void) save: (TALLOC_CTX *) memCtx +- (void) save: (TALLOC_CTX *) memCtx { // iCalCalendar *vCalendar; // NSCalendarDate *now; @@ -634,7 +634,7 @@ static Class NSArrayK, MAPIStoreAppointmentWrapperK; withActiveUser: activeUser inMemCtx: memCtx]; [self _updateAttachedEvents]; - [[self userContext] activateWithUser: activeUser]; + [[self userContext] activate]; [sogoObject updateContentWithCalendar: calendar fromRequest: nil]; [self updateVersions]; diff --git a/OpenChange/MAPIStoreContext.m b/OpenChange/MAPIStoreContext.m index 2f4592cb8..62d80c6e4 100644 --- a/OpenChange/MAPIStoreContext.m +++ b/OpenChange/MAPIStoreContext.m @@ -114,7 +114,7 @@ static NSMutableDictionary *contextClassMapping; userContext = [MAPIStoreUserContext userContextWithUsername: userName andTDBIndexing: indexing]; - [userContext activateWithUser: [userContext sogoUser]]; + [userContext activate]; classes = GSObjCAllSubclassesOfClass (self); max = [classes count]; @@ -426,7 +426,7 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri) NSArray *pathComponents; NSUInteger count, max; - [userContext activateWithUser: activeUser]; + [userContext activate]; woContext = [userContext woContext]; [self ensureContextFolder]; diff --git a/OpenChange/MAPIStoreGCSBaseContext.m b/OpenChange/MAPIStoreGCSBaseContext.m index 384859c5d..e2de733b0 100644 --- a/OpenChange/MAPIStoreGCSBaseContext.m +++ b/OpenChange/MAPIStoreGCSBaseContext.m @@ -121,7 +121,7 @@ userContext = [MAPIStoreUserContext userContextWithUsername: userName andTDBIndexing: NULL]; - [MAPIApp setUserContext: userContext]; + [userContext activate]; moduleName = [self MAPIModuleName]; parentFolder = [[userContext rootFolders] objectForKey: moduleName]; nameInContainer = nil; @@ -134,7 +134,6 @@ moduleName, nameInContainer]; else mapistoreURI = nil; - [MAPIApp setUserContext: nil]; return mapistoreURI; } diff --git a/OpenChange/MAPIStoreMailContext.m b/OpenChange/MAPIStoreMailContext.m index f7a62fcd8..7d3e3592c 100644 --- a/OpenChange/MAPIStoreMailContext.m +++ b/OpenChange/MAPIStoreMailContext.m @@ -67,7 +67,7 @@ MakeDisplayFolderName (NSString *folderName) NSArray *parts; NSString *lastFolder; NSUInteger max; - + parts = [folderName componentsSeparatedByString: @"/"]; max = [parts count]; if (max > 1) @@ -198,7 +198,7 @@ MakeDisplayFolderName (NSString *folderName) userContext = [MAPIStoreUserContext userContextWithUsername: userName andTDBIndexing: NULL]; - [MAPIApp setUserContext: userContext]; + [userContext activate]; accountFolder = [[userContext rootFolders] objectForKey: @"mail"]; folderName = [NSString stringWithFormat: @"folder%@", [newFolderName asCSSIdentifier]]; @@ -213,7 +213,6 @@ MakeDisplayFolderName (NSString *folderName) [[folderName stringByEncodingImap4FolderName] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]]; else mapistoreURI = nil; - [MAPIApp setUserContext: nil]; return mapistoreURI; } diff --git a/OpenChange/MAPIStoreMailFolder.m b/OpenChange/MAPIStoreMailFolder.m index 3e24145c1..993b1c136 100644 --- a/OpenChange/MAPIStoreMailFolder.m +++ b/OpenChange/MAPIStoreMailFolder.m @@ -139,7 +139,7 @@ static Class SOGoMailFolderK, MAPIStoreMailFolderK, MAPIStoreOutboxFolderK; [[self mapping] updateID: fid withURL: [self url]]; [dbFolder setNameInContainer: newNameInContainer]; [self cleanupCaches]; - + propsCopy = [newProperties mutableCopy]; [propsCopy removeObjectForKey: key]; [propsCopy autorelease]; @@ -186,10 +186,7 @@ static Class SOGoMailFolderK, MAPIStoreMailFolderK, MAPIStoreOutboxFolderK; nameInContainer = [NSString stringWithFormat: @"folder%@", [[folderName stringByEncodingImap4FolderName] asCSSIdentifier]]; - /* it may be the operation is interleaved with operations - from other users having cached information in the thread - with the other user, so it'd better activate the user again here... */ - [[self userContext] activateWithUser: [[[self userContext] woContext] activeUser]]; + [[self userContext] activate]; newFolder = [SOGoMailFolderK objectWithName: nameInContainer inContainer: sogoObject]; @@ -245,7 +242,7 @@ static Class SOGoMailFolderK, MAPIStoreMailFolderK, MAPIStoreOutboxFolderK; sortOrdering: nil] count]; *data = MAPILongValue (memCtx, longValue); - + return MAPISTORE_SUCCESS; }