diff --git a/OpenChange/MAPIStoreUserContext.m b/OpenChange/MAPIStoreUserContext.m index d0ffbee66..bc91f56b0 100644 --- a/OpenChange/MAPIStoreUserContext.m +++ b/OpenChange/MAPIStoreUserContext.m @@ -217,7 +217,7 @@ static NSMapTable *contextsTable = nil; if (!userFolder) { userFolder = [SOGoUserFolder objectWithName: username - inContainer: MAPIApp]; + inContainer: nil]; [userFolder retain]; } @@ -235,7 +235,8 @@ static NSMapTable *contextsTable = nil; if (!rootFolders) { rootFolders = [NSMutableDictionary new]; - [self userFolder]; + [self activate]; + [self userFolder]; // force lazy initialization [woContext setClientObject: userFolder]; /* Calendar */ @@ -260,10 +261,10 @@ static NSMapTable *contextsTable = nil; acquire: NO]; [containersBag addObject: accountsFolder]; [woContext setClientObject: accountsFolder]; + currentFolder = [accountsFolder lookupName: @"0" inContext: woContext acquire: NO]; - [rootFolders setObject: currentFolder forKey: @"mail"]; connection = [currentFolder imap4Connection]; @@ -271,8 +272,7 @@ static NSMapTable *contextsTable = nil; /* ensure the folder cache is filled */ [currentFolder toManyRelationshipKeysWithNamespaces: YES]; - hierarchy = [connection - cachedHierarchyResultsForURL: [currentFolder imap4URL]]; + hierarchy = [connection cachedHierarchyResultsForURL: [currentFolder imap4URL]]; flags = [[hierarchy objectForKey: @"list"] objectForKey: @"/INBOX"]; inboxHasNoInferiors = [flags containsObject: @"noinferiors"]; } @@ -341,7 +341,7 @@ static NSMapTable *contextsTable = nil; cm = [GCSChannelManager defaultChannelManager]; channel = [cm acquireOpenChannelForURL: folderTableURL]; - + /* FIXME: make use of [EOChannelAdaptor describeTableNames] instead */ tableName = [[folderTableURL path] lastPathComponent]; if ([channel evaluateExpressionX: @@ -358,7 +358,7 @@ static NSMapTable *contextsTable = nil; [channel cancelFetch]; - [cm releaseChannel: channel]; + [cm releaseChannel: channel]; } /* SOGo context objects */