Monotone-Parent: d75ed56bb85ad0c1c37621595267a590aa9b60db

Monotone-Revision: 3e033b86ce4c3221ccb5e2e1dd845bd3a033ec31

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2011-10-13T01:03:09
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2011-10-13 01:03:09 +00:00
parent 600c8ddb7e
commit 9c17e7be92
3 changed files with 61 additions and 4 deletions
+3
View File
@@ -1,5 +1,8 @@
2011-10-12 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreSOGo.m (sogo_manager_generate_uri): new
backend op. Code from j.kerihuel@openchange.org.
* OpenChange/MAPIStoreAppointmentWrapper.m
(-initWithICalEvent:andUser:andSenderEmail:inTimeZone:): take a
new "senderEmail" parameter in order to help the process of
+6
View File
@@ -170,6 +170,9 @@ _prepareContextClass (Class contextClass,
if (context)
{
*contextPtr = context;
mapistore_mgmt_backend_register_user (newConnInfo,
"SOGo",
[[[context authenticator] username] UTF8String]);
rc = MAPISTORE_SUCCESS;
}
}
@@ -221,6 +224,9 @@ _prepareContextClass (Class contextClass,
- (void) dealloc
{
mapistore_mgmt_backend_unregister_user ([self connectionInfo], "SOGo",
[[[self authenticator] username]
UTF8String]);
[baseFolder release];
[woContext release];
[authenticator release];
+52 -4
View File
@@ -25,6 +25,7 @@
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSFileHandle.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSThread.h>
#import <NGObjWeb/SoProductRegistry.h>
#import <NGExtensions/NSObject+Logs.h>
#import <SOGo/SOGoCache.h>
@@ -1044,6 +1045,54 @@ sogo_properties_set_properties (void *object, struct SRow *aRow)
return rc;
}
static int
sogo_manager_generate_uri (TALLOC_CTX *mem_ctx,
const char *user,
const char *folder,
const char *message,
const char *rootURI,
char **uri)
{
NSAutoreleasePool *pool;
NSString *partialURLString, *username, *directory;
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
if (uri == NULL) return MAPISTORE_ERR_INVALID_PARAMETER;
/* This fixes a crash occurring during the instantiation of the
NSAutoreleasePool below. */
GSRegisterCurrentThread ();
pool = [NSAutoreleasePool new];
// printf("rootURI = %s\n", rootURI);
if (rootURI)
partialURLString = [NSString stringWithUTF8String: rootURI];
else
{
/* sogo uri are of type: sogo://[username]:[password]@[folder type]/folder/id */
username = [NSString stringWithUTF8String: (user ? user : "*")];
/* Do proper directory lookup here */
directory = [NSString stringWithUTF8String: (folder ? folder : "*")];
partialURLString = [NSString stringWithFormat: @"sogo://%@:*@%@", username, directory];
}
if (![partialURLString hasSuffix: @"/"])
partialURLString = [partialURLString stringByAppendingString: @"/"];
if (message)
partialURLString = [partialURLString stringByAppendingFormat: @"%s.eml", message];
// printf("uri = %s\n", [partialURLString UTF8String]);
*uri = talloc_strdup (mem_ctx, [partialURLString UTF8String]);
[pool release];
GSUnregisterCurrentThread ();
return MAPISTORE_SUCCESS;
}
/**
\details Entry point for mapistore SOGO backend
@@ -1061,7 +1110,6 @@ int mapistore_init_backend(void)
{
registered = YES;
/* Fill in our name */
backend.backend.name = "SOGo";
backend.backend.description = "mapistore SOGo backend";
backend.backend.namespace = "sogo://";
@@ -1096,12 +1144,12 @@ int mapistore_init_backend(void)
backend.properties.get_available_properties = sogo_properties_get_available_properties;
backend.properties.get_properties = sogo_properties_get_properties;
backend.properties.set_properties = sogo_properties_set_properties;
backend.manager.generate_uri = sogo_manager_generate_uri;
/* Register ourselves with the MAPISTORE subsystem */
ret = mapistore_backend_register(&backend);
if (ret != MAPISTORE_SUCCESS) {
ret = mapistore_backend_register (&backend);
if (ret != MAPISTORE_SUCCESS)
DEBUG(0, ("Failed to register the '%s' mapistore backend!\n", backend.backend.name));
}
}
return ret;