mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-11 11:25:12 +00:00
merge of '0f6736fbdcac680f48a921ca2664b95bc58943fa'
and '6b3a3195262782a0783af8640a0fb24dd1103387' Monotone-Parent: 0f6736fbdcac680f48a921ca2664b95bc58943fa Monotone-Parent: 6b3a3195262782a0783af8640a0fb24dd1103387 Monotone-Revision: 0a8c7dabf7593bb4006f867c16170e5c59ac875a Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-01-30T20:13:26 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -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-30 Francis Lachapelle <flachapelle@inverse.ca>
|
||||
|
||||
* UI/WebServerResources/UIxCalUserRightsEditor.js (onUpdateACL):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -106,10 +106,11 @@ static NSMutableDictionary *contextClassMapping;
|
||||
NSUInteger count, max;
|
||||
MAPIStoreUserContext *userContext;
|
||||
|
||||
list = NULL;
|
||||
|
||||
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
||||
andTDBIndexing: indexingTdb];
|
||||
[userContext activateWithUser: [userContext sogoUser]];
|
||||
list = NULL;
|
||||
|
||||
classes = GSObjCAllSubclassesOfClass (self);
|
||||
max = [classes count];
|
||||
@@ -120,10 +121,7 @@ static NSMutableDictionary *contextClassMapping;
|
||||
withTDBIndexing: indexingTdb
|
||||
inMemCtx: memCtx];
|
||||
if (current)
|
||||
{
|
||||
[self logWithFormat: @"adding list: %p", current];
|
||||
DLIST_CONCATENATE(list, current, void);
|
||||
}
|
||||
DLIST_CONCATENATE(list, current, void);
|
||||
}
|
||||
|
||||
return list;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user