Monotone-Parent: e13446efcded2d880cbb5bb48b3bde3b54faf46e

Monotone-Revision: ac435c09e6aeb4ef0087488eb9403ccc7f5fc64e

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2011-12-01T22:33:46
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2011-12-01 22:33:46 +00:00
parent 49f733033f
commit 6f78e819f9
2 changed files with 34 additions and 17 deletions

View File

@ -1,5 +1,9 @@
2011-12-01 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreContext.m (_prepareContextClass): now return
the context via a pointer parameter. Return a proper "enum
mapistore_error" value.
* OpenChange/MAPIStoreCalendarMessage.m (-appointmentWrapper):
pass the owner user as parameter to the appointment wrapper
contructor rather than the active user.

View File

@ -101,30 +101,44 @@ static NSMutableDictionary *contextClassMapping;
}
}
static inline MAPIStoreContext *
static inline enum mapistore_error
_prepareContextClass (Class contextClass,
struct mapistore_connection_info *connInfo,
struct tdb_wrap *indexingTdb, NSURL *url)
struct tdb_wrap *indexingTdb, NSURL *url,
MAPIStoreContext **contextP)
{
MAPIStoreContext *context;
MAPIStoreAuthenticator *authenticator;
enum mapistore_error rc;
context = [[contextClass alloc] initFromURL: url
withConnectionInfo: connInfo
andTDBIndexing: indexingTdb];
[context autorelease];
if (context)
{
[context autorelease];
authenticator = [MAPIStoreAuthenticator new];
[authenticator setUsername: [url user]];
[authenticator setPassword: [url password]];
[context setAuthenticator: authenticator];
[authenticator release];
authenticator = [MAPIStoreAuthenticator new];
[authenticator setUsername: [url user]];
[authenticator setPassword: [url password]];
[context setAuthenticator: authenticator];
[authenticator release];
[context setupRequest];
[context setupBaseFolder: url];
[context tearDownRequest];
[context setupRequest];
[context setupBaseFolder: url];
[context tearDownRequest];
if (context->baseFolder && [context->baseFolder sogoObject])
{
*contextP = context;
rc = MAPISTORE_SUCCESS;
}
else
rc = MAPISTORE_ERR_DENIED;
}
else
rc = MAPISTORE_ERROR;
return context;
return rc;
}
+ (int) openContext: (MAPIStoreContext **) contextPtr
@ -157,16 +171,15 @@ _prepareContextClass (Class contextClass,
contextClass = [contextClassMapping objectForKey: module];
if (contextClass)
{
context = _prepareContextClass (contextClass,
newConnInfo, indexingTdb,
baseURL);
if (context)
rc = _prepareContextClass (contextClass,
newConnInfo, indexingTdb,
baseURL, &context);
if (rc == MAPISTORE_SUCCESS)
{
*contextPtr = context;
mapistore_mgmt_backend_register_user (newConnInfo,
"SOGo",
[[[context authenticator] username] UTF8String]);
rc = MAPISTORE_SUCCESS;
}
}
else