Monotone-Parent: 3dc6d9dff558dfb935fde8eee2c978d9a9d1a774
Monotone-Revision: e89a46b719b80b6d34d9e7a110754e60344dd669 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-01-26T19:54:36 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
f5b8a68af9
commit
83709fd892
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2012-01-26 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* OpenChange/MAPIStoreSOGo.m (sogo_backend_list_contexts): new
|
||||
backend method.
|
||||
|
||||
* OpenChange/MAPIStoreContext.m
|
||||
(+listAllContextsForUser:inMemCtx:): centralized method for
|
||||
returning all contexts available from all context classes for one
|
||||
user.
|
||||
(+listContextsForUser:inMemCtx:): new individual method invoked by
|
||||
the above. Overridden by concrete subclasses.
|
||||
|
||||
2012-01-26 Ludovic Marcotte <lmarcotte@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/LDAPSource.{h,m} - now honor
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
|
||||
#import "MAPIStoreCalendarContext.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <mapistore/mapistore.h>
|
||||
|
||||
@implementation MAPIStoreCalendarContext
|
||||
|
||||
+ (NSString *) MAPIModuleName
|
||||
|
@ -34,6 +37,23 @@
|
|||
return @"calendar";
|
||||
}
|
||||
|
||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
struct mapistore_contexts_list *context;
|
||||
|
||||
context = talloc_zero(memCtx, struct mapistore_contexts_list);
|
||||
context->url = talloc_asprintf (context, "sogo://%s@calendar/",
|
||||
[userName UTF8String]);
|
||||
// context->name = "Agenda personnel";
|
||||
context->main_folder = true;
|
||||
context->role = MAPISTORE_CALENDAR_ROLE;
|
||||
context->tag = "tag";
|
||||
context->prev = context;
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
- (void) setupBaseFolder: (NSURL *) newURL
|
||||
{
|
||||
baseFolder = [MAPIStoreCalendarFolder baseFolderWithURL: newURL
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
|
||||
#import "MAPIStoreContactsContext.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <mapistore/mapistore.h>
|
||||
|
||||
@implementation MAPIStoreContactsContext
|
||||
|
||||
+ (NSString *) MAPIModuleName
|
||||
|
@ -34,6 +37,23 @@
|
|||
return @"contacts";
|
||||
}
|
||||
|
||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
struct mapistore_contexts_list *context;
|
||||
|
||||
context = talloc_zero(memCtx, struct mapistore_contexts_list);
|
||||
context->url = talloc_asprintf (context, "sogo://%s@contacts/",
|
||||
[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;
|
||||
}
|
||||
|
||||
- (void) setupBaseFolder: (NSURL *) newURL
|
||||
{
|
||||
baseFolder = [MAPIStoreContactsFolder baseFolderWithURL: newURL
|
||||
|
|
|
@ -69,6 +69,11 @@
|
|||
MAPIStoreFolder *baseFolder;
|
||||
}
|
||||
|
||||
+ (struct mapistore_contexts_list *) listAllContextsForUser: (NSString *) userName
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
|
||||
+ (int) openContext: (MAPIStoreContext **) contextPtr
|
||||
withURI: (const char *) newUri
|
||||
connectionInfo: (struct mapistore_connection_info *) newConnInfo
|
||||
|
|
|
@ -101,6 +101,40 @@ static NSMutableDictionary *contextClassMapping;
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
+ (struct mapistore_contexts_list *) listAllContextsForUser: (NSString *) userName
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
struct mapistore_contexts_list *list, *current;
|
||||
NSArray *classes;
|
||||
Class currentClass;
|
||||
NSUInteger count, max;
|
||||
|
||||
list = NULL;
|
||||
|
||||
classes = GSObjCAllSubclassesOfClass (self);
|
||||
max = [classes count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
currentClass = [classes objectAtIndex: count];
|
||||
current = [currentClass listContextsForUser: userName
|
||||
inMemCtx: memCtx];
|
||||
if (current)
|
||||
{
|
||||
[self logWithFormat: @"adding list: %p", current];
|
||||
DLIST_CONCATENATE(list, current, void);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline enum mapistore_error
|
||||
_prepareContextClass (Class contextClass,
|
||||
struct mapistore_connection_info *connInfo,
|
||||
|
|
|
@ -24,9 +24,13 @@
|
|||
|
||||
#import "MAPIStoreMailFolder.h"
|
||||
#import "MAPIStoreMapping.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
|
||||
#import "MAPIStoreMailContext.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <mapistore/mapistore.h>
|
||||
|
||||
@implementation MAPIStoreMailContext
|
||||
|
||||
+ (NSString *) MAPIModuleName
|
||||
|
@ -34,6 +38,11 @@
|
|||
return nil;
|
||||
}
|
||||
|
||||
+ (enum mapistore_context_role) contextRole
|
||||
{
|
||||
return MAPISTORE_MAIL_ROLE;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MAPIStoreInboxContext
|
||||
|
@ -43,6 +52,24 @@
|
|||
return @"inbox";
|
||||
}
|
||||
|
||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
struct mapistore_contexts_list *context;
|
||||
NSString *url;
|
||||
|
||||
context = talloc_zero(memCtx, struct mapistore_contexts_list);
|
||||
url = [NSString stringWithFormat: @"sogo://%@:%@@%@/", userName, userName, [self MAPIModuleName]];
|
||||
context->url = [url asUnicodeInMemCtx: context];
|
||||
// context->name = "Inbox";
|
||||
context->main_folder = true;
|
||||
context->role = [self contextRole];
|
||||
context->tag = "tag";
|
||||
context->prev = context;
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
- (void) setupBaseFolder: (NSURL *) newURL
|
||||
{
|
||||
baseFolder = [MAPIStoreInboxFolder baseFolderWithURL: newURL
|
||||
|
@ -59,6 +86,11 @@
|
|||
return @"sent-items";
|
||||
}
|
||||
|
||||
+ (enum mapistore_context_role) contextRole
|
||||
{
|
||||
return MAPISTORE_SENTITEMS_ROLE;
|
||||
}
|
||||
|
||||
- (void) setupBaseFolder: (NSURL *) newURL
|
||||
{
|
||||
baseFolder = [MAPIStoreSentItemsFolder baseFolderWithURL: newURL
|
||||
|
@ -75,6 +107,11 @@
|
|||
return @"drafts";
|
||||
}
|
||||
|
||||
+ (enum mapistore_context_role) contextRole
|
||||
{
|
||||
return MAPISTORE_DRAFTS_ROLE;
|
||||
}
|
||||
|
||||
- (void) setupBaseFolder: (NSURL *) newURL
|
||||
{
|
||||
baseFolder = [MAPIStoreDraftsFolder baseFolderWithURL: newURL
|
||||
|
@ -93,6 +130,11 @@
|
|||
return @"deleted-items";
|
||||
}
|
||||
|
||||
+ (enum mapistore_context_role) contextRole
|
||||
{
|
||||
return MAPISTORE_DELETEDITEMS_ROLE;
|
||||
}
|
||||
|
||||
- (void) setupBaseFolder: (NSURL *) newURL
|
||||
{
|
||||
baseFolder = [MAPIStoreFSFolder baseFolderWithURL: newURL inContext: self];
|
||||
|
@ -115,6 +157,11 @@
|
|||
return @"outbox";
|
||||
}
|
||||
|
||||
+ (enum mapistore_context_role) contextRole
|
||||
{
|
||||
return MAPISTORE_OUTBOX_ROLE;
|
||||
}
|
||||
|
||||
- (void) setupBaseFolder: (NSURL *) newURL
|
||||
{
|
||||
baseFolder = [MAPIStoreOutboxFolder baseFolderWithURL: newURL
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
|
||||
#import "MAPIStoreNotesContext.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <mapistore/mapistore.h>
|
||||
|
||||
@implementation MAPIStoreNotesContext
|
||||
|
||||
+ (NSString *) MAPIModuleName
|
||||
|
@ -34,6 +37,23 @@
|
|||
return @"notes";
|
||||
}
|
||||
|
||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
struct mapistore_contexts_list *context;
|
||||
|
||||
context = talloc_zero(memCtx, struct mapistore_contexts_list);
|
||||
context->url = talloc_asprintf (context, "sogo://%s@notes/",
|
||||
[userName UTF8String]);
|
||||
// context->name = "Notes personnelles";
|
||||
context->main_folder = true;
|
||||
context->role = MAPISTORE_NOTES_ROLE;
|
||||
context->tag = "tag";
|
||||
context->prev = context;
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
- (void) setupBaseFolder: (NSURL *) newURL
|
||||
{
|
||||
baseFolder = [MAPIStoreNotesFolder baseFolderWithURL: newURL
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
#include <mapistore/mapistore.h>
|
||||
#include <mapistore/mapistore_errors.h>
|
||||
|
||||
static Class MAPIStoreContextK = Nil;
|
||||
|
||||
static enum mapistore_error
|
||||
sogo_backend_unexpected_error()
|
||||
{
|
||||
|
@ -81,7 +83,7 @@ sogo_backend_init (void)
|
|||
|
||||
[SOGoSystemDefaults sharedSystemDefaults];
|
||||
|
||||
// /* We force the plugin to base its configuration on the SOGo tree. */
|
||||
/* We force the plugin to base its configuration on the SOGo tree. */
|
||||
ud = [NSUserDefaults standardUserDefaults];
|
||||
[ud registerDefaults: [ud persistentDomainForName: @"sogod"]];
|
||||
|
||||
|
@ -98,6 +100,8 @@ sogo_backend_init (void)
|
|||
[[SOGoCache sharedCache] disableRequestsCache];
|
||||
[[SOGoCache sharedCache] disableLocalCache];
|
||||
|
||||
MAPIStoreContextK = NSClassFromString (@"MAPIStoreContext");
|
||||
|
||||
[pool release];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
|
@ -118,7 +122,6 @@ sogo_backend_create_context(TALLOC_CTX *mem_ctx,
|
|||
const char *uri, void **context_object)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
Class MAPIStoreContextK;
|
||||
MAPIStoreContext *context;
|
||||
int rc;
|
||||
|
||||
|
@ -126,7 +129,6 @@ sogo_backend_create_context(TALLOC_CTX *mem_ctx,
|
|||
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
MAPIStoreContextK = NSClassFromString (@"MAPIStoreContext");
|
||||
if (MAPIStoreContextK)
|
||||
{
|
||||
rc = [MAPIStoreContextK openContext: &context
|
||||
|
@ -144,6 +146,33 @@ sogo_backend_create_context(TALLOC_CTX *mem_ctx,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static enum mapistore_error
|
||||
sogo_backend_list_contexts(const char *username, TALLOC_CTX *mem_ctx,
|
||||
struct mapistore_contexts_list **contexts_listp)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
NSString *userName;
|
||||
int rc;
|
||||
|
||||
DEBUG(0, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
if (MAPIStoreContextK)
|
||||
{
|
||||
userName = [NSString stringWithUTF8String: username];
|
||||
*contexts_listp = [MAPIStoreContextK listAllContextsForUser: userName
|
||||
inMemCtx: mem_ctx];
|
||||
rc = MAPISTORE_SUCCESS;
|
||||
}
|
||||
else
|
||||
rc = MAPISTORE_ERROR;
|
||||
|
||||
[pool release];
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
// andFID: fid
|
||||
// uint64_t fid,
|
||||
// void **private_data)
|
||||
|
@ -1207,6 +1236,7 @@ int mapistore_init_backend(void)
|
|||
backend.backend.namespace = "sogo://";
|
||||
backend.backend.init = sogo_backend_init;
|
||||
backend.backend.create_context = sogo_backend_create_context;
|
||||
backend.backend.list_contexts = sogo_backend_list_contexts;
|
||||
backend.context.get_path = sogo_context_get_path;
|
||||
backend.context.get_root_folder = sogo_context_get_root_folder;
|
||||
backend.folder.open_folder = sogo_folder_open_folder;
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
|
||||
#import "MAPIStoreTasksContext.h"
|
||||
|
||||
#undef DEBUG
|
||||
#include <mapistore/mapistore.h>
|
||||
|
||||
@implementation MAPIStoreTasksContext
|
||||
|
||||
+ (NSString *) MAPIModuleName
|
||||
|
@ -34,6 +37,23 @@
|
|||
return @"tasks";
|
||||
}
|
||||
|
||||
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
struct mapistore_contexts_list *context;
|
||||
|
||||
context = talloc_zero(memCtx, struct mapistore_contexts_list);
|
||||
context->url = talloc_asprintf (context, "sogo://%s@tasks/",
|
||||
[userName UTF8String]);
|
||||
// context->name = "Tâches personnelles";
|
||||
context->main_folder = true;
|
||||
context->role = MAPISTORE_TASKS_ROLE;
|
||||
context->tag = "tag";
|
||||
context->prev = context;
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
- (void) setupBaseFolder: (NSURL *) newURL
|
||||
{
|
||||
baseFolder = [MAPIStoreTasksFolder baseFolderWithURL: newURL
|
||||
|
|
Loading…
Reference in New Issue