Monotone-Parent: 8fcaef79630a50f01c6aba0e5fdc0744c274cba6

Monotone-Revision: 87fd75f525e094b816fcad443e6fe4b2c8c8479c

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2011-03-07T21:33:13
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau committed 2011-03-07 21:33:13 +00:00
1 parent ed2c4777aa
commit ea416559ca
19 files changed
+73 -188

No files matched your search

+7
View File
@@ -1,5 +1,12 @@
2011-03-07 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2011-03-07 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreContext.m (_prepareContextClass): now takes
the context fid as argument.
* OpenChange/MAPIStore*Context.m (+registerFixedMappings): removed
method, made obsolete by the fact that we now receive the context
fid during initialization.
* OpenChange/MAPIStoreFAIMessageTable.[hm]: restored class module * OpenChange/MAPIStoreFAIMessageTable.[hm]: restored class module
in order to reenable proper class testing during notifications. in order to reenable proper class testing during notifications.
-14
View File
@@ -34,12 +34,6 @@
return @"calendar"; return @"calendar";
} }
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
{
[mapping registerURL: @"sogo://openchange:openchange@calendar/"
withID: 0x190001];
}
- (void) setupBaseFolder: (NSURL *) newURL - (void) setupBaseFolder: (NSURL *) newURL
{ {
baseFolder = [MAPIStoreCalendarFolder baseFolderWithURL: newURL baseFolder = [MAPIStoreCalendarFolder baseFolderWithURL: newURL
@@ -47,12 +41,4 @@
[baseFolder retain]; [baseFolder retain];
} }
- (int) readCount: (uint32_t *) rowCount
ofTableType: (uint8_t) tableType
inFID: (uint64_t) fid
{
return [super readCount: rowCount ofTableType: tableType inFID: fid];
}
@end @end
-6
View File
@@ -33,10 +33,4 @@
return @"common-views"; return @"common-views";
} }
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
{
[mapping registerURL: @"sogo://openchange:openchange@common-views/"
withID: 0xc0001];
}
@end @end
-6
View File
@@ -34,12 +34,6 @@
return @"contacts"; return @"contacts";
} }
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
{
[mapping registerURL: @"sogo://openchange:openchange@contacts/"
withID: 0x1a0001];
}
- (void) setupBaseFolder: (NSURL *) newURL - (void) setupBaseFolder: (NSURL *) newURL
{ {
baseFolder = [MAPIStoreContactsFolder baseFolderWithURL: newURL baseFolder = [MAPIStoreContactsFolder baseFolderWithURL: newURL
+6 -4
View File
@@ -49,7 +49,8 @@
{ {
struct mapistore_context *memCtx; struct mapistore_context *memCtx;
NSString *uri; NSURL *contextUrl;
uint64_t contextFid;
MAPIStoreAuthenticator *authenticator; MAPIStoreAuthenticator *authenticator;
WOContext *woContext; WOContext *woContext;
@@ -61,10 +62,12 @@
} }
+ (id) contextFromURI: (const char *) newUri + (id) contextFromURI: (const char *) newUri
andFID: (uint64_t) fid
inMemCtx: (struct mapistore_context *) newMemCtx; inMemCtx: (struct mapistore_context *) newMemCtx;
- (void) setURI: (NSString *) newUri - (id) initFromURL: (NSURL *) newUri
andMemCtx: (struct mapistore_context *) newMemCtx; andFID: (uint64_t) fid
inMemCtx: (struct mapistore_context *) newMemCtx;
- (void) setAuthenticator: (MAPIStoreAuthenticator *) newAuthenticator; - (void) setAuthenticator: (MAPIStoreAuthenticator *) newAuthenticator;
- (MAPIStoreAuthenticator *) authenticator; - (MAPIStoreAuthenticator *) authenticator;
@@ -156,7 +159,6 @@
/* subclass methods */ /* subclass methods */
+ (NSString *) MAPIModuleName; + (NSString *) MAPIModuleName;
+ (void) registerFixedMappings: (MAPIStoreMapping *) storeMapping;
- (void) setupBaseFolder: (NSURL *) newURL; - (void) setupBaseFolder: (NSURL *) newURL;
/* proof of concept */ /* proof of concept */
+50 -38
View File
@@ -106,7 +106,8 @@ static void *ldbCtx = NULL;
static inline MAPIStoreContext * static inline MAPIStoreContext *
_prepareContextClass (struct mapistore_context *newMemCtx, _prepareContextClass (struct mapistore_context *newMemCtx,
Class contextClass, NSURL *url) Class contextClass,
NSURL *url, uint64_t fid)
{ {
static NSMutableDictionary *registration = nil; static NSMutableDictionary *registration = nil;
MAPIStoreContext *context; MAPIStoreContext *context;
@@ -116,14 +117,11 @@ _prepareContextClass (struct mapistore_context *newMemCtx,
registration = [NSMutableDictionary new]; registration = [NSMutableDictionary new];
if (![registration objectForKey: contextClass]) if (![registration objectForKey: contextClass])
{ [registration setObject: [NSNull null]
[contextClass registerFixedMappings: mapping]; forKey: contextClass];
[registration setObject: [NSNull null]
forKey: contextClass];
}
context = [contextClass new]; context = [[contextClass alloc] initFromURL: url andFID: fid
[context setURI: [url absoluteString] andMemCtx: newMemCtx]; inMemCtx: newMemCtx];
[context autorelease]; [context autorelease];
authenticator = [MAPIStoreAuthenticator new]; authenticator = [MAPIStoreAuthenticator new];
@@ -140,6 +138,7 @@ _prepareContextClass (struct mapistore_context *newMemCtx,
} }
+ (id) contextFromURI: (const char *) newUri + (id) contextFromURI: (const char *) newUri
andFID: (uint64_t) fid
inMemCtx: (struct mapistore_context *) newMemCtx inMemCtx: (struct mapistore_context *) newMemCtx
{ {
MAPIStoreContext *context; MAPIStoreContext *context;
@@ -167,7 +166,8 @@ _prepareContextClass (struct mapistore_context *newMemCtx,
if (contextClass) if (contextClass)
context = _prepareContextClass (newMemCtx, context = _prepareContextClass (newMemCtx,
contextClass, contextClass,
baseURL); baseURL,
fid);
else else
NSLog (@"ERROR: unrecognized module name '%@'", module); NSLog (@"ERROR: unrecognized module name '%@'", module);
} }
@@ -189,7 +189,7 @@ _prepareContextClass (struct mapistore_context *newMemCtx,
woContext = [WOContext contextWithRequest: nil]; woContext = [WOContext contextWithRequest: nil];
[woContext retain]; [woContext retain];
baseFolder = nil; baseFolder = nil;
uri = nil; contextUrl = nil;
} }
[self logWithFormat: @"-init"]; [self logWithFormat: @"-init"];
@@ -197,6 +197,35 @@ _prepareContextClass (struct mapistore_context *newMemCtx,
return self; return self;
} }
- (id) initFromURL: (NSURL *) newUrl
andFID: (uint64_t) newFid
inMemCtx: (struct mapistore_context *) newMemCtx
{
struct loadparm_context *lpCtx;
MAPIStoreMapping *mapping;
if ((self = [self init]))
{
if (!ldbCtx)
{
lpCtx = loadparm_init (newMemCtx);
ldbCtx = mapiproxy_server_openchange_ldb_init (lpCtx);
}
ASSIGN (contextUrl, newUrl);
mapping = [MAPIStoreMapping sharedMapping];
if (![mapping urlFromID: newFid])
[mapping registerURL: [newUrl absoluteString]
withID: newFid];
contextFid = newFid;
memCtx = newMemCtx;
}
return self;
}
- (void) dealloc - (void) dealloc
{ {
[self logWithFormat: @"-dealloc"]; [self logWithFormat: @"-dealloc"];
@@ -207,26 +236,11 @@ _prepareContextClass (struct mapistore_context *newMemCtx,
[woContext release]; [woContext release];
[authenticator release]; [authenticator release];
[uri release]; [contextUrl release];
[super dealloc]; [super dealloc];
} }
- (void) setURI: (NSString *) newUri
andMemCtx: (struct mapistore_context *) newMemCtx
{
struct loadparm_context *lpCtx;
if (!ldbCtx)
{
lpCtx = loadparm_init (newMemCtx);
ldbCtx = mapiproxy_server_openchange_ldb_init (lpCtx);
}
ASSIGN (uri, newUri);
memCtx = newMemCtx;
}
- (WOContext *) woContext - (WOContext *) woContext
{ {
return woContext; return woContext;
@@ -835,13 +849,14 @@ _prepareContextClass (struct mapistore_context *newMemCtx,
withTableType: (uint8_t) tableType withTableType: (uint8_t) tableType
{ {
int rc; int rc;
NSString *objectURL; NSString *objectURL, *url;
// TDB_DATA key, dbuf; // TDB_DATA key, dbuf;
url = [contextUrl absoluteString];
objectURL = [mapping urlFromID: fmid]; objectURL = [mapping urlFromID: fmid];
if (objectURL) if (objectURL)
{ {
if ([objectURL hasPrefix: uri]) if ([objectURL hasPrefix: url])
{ {
*path = [[objectURL substringFromIndex: 7] *path = [[objectURL substringFromIndex: 7]
asUnicodeInMemCtx: memCtx]; asUnicodeInMemCtx: memCtx];
@@ -853,7 +868,7 @@ _prepareContextClass (struct mapistore_context *newMemCtx,
{ {
[self logWithFormat: @"context (%@, %@) does not contain" [self logWithFormat: @"context (%@, %@) does not contain"
@" found fmid: 0x%.16x", @" found fmid: 0x%.16x",
objectURL, uri, fmid]; objectURL, url, fmid];
*path = NULL; *path = NULL;
rc = MAPI_E_NOT_FOUND; rc = MAPI_E_NOT_FOUND;
} }
@@ -1295,7 +1310,7 @@ _prepareContextClass (struct mapistore_context *newMemCtx,
withFMID: (uint64_t) fmid withFMID: (uint64_t) fmid
{ {
int rc; int rc;
NSString *currentURL; NSString *currentURL, *url;
NSMutableArray *nsFolderList; NSMutableArray *nsFolderList;
uint64_t fid; uint64_t fid;
@@ -1303,15 +1318,16 @@ _prepareContextClass (struct mapistore_context *newMemCtx,
rc = MAPI_E_SUCCESS; rc = MAPI_E_SUCCESS;
url = [contextUrl absoluteString];
currentURL = [mapping urlFromID: fmid]; currentURL = [mapping urlFromID: fmid];
if (currentURL && ![currentURL isEqualToString: uri] if (currentURL && ![currentURL isEqualToString: url]
&& [currentURL hasPrefix: uri]) && [currentURL hasPrefix: url])
{ {
nsFolderList = [NSMutableArray arrayWithCapacity: 32]; nsFolderList = [NSMutableArray arrayWithCapacity: 32];
[self extractChildNameFromURL: currentURL [self extractChildNameFromURL: currentURL
andFolderURLAt: &currentURL]; andFolderURLAt: &currentURL];
while (currentURL && rc == MAPI_E_SUCCESS while (currentURL && rc == MAPI_E_SUCCESS
&& ![currentURL isEqualToString: uri]) && ![currentURL isEqualToString: url])
{ {
fid = [mapping idFromURL: currentURL]; fid = [mapping idFromURL: currentURL];
if (fid == NSNotFound) if (fid == NSNotFound)
@@ -1329,7 +1345,7 @@ _prepareContextClass (struct mapistore_context *newMemCtx,
if (rc != MAPI_E_NOT_FOUND) if (rc != MAPI_E_NOT_FOUND)
{ {
fid = [mapping idFromURL: uri]; fid = [mapping idFromURL: url];
[nsFolderList addObject: [NSNumber numberWithUnsignedLongLong: fid]]; [nsFolderList addObject: [NSNumber numberWithUnsignedLongLong: fid]];
[self logWithFormat: @"resulting folder list: %@", nsFolderList]; [self logWithFormat: @"resulting folder list: %@", nsFolderList];
*folders_list = [nsFolderList asFoldersListInCtx: memCtx]; *folders_list = [nsFolderList asFoldersListInCtx: memCtx];
@@ -1513,10 +1529,6 @@ _prepareContextClass (struct mapistore_context *newMemCtx,
return nil; return nil;
} }
+ (void) registerFixedMappings: (MAPIStoreMapping *) storeMapping
{
}
- (void) setupBaseFolder: (NSURL *) newURL - (void) setupBaseFolder: (NSURL *) newURL
{ {
[self subclassResponsibility: _cmd]; [self subclassResponsibility: _cmd];
@@ -33,10 +33,4 @@
return @"deferred-actions"; return @"deferred-actions";
} }
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
{
[mapping registerURL: @"sogo://openchange:openchange@deferred-actions/"
withID: 0xb0001];
}
@end @end
-21
View File
@@ -37,25 +37,4 @@
return @"freebusy"; return @"freebusy";
} }
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
{
[mapping registerURL: @"sogo://openchange:openchange@freebusy/"
withID: 0x70001];
}
// - (void) setupModuleFolder
// {
// SOGoUserFolder *userFolder;
// userFolder = [SOGoUserFolder objectWithName: [authenticator username]
// inContainer: MAPIApp];
// [parentFoldersBag addObject: userFolder];
// [woContext setClientObject: userFolder];
// moduleFolder = [userFolder lookupName: @"Calendar"
// inContext: woContext
// acquire: NO];
// [moduleFolder retain];
// }
@end @end
-6
View File
@@ -33,10 +33,4 @@
return @"journal"; return @"journal";
} }
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
{
[mapping registerURL: @"sogo://openchange:openchange@journal/"
withID: 0x1b0001];
}
@end @end
+1 -37
View File
@@ -43,12 +43,6 @@
return @"inbox"; return @"inbox";
} }
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
{
[mapping registerURL: @"sogo://openchange:openchange@inbox/"
withID: 0x160001];
}
- (void) setupBaseFolder: (NSURL *) newURL - (void) setupBaseFolder: (NSURL *) newURL
{ {
baseFolder = [MAPIStoreInboxFolder baseFolderWithURL: newURL baseFolder = [MAPIStoreInboxFolder baseFolderWithURL: newURL
@@ -65,12 +59,6 @@
return @"sent-items"; return @"sent-items";
} }
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
{
[mapping registerURL: @"sogo://openchange:openchange@sent-items/"
withID: 0x140001];
}
- (void) setupBaseFolder: (NSURL *) newURL - (void) setupBaseFolder: (NSURL *) newURL
{ {
baseFolder = [MAPIStoreSentItemsFolder baseFolderWithURL: newURL baseFolder = [MAPIStoreSentItemsFolder baseFolderWithURL: newURL
@@ -87,12 +75,6 @@
return @"drafts"; return @"drafts";
} }
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
{
[mapping registerURL: @"sogo://openchange:openchange@inbox/"
withID: 0x1e0001];
}
- (void) setupBaseFolder: (NSURL *) newURL - (void) setupBaseFolder: (NSURL *) newURL
{ {
baseFolder = [MAPIStoreDraftsFolder baseFolderWithURL: newURL baseFolder = [MAPIStoreDraftsFolder baseFolderWithURL: newURL
@@ -109,12 +91,6 @@
return @"deleted-items"; return @"deleted-items";
} }
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
{
[mapping registerURL: @"sogo://openchange:openchange@deleted-items/"
withID: 0x170001];
}
- (void) setupBaseFolder: (NSURL *) newURL - (void) setupBaseFolder: (NSURL *) newURL
{ {
baseFolder = [MAPIStoreDeletedItemsFolder baseFolderWithURL: newURL baseFolder = [MAPIStoreDeletedItemsFolder baseFolderWithURL: newURL
@@ -131,12 +107,6 @@
return @"outbox"; return @"outbox";
} }
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
{
[mapping registerURL: @"sogo://openchange:openchange@outbox/"
withID: 0x150001];
}
- (void) setupBaseFolder: (NSURL *) newURL - (void) setupBaseFolder: (NSURL *) newURL
{ {
baseFolder = [MAPIStoreOutboxFolder baseFolderWithURL: newURL baseFolder = [MAPIStoreOutboxFolder baseFolderWithURL: newURL
@@ -150,13 +120,7 @@
+ (NSString *) MAPIModuleName + (NSString *) MAPIModuleName
{ {
return @"spooler"; return @"spooler-queue";
}
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
{
[mapping registerURL: @"sogo://openchange:openchange@spooler/"
withID: 0x120001];
} }
@end @end
+5 -5
View File
@@ -76,14 +76,14 @@ MAPIStoreMappingInitDictionary (NSMutableDictionary *mapping)
struct tdb_wrap *wrap; struct tdb_wrap *wrap;
TDB_CONTEXT *context; TDB_CONTEXT *context;
char *tdb_path; char *tdb_path;
int rc;
tdb_path = "/usr/local/samba/private/mapistore/openchange/indexing.tdb"; tdb_path = "/usr/local/samba/private/mapistore/openchange/indexing.tdb";
wrap = tdb_wrap_open(NULL, tdb_path, 0, TDB_NOLOCK, O_RDONLY, 0600); wrap = tdb_wrap_open(NULL, tdb_path, 0, TDB_NOLOCK, O_RDONLY, 0600);
if (wrap)
context = wrap->tdb; {
rc = tdb_traverse_read(wrap->tdb, MAPIStoreMappingTDBTraverse, mapping); context = wrap->tdb;
tdb_traverse_read(wrap->tdb, MAPIStoreMappingTDBTraverse, mapping);
}
} }
@implementation MAPIStoreMapping @implementation MAPIStoreMapping
-6
View File
@@ -34,12 +34,6 @@
return @"notes"; return @"notes";
} }
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
{
[mapping registerURL: @"sogo://openchange:openchange@notes/"
withID: 0x1c0001];
}
- (void) setupBaseFolder: (NSURL *) newURL - (void) setupBaseFolder: (NSURL *) newURL
{ {
baseFolder = [MAPIStoreNotesFolder baseFolderWithURL: newURL baseFolder = [MAPIStoreNotesFolder baseFolderWithURL: newURL
-6
View File
@@ -33,10 +33,4 @@
return @"reminders"; return @"reminders";
} }
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
{
[mapping registerURL: @"sogo://openchange:openchange@reminders/"
withID: 0x180001];
}
@end @end
+4 -3
View File
@@ -102,7 +102,8 @@ sogo_init (void)
*/ */
static int static int
sogo_create_context(TALLOC_CTX *mem_ctx, const char *uri, void **private_data) sogo_create_context(TALLOC_CTX *mem_ctx, const char *uri, uint64_t fid,
void **private_data)
{ {
NSAutoreleasePool *pool; NSAutoreleasePool *pool;
sogo_context *cContext; sogo_context *cContext;
@@ -117,8 +118,8 @@ sogo_create_context(TALLOC_CTX *mem_ctx, const char *uri, void **private_data)
MAPIStoreContextK = NSClassFromString (@"MAPIStoreContext"); MAPIStoreContextK = NSClassFromString (@"MAPIStoreContext");
if (MAPIStoreContextK) if (MAPIStoreContextK)
{ {
context = [MAPIStoreContextK contextFromURI: uri context = [MAPIStoreContextK contextFromURI: uri andFID: fid
inMemCtx: mem_ctx]; inMemCtx: mem_ctx];
[context retain]; [context retain];
cContext = talloc_zero(mem_ctx, sogo_context); cContext = talloc_zero(mem_ctx, sogo_context);
-6
View File
@@ -33,10 +33,4 @@
return @"schedule"; return @"schedule";
} }
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
{
[mapping registerURL: @"sogo://openchange:openchange@schedule/"
withID: 0xe0001];
}
@end @end
-6
View File
@@ -33,10 +33,4 @@
return @"search"; return @"search";
} }
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
{
[mapping registerURL: @"sogo://openchange:openchange@search/"
withID: 0xd0001];
}
@end @end
-6
View File
@@ -33,10 +33,4 @@
return @"shortcuts"; return @"shortcuts";
} }
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
{
[mapping registerURL: @"sogo://openchange:openchange@shortcuts/"
withID: 0xf0001];
}
@end @end
-6
View File
@@ -34,12 +34,6 @@
return @"tasks"; return @"tasks";
} }
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
{
[mapping registerURL: @"sogo://openchange:openchange@tasks/"
withID: 0x1d0001];
}
- (void) setupBaseFolder: (NSURL *) newURL - (void) setupBaseFolder: (NSURL *) newURL
{ {
baseFolder = [MAPIStoreTasksFolder baseFolderWithURL: newURL baseFolder = [MAPIStoreTasksFolder baseFolderWithURL: newURL
-6
View File
@@ -33,10 +33,4 @@
return @"views"; return @"views";
} }
+ (void) registerFixedMappings: (MAPIStoreMapping *) mapping
{
[mapping registerURL: @"sogo://openchange:openchange@views/"
withID: 0x110001];
}
@end @end