Monotone-Parent: fb8ba445e08690bfab22a30460b8df60a58af1c7
Monotone-Revision: c494bd8edc3f42328eeae244084d2d97828732b9 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-11-29T01:39:07 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
7d1068e749
commit
42c47c2e03
|
@ -1,5 +1,10 @@
|
|||
2011-11-28 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* OpenChange/MAPIStoreContext.m
|
||||
(-initFromURL:withConnectionInfo:andTDBIndexing:): assign a
|
||||
SOGoUser corresponding to the object owner and to the active user
|
||||
to the "ownerUser" and "activeUser" ivars.
|
||||
|
||||
* SoObjects/Appointments/SOGoAppointmentFolder.m
|
||||
(-bareFetchFields:from:to:title:component:additionalFilters:):
|
||||
we must not attempt to instantiate an EOQualifier with a "nil"
|
||||
|
|
|
@ -56,6 +56,9 @@
|
|||
struct mapistore_context *mstoreCtx;
|
||||
struct mapistore_connection_info *connInfo;
|
||||
|
||||
SOGoUser *activeUser;
|
||||
SOGoUser *ownerUser;
|
||||
|
||||
NSURL *contextUrl;
|
||||
|
||||
MAPIStoreMapping *mapping;
|
||||
|
@ -88,6 +91,7 @@
|
|||
- (void) tearDownRequest;
|
||||
|
||||
- (SOGoUser *) activeUser;
|
||||
- (SOGoUser *) ownerUser;
|
||||
|
||||
// - (id) lookupObject: (NSString *) objectURLString;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue