mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-05 08:34:30 +00:00
Monotone-Parent: 9235e5dc4d151a3cba8ad842ac39e1b2d18c8201
Monotone-Revision: aee2a5da27231d521f813fbb791f9e2c968f94b2 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-01-30T20:11:49 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user