Monotone-Parent: 0a8c7dabf7593bb4006f867c16170e5c59ac875a
Monotone-Revision: 0e5cfd9eddf3cfeb9a5ff45ef7e78508b2d5a686 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-01-30T20:17:21 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
ef2485e56b
commit
f3cbd4f172
|
@ -1,5 +1,9 @@
|
||||||
2012-01-30 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2012-01-30 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* OpenChange/MAPIStoreUserContext.m (-rootFolders): new method
|
||||||
|
replacing the "...root" methods in way that can match the
|
||||||
|
MAPIModuleName.
|
||||||
|
|
||||||
* OpenChange/MAPIStoreGCSBaseContext.m
|
* OpenChange/MAPIStoreGCSBaseContext.m
|
||||||
(+listContextsForUser:inMemCtx:): centralized code for all GCS
|
(+listContextsForUser:inMemCtx:): centralized code for all GCS
|
||||||
classes.
|
classes.
|
||||||
|
|
|
@ -44,10 +44,8 @@
|
||||||
SOGoUser *sogoUser;
|
SOGoUser *sogoUser;
|
||||||
|
|
||||||
SOGoUserFolder *userFolder;
|
SOGoUserFolder *userFolder;
|
||||||
SOGoAppointmentFolders *calendarRoot;
|
|
||||||
SOGoContactFolders *contactsRoot;
|
|
||||||
SOGoMailAccount *mailRoot; /* only one account supported */
|
|
||||||
NSMutableArray *containersBag;
|
NSMutableArray *containersBag;
|
||||||
|
NSMutableDictionary *rootFolders;
|
||||||
|
|
||||||
MAPIStoreMapping *mapping;
|
MAPIStoreMapping *mapping;
|
||||||
|
|
||||||
|
@ -66,9 +64,7 @@
|
||||||
|
|
||||||
- (SOGoUserFolder *) userFolder;
|
- (SOGoUserFolder *) userFolder;
|
||||||
|
|
||||||
- (SOGoAppointmentFolders *) calendarRoot;
|
- (NSDictionary *) rootFolders;
|
||||||
- (SOGoContactFolders *) contactsRoot;
|
|
||||||
- (SOGoMailAccount *) mailRoot;
|
|
||||||
|
|
||||||
- (MAPIStoreMapping *) mapping;
|
- (MAPIStoreMapping *) mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* MAPIStoreUserContext.m - this file is part of $PROJECT_NAME_HERE$
|
/* MAPIStoreUserContext.m - this file is part of SOGo
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Inverse inc
|
* Copyright (C) 2012 Inverse inc
|
||||||
*
|
*
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#import <Foundation/NSDictionary.h>
|
||||||
#import <Foundation/NSMapTable.h>
|
#import <Foundation/NSMapTable.h>
|
||||||
#import <Foundation/NSThread.h>
|
#import <Foundation/NSThread.h>
|
||||||
|
|
||||||
|
@ -73,11 +74,8 @@ static NSMapTable *contextsTable = nil;
|
||||||
sogoUser = nil;
|
sogoUser = nil;
|
||||||
|
|
||||||
userFolder = nil;
|
userFolder = nil;
|
||||||
calendarRoot = nil;
|
|
||||||
contactsRoot = nil;
|
|
||||||
mailRoot = nil;
|
|
||||||
|
|
||||||
containersBag = [NSMutableArray new];
|
containersBag = [NSMutableArray new];
|
||||||
|
rootFolders = nil;
|
||||||
|
|
||||||
mapping = nil;
|
mapping = nil;
|
||||||
|
|
||||||
|
@ -113,13 +111,9 @@ static NSMapTable *contextsTable = nil;
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
[contextsTable removeObjectForKey: username];
|
|
||||||
|
|
||||||
[userFolder release];
|
[userFolder release];
|
||||||
[calendarRoot release];
|
|
||||||
[contactsRoot release];
|
|
||||||
[mailRoot release];
|
|
||||||
[containersBag release];
|
[containersBag release];
|
||||||
|
[rootFolders release];
|
||||||
|
|
||||||
[authenticator release];
|
[authenticator release];
|
||||||
[mapping release];
|
[mapping release];
|
||||||
|
@ -127,6 +121,8 @@ static NSMapTable *contextsTable = nil;
|
||||||
[username release];
|
[username release];
|
||||||
[sogoUser release];
|
[sogoUser release];
|
||||||
|
|
||||||
|
[contextsTable removeObjectForKey: username];
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,62 +151,49 @@ static NSMapTable *contextsTable = nil;
|
||||||
return userFolder;
|
return userFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (SOGoAppointmentFolders *) calendarRoot
|
- (NSDictionary *) rootFolders
|
||||||
{
|
|
||||||
if (!calendarRoot)
|
|
||||||
{
|
|
||||||
[self userFolder];
|
|
||||||
[woContext setClientObject: userFolder];
|
|
||||||
|
|
||||||
calendarRoot = [userFolder lookupName: @"Calendar"
|
|
||||||
inContext: woContext
|
|
||||||
acquire: NO];
|
|
||||||
[calendarRoot retain];
|
|
||||||
}
|
|
||||||
|
|
||||||
return calendarRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (SOGoContactFolders *) contactsRoot
|
|
||||||
{
|
|
||||||
if (!contactsRoot)
|
|
||||||
{
|
|
||||||
[self userFolder];
|
|
||||||
[woContext setClientObject: userFolder];
|
|
||||||
|
|
||||||
contactsRoot = [userFolder lookupName: @"Contacts"
|
|
||||||
inContext: woContext
|
|
||||||
acquire: NO];
|
|
||||||
[contactsRoot retain];
|
|
||||||
}
|
|
||||||
|
|
||||||
return contactsRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (SOGoMailAccount *) mailRoot
|
|
||||||
{
|
{
|
||||||
SOGoMailAccounts *accountsFolder;
|
SOGoMailAccounts *accountsFolder;
|
||||||
|
id currentFolder;
|
||||||
|
|
||||||
if (!mailRoot)
|
if (!rootFolders)
|
||||||
{
|
{
|
||||||
|
rootFolders = [NSMutableDictionary new];
|
||||||
[self userFolder];
|
[self userFolder];
|
||||||
[woContext setClientObject: userFolder];
|
[woContext setClientObject: userFolder];
|
||||||
|
|
||||||
|
/* Calendar */
|
||||||
|
currentFolder = [userFolder lookupName: @"Calendar"
|
||||||
|
inContext: woContext
|
||||||
|
acquire: NO];
|
||||||
|
[rootFolders setObject: currentFolder
|
||||||
|
forKey: @"calendar"];
|
||||||
|
[rootFolders setObject: currentFolder
|
||||||
|
forKey: @"tasks"];
|
||||||
|
|
||||||
|
/* Contacts */
|
||||||
|
currentFolder = [userFolder lookupName: @"Contacts"
|
||||||
|
inContext: woContext
|
||||||
|
acquire: NO];
|
||||||
|
[rootFolders setObject: currentFolder
|
||||||
|
forKey: @"contacts"];
|
||||||
|
|
||||||
|
/* Mail */
|
||||||
accountsFolder = [userFolder lookupName: @"Mail"
|
accountsFolder = [userFolder lookupName: @"Mail"
|
||||||
inContext: woContext
|
inContext: woContext
|
||||||
acquire: NO];
|
acquire: NO];
|
||||||
[containersBag addObject: accountsFolder];
|
[containersBag addObject: accountsFolder];
|
||||||
[woContext setClientObject: accountsFolder];
|
[woContext setClientObject: accountsFolder];
|
||||||
|
currentFolder = [accountsFolder lookupName: @"0"
|
||||||
mailRoot = [accountsFolder lookupName: @"0"
|
|
||||||
inContext: woContext
|
inContext: woContext
|
||||||
acquire: NO];
|
acquire: NO];
|
||||||
[[mailRoot imap4Connection]
|
[rootFolders setObject: currentFolder
|
||||||
|
forKey: @"mail"];
|
||||||
|
[[currentFolder imap4Connection]
|
||||||
enableExtension: @"QRESYNC"];
|
enableExtension: @"QRESYNC"];
|
||||||
[mailRoot retain];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mailRoot;
|
return rootFolders;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (MAPIStoreMapping *) mapping
|
- (MAPIStoreMapping *) mapping
|
||||||
|
|
Loading…
Reference in a new issue