mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-11-22 07:14:21 +00:00
Monotone-Parent: fb8ba445e08690bfab22a30460b8df60a58af1c7
Monotone-Revision: c494bd8edc3f42328eeae244084d2d97828732b9 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-11-29T01:39:07 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
1 parent
7d1068e749
commit
42c47c2e03
3 files changed
+44
-28
No files matched your search
@@ -106,17 +106,9 @@ _prepareContextClass (Class contextClass,
|
||||
struct mapistore_connection_info *connInfo,
|
||||
struct tdb_wrap *indexingTdb, NSURL *url)
|
||||
{
|
||||
static NSMutableDictionary *registration = nil;
|
||||
MAPIStoreContext *context;
|
||||
MAPIStoreAuthenticator *authenticator;
|
||||
|
||||
if (!registration)
|
||||
registration = [NSMutableDictionary new];
|
||||
|
||||
if (![registration objectForKey: contextClass])
|
||||
[registration setObject: [NSNull null]
|
||||
forKey: contextClass];
|
||||
|
||||
context = [[contextClass alloc] initFromURL: url
|
||||
withConnectionInfo: connInfo
|
||||
andTDBIndexing: indexingTdb];
|
||||
@@ -208,20 +200,39 @@ _prepareContextClass (Class contextClass,
|
||||
andTDBIndexing: (struct tdb_wrap *) indexingTdb
|
||||
{
|
||||
NSString *username;
|
||||
SOGoUser *activeUser;
|
||||
|
||||
if ((self = [self init]))
|
||||
{
|
||||
ASSIGN (contextUrl, newUrl);
|
||||
username = [NSString stringWithUTF8String: newConnInfo->username];
|
||||
activeUser = [SOGoUser userWithLogin: username];
|
||||
ASSIGN (activeUser, [SOGoUser userWithLogin: username]);
|
||||
if (!activeUser)
|
||||
[self errorWithFormat: @"user '%@' not found in SOGo environment",
|
||||
username];
|
||||
{
|
||||
[self errorWithFormat: @"user '%@' not found in SOGo environment",
|
||||
username];
|
||||
[self release];
|
||||
return nil;
|
||||
}
|
||||
[woContext setActiveUser: activeUser];
|
||||
username = [newUrl user];
|
||||
if ([username length] == 0)
|
||||
{
|
||||
[self errorWithFormat:
|
||||
@"attempt to instantiate a context with an empty owner"];
|
||||
[self release];
|
||||
return nil;
|
||||
}
|
||||
ASSIGN (ownerUser, [SOGoUser userWithLogin: username]);
|
||||
if (!ownerUser)
|
||||
{
|
||||
[self errorWithFormat:
|
||||
@"attempt to instantiate a context without a valid owner"];
|
||||
[self release];
|
||||
return nil;
|
||||
}
|
||||
ASSIGN (mapping, [MAPIStoreMapping mappingForUsername: username
|
||||
withIndexing: indexingTdb]);
|
||||
withIndexing: indexingTdb]);
|
||||
[mapping increaseUseCount];
|
||||
ASSIGN (contextUrl, newUrl);
|
||||
mstoreCtx = newConnInfo->mstore_ctx;
|
||||
connInfo = newConnInfo;
|
||||
}
|
||||
@@ -294,20 +305,14 @@ _prepareContextClass (Class contextClass,
|
||||
|
||||
- (SOGoUser *) activeUser
|
||||
{
|
||||
SOGoUser *activeUser;
|
||||
NSString *userName;
|
||||
|
||||
if (connInfo && connInfo->username)
|
||||
{
|
||||
userName = [NSString stringWithUTF8String: connInfo->username];
|
||||
activeUser = [SOGoUser userWithLogin: userName];
|
||||
}
|
||||
else
|
||||
activeUser = nil;
|
||||
|
||||
return activeUser;
|
||||
}
|
||||
|
||||
- (SOGoUser *) ownerUser
|
||||
{
|
||||
return ownerUser;
|
||||
}
|
||||
|
||||
// - (void) logRestriction: (struct mapi_SRestriction *) res
|
||||
// withState: (MAPIRestrictionState) state
|
||||
// {
|
||||
@@ -407,7 +412,7 @@ _prepareContextClass (Class contextClass,
|
||||
- (uint64_t) idForObjectWithKey: (NSString *) key
|
||||
inFolderURL: (NSString *) folderURL
|
||||
{
|
||||
NSString *childURL;
|
||||
NSString *childURL, *owner;
|
||||
uint64_t mappingId;
|
||||
uint32_t contextId;
|
||||
void *rootObject;
|
||||
@@ -427,7 +432,9 @@ _prepareContextClass (Class contextClass,
|
||||
// FIXME: + 7 to skip the BOM or what?
|
||||
mapistore_search_context_by_uri (mstoreCtx, [folderURL UTF8String] + 7,
|
||||
&contextId, &rootObject);
|
||||
mapistore_indexing_record_add_mid (mstoreCtx, contextId, mappingId);
|
||||
owner = [ownerUser login];
|
||||
mapistore_indexing_record_add_mid (mstoreCtx, contextId,
|
||||
[owner UTF8String], mappingId);
|
||||
}
|
||||
|
||||
return mappingId;
|
||||
@@ -438,7 +445,7 @@ _prepareContextClass (Class contextClass,
|
||||
uint64_t newVersionNumber;
|
||||
|
||||
if (openchangedb_get_new_changeNumber (connInfo->oc_ctx, &newVersionNumber)
|
||||
!= MAPISTORE_SUCCESS)
|
||||
!= MAPI_E_SUCCESS)
|
||||
abort ();
|
||||
|
||||
return newVersionNumber;
|
||||
|
||||
Reference in new issue
Block a user