mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-14 01:38:51 +00:00
Monotone-Parent: 3dc6d9dff558dfb935fde8eee2c978d9a9d1a774
Monotone-Revision: e89a46b719b80b6d34d9e7a110754e60344dd669 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-01-26T19:54:36 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user