Monotone-Parent: 9235e5dc4d151a3cba8ad842ac39e1b2d18c8201
Monotone-Revision: aee2a5da27231d521f813fbb791f9e2c968f94b2 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-01-30T20:11:49 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
4b81cb167d
commit
a4c6873091
|
@ -1,3 +1,9 @@
|
|||
2012-01-30 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* OpenChange/MAPIStoreGCSBaseContext.m
|
||||
(+listContextsForUser:inMemCtx:): centralized code for all GCS
|
||||
classes.
|
||||
|
||||
2012-01-29 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* OpenChange/MAPIStoreMailContext.[hm]: removed
|
||||
|
|
|
@ -46,22 +46,9 @@ static Class MAPIStoreCalendarFolderK;
|
|||
return @"calendar";
|
||||
}
|
||||
|
||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
+ (enum mapistore_context_role) MAPIModuleRole
|
||||
{
|
||||
struct mapistore_contexts_list *context;
|
||||
|
||||
context = talloc_zero(memCtx, struct mapistore_contexts_list);
|
||||
context->url = talloc_asprintf (context, "sogo://%s@calendar/personal",
|
||||
[userName UTF8String]);
|
||||
// context->name = "Agenda personnel";
|
||||
context->main_folder = true;
|
||||
context->role = MAPISTORE_CALENDAR_ROLE;
|
||||
context->tag = "tag";
|
||||
context->prev = context;
|
||||
|
||||
return context;
|
||||
return MAPISTORE_CALENDAR_ROLE;
|
||||
}
|
||||
|
||||
- (Class) MAPIStoreFolderClass
|
||||
|
@ -69,9 +56,4 @@ static Class MAPIStoreCalendarFolderK;
|
|||
return MAPIStoreCalendarFolderK;
|
||||
}
|
||||
|
||||
- (id) rootSOGoFolder
|
||||
{
|
||||
return [userContext calendarRoot];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -46,22 +46,9 @@ static Class MAPIStoreContactsFolderK;
|
|||
return @"contacts";
|
||||
}
|
||||
|
||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
+ (enum mapistore_context_role) MAPIModuleRole
|
||||
{
|
||||
struct mapistore_contexts_list *context;
|
||||
|
||||
context = talloc_zero(memCtx, struct mapistore_contexts_list);
|
||||
context->url = talloc_asprintf (context, "sogo://%s@contacts/personal",
|
||||
[userName UTF8String]);
|
||||
// context->name = "Carnet d'adresses personnel";
|
||||
context->main_folder = true;
|
||||
context->role = MAPISTORE_CONTACTS_ROLE;
|
||||
context->tag = "tag";
|
||||
context->prev = context;
|
||||
|
||||
return context;
|
||||
return MAPISTORE_CONTACTS_ROLE;
|
||||
}
|
||||
|
||||
- (Class) MAPIStoreFolderClass
|
||||
|
@ -69,9 +56,4 @@ static Class MAPIStoreContactsFolderK;
|
|||
return MAPIStoreContactsFolderK;
|
||||
}
|
||||
|
||||
- (id) rootSOGoFolder
|
||||
{
|
||||
return [userContext contactsRoot];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -20,10 +20,22 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <SOGo/SOGoGCSFolder.h>
|
||||
#import <SOGo/SOGoParentFolder.h>
|
||||
|
||||
#import "MAPIStoreUserContext.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
|
||||
#import "MAPIStoreGCSBaseContext.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <mapistore/mapistore.h>
|
||||
#include <dlinklist.h>
|
||||
|
||||
@implementation MAPIStoreGCSBaseContext
|
||||
|
||||
+ (NSString *) MAPIModuleName
|
||||
|
@ -31,4 +43,59 @@
|
|||
return nil;
|
||||
}
|
||||
|
||||
+ (enum mapistore_context_role) MAPIModuleRole
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
struct mapistore_contexts_list *firstContext = NULL, *context;
|
||||
NSString *moduleName, *baseUrl, *url, *nameInContainer;
|
||||
NSArray *subfolders;
|
||||
MAPIStoreUserContext *userContext;
|
||||
SOGoParentFolder *parentFolder;
|
||||
NSUInteger count, max;
|
||||
SOGoGCSFolder *currentFolder;
|
||||
|
||||
moduleName = [self MAPIModuleName];
|
||||
if (moduleName)
|
||||
{
|
||||
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
||||
andTDBIndexing: indexingTdb];
|
||||
parentFolder = [[userContext rootFolders] objectForKey: [self MAPIModuleName]];
|
||||
baseUrl = [NSString stringWithFormat: @"sogo://%@@%@/",
|
||||
userName, moduleName];
|
||||
|
||||
subfolders = [parentFolder subFolders];
|
||||
max = [subfolders count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
currentFolder = [subfolders objectAtIndex: count];
|
||||
if ([[currentFolder ownerInContext: nil] isEqualToString: userName])
|
||||
{
|
||||
context = talloc_zero (memCtx, struct mapistore_contexts_list);
|
||||
nameInContainer = [currentFolder nameInContainer];
|
||||
url = [NSString stringWithFormat: @"%@%@", baseUrl, nameInContainer];
|
||||
context->url = [url asUnicodeInMemCtx: context];
|
||||
context->name = [[currentFolder displayName]
|
||||
asUnicodeInMemCtx: context];
|
||||
context->main_folder = [nameInContainer isEqualToString: @"personal"];
|
||||
context->role = [self MAPIModuleRole];
|
||||
context->tag = "tag";
|
||||
DLIST_ADD_END (firstContext, context, void);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return firstContext;
|
||||
}
|
||||
|
||||
- (id) rootSOGoFolder
|
||||
{
|
||||
return [[userContext rootFolders] objectForKey: [isa MAPIModuleName]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -45,22 +45,9 @@ static Class MAPIStoreTasksFolderK;
|
|||
return @"tasks";
|
||||
}
|
||||
|
||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
+ (enum mapistore_context_role) MAPIModuleRole
|
||||
{
|
||||
struct mapistore_contexts_list *context;
|
||||
|
||||
context = talloc_zero(memCtx, struct mapistore_contexts_list);
|
||||
context->url = talloc_asprintf (context, "sogo://%s@tasks/personal",
|
||||
[userName UTF8String]);
|
||||
// context->name = "Tâches personnelles";
|
||||
context->main_folder = true;
|
||||
context->role = MAPISTORE_TASKS_ROLE;
|
||||
context->tag = "tag";
|
||||
context->prev = context;
|
||||
|
||||
return context;
|
||||
return MAPISTORE_TASKS_ROLE;
|
||||
}
|
||||
|
||||
- (Class) MAPIStoreFolderClass
|
||||
|
@ -68,9 +55,4 @@ static Class MAPIStoreTasksFolderK;
|
|||
return MAPIStoreTasksFolderK;
|
||||
}
|
||||
|
||||
- (id) rootSOGoFolder
|
||||
{
|
||||
return [userContext calendarRoot];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue