oc-folder: simplify lookupFolder method
use activate and no need to set wocontext, it's already set properly
This commit is contained in:
parent
68ae978b13
commit
393b6d5128
|
@ -231,30 +231,19 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
|
|
||||||
- (id) lookupFolder: (NSString *) folderKey
|
- (id) lookupFolder: (NSString *) folderKey
|
||||||
{
|
{
|
||||||
MAPIStoreFolder *childFolder;
|
MAPIStoreFolder *childFolder = nil;
|
||||||
SOGoFolder *sogoFolder;
|
SOGoFolder *sogoFolder;
|
||||||
WOContext *woContext;
|
|
||||||
|
|
||||||
childFolder = nil;
|
|
||||||
if ([[self folderKeys] containsObject: folderKey])
|
if ([[self folderKeys] containsObject: folderKey])
|
||||||
{
|
{
|
||||||
woContext = [[self userContext] woContext];
|
[[self userContext] activate];
|
||||||
/* We activate the user for the context using the root folder
|
sogoFolder = [sogoObject lookupName: folderKey
|
||||||
context as there are times where the active user is not
|
inContext: nil
|
||||||
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];
|
acquire: NO];
|
||||||
if (sogoFolder && ![sogoFolder isKindOfClass: NSExceptionK])
|
if (sogoFolder && ![sogoFolder isKindOfClass: NSExceptionK])
|
||||||
{
|
|
||||||
[sogoFolder setContext: woContext];
|
|
||||||
childFolder = [isa mapiStoreObjectWithSOGoObject: sogoFolder
|
childFolder = [isa mapiStoreObjectWithSOGoObject: sogoFolder
|
||||||
inContainer: self];
|
inContainer: self];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
childFolder = nil;
|
|
||||||
|
|
||||||
return childFolder;
|
return childFolder;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue