Monotone-Parent: 0a8c7dabf7593bb4006f867c16170e5c59ac875a
Monotone-Revision: 0e5cfd9eddf3cfeb9a5ff45ef7e78508b2d5a686 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-01-30T20:17:21 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
ef2485e56b
commit
f3cbd4f172
|
@ -1,5 +1,9 @@
|
|||
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
|
||||
(+listContextsForUser:inMemCtx:): centralized code for all GCS
|
||||
classes.
|
||||
|
|
|
@ -44,10 +44,8 @@
|
|||
SOGoUser *sogoUser;
|
||||
|
||||
SOGoUserFolder *userFolder;
|
||||
SOGoAppointmentFolders *calendarRoot;
|
||||
SOGoContactFolders *contactsRoot;
|
||||
SOGoMailAccount *mailRoot; /* only one account supported */
|
||||
NSMutableArray *containersBag;
|
||||
NSMutableDictionary *rootFolders;
|
||||
|
||||
MAPIStoreMapping *mapping;
|
||||
|
||||
|
@ -66,9 +64,7 @@
|
|||
|
||||
- (SOGoUserFolder *) userFolder;
|
||||
|
||||
- (SOGoAppointmentFolders *) calendarRoot;
|
||||
- (SOGoContactFolders *) contactsRoot;
|
||||
- (SOGoMailAccount *) mailRoot;
|
||||
- (NSDictionary *) rootFolders;
|
||||
|
||||
- (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
|
||||
*
|
||||
|
@ -20,6 +20,7 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSMapTable.h>
|
||||
#import <Foundation/NSThread.h>
|
||||
|
||||
|
@ -73,11 +74,8 @@ static NSMapTable *contextsTable = nil;
|
|||
sogoUser = nil;
|
||||
|
||||
userFolder = nil;
|
||||
calendarRoot = nil;
|
||||
contactsRoot = nil;
|
||||
mailRoot = nil;
|
||||
|
||||
containersBag = [NSMutableArray new];
|
||||
rootFolders = nil;
|
||||
|
||||
mapping = nil;
|
||||
|
||||
|
@ -113,13 +111,9 @@ static NSMapTable *contextsTable = nil;
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
[contextsTable removeObjectForKey: username];
|
||||
|
||||
[userFolder release];
|
||||
[calendarRoot release];
|
||||
[contactsRoot release];
|
||||
[mailRoot release];
|
||||
[containersBag release];
|
||||
[rootFolders release];
|
||||
|
||||
[authenticator release];
|
||||
[mapping release];
|
||||
|
@ -127,6 +121,8 @@ static NSMapTable *contextsTable = nil;
|
|||
[username release];
|
||||
[sogoUser release];
|
||||
|
||||
[contextsTable removeObjectForKey: username];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -155,62 +151,49 @@ static NSMapTable *contextsTable = nil;
|
|||
return userFolder;
|
||||
}
|
||||
|
||||
- (SOGoAppointmentFolders *) calendarRoot
|
||||
{
|
||||
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
|
||||
- (NSDictionary *) rootFolders
|
||||
{
|
||||
SOGoMailAccounts *accountsFolder;
|
||||
id currentFolder;
|
||||
|
||||
if (!mailRoot)
|
||||
if (!rootFolders)
|
||||
{
|
||||
rootFolders = [NSMutableDictionary new];
|
||||
[self 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"
|
||||
inContext: woContext
|
||||
acquire: NO];
|
||||
[containersBag addObject: accountsFolder];
|
||||
[woContext setClientObject: accountsFolder];
|
||||
|
||||
mailRoot = [accountsFolder lookupName: @"0"
|
||||
currentFolder = [accountsFolder lookupName: @"0"
|
||||
inContext: woContext
|
||||
acquire: NO];
|
||||
[[mailRoot imap4Connection]
|
||||
[rootFolders setObject: currentFolder
|
||||
forKey: @"mail"];
|
||||
[[currentFolder imap4Connection]
|
||||
enableExtension: @"QRESYNC"];
|
||||
[mailRoot retain];
|
||||
}
|
||||
|
||||
return mailRoot;
|
||||
return rootFolders;
|
||||
}
|
||||
|
||||
- (MAPIStoreMapping *) mapping
|
||||
|
|
Loading…
Reference in New Issue