diff --git a/ChangeLog b/ChangeLog index 14b36de71..e03713bf6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2010-12-30 Wolfgang Sourdeau + * OpenChange/SOGoMAPIFSFolder.m (-initWithURL:andTableType:): + accepts a new "tableType" parameter to store messages in a + different place of the fs folder hierarchy. + * OpenChange/NSValue+MAPIStore.m (-asDoubleInMemCtx): really returns a double rather than an uint64_t. diff --git a/OpenChange/SOGoMAPIFSFolder.h b/OpenChange/SOGoMAPIFSFolder.h index b59c558a5..43c836323 100644 --- a/OpenChange/SOGoMAPIFSFolder.h +++ b/OpenChange/SOGoMAPIFSFolder.h @@ -35,8 +35,10 @@ BOOL directoryIsSane; } -+ (id) folderWithURL: (NSURL *) url; -- (id) initWithURL: (NSURL *) url; ++ (id) folderWithURL: (NSURL *) url + andTableType: (uint8_t) tableType; +- (id) initWithURL: (NSURL *) url + andTableType: (uint8_t) tableType; - (NSString *) directory; diff --git a/OpenChange/SOGoMAPIFSFolder.m b/OpenChange/SOGoMAPIFSFolder.m index 783205a3b..5c44d4b1d 100644 --- a/OpenChange/SOGoMAPIFSFolder.m +++ b/OpenChange/SOGoMAPIFSFolder.m @@ -58,10 +58,12 @@ static NSString *privateDir = nil; } + (id) folderWithURL: (NSURL *) url + andTableType: (uint8_t) tableType { SOGoMAPIFSFolder *newFolder; - newFolder = [[self alloc] initWithURL: url]; + newFolder = [[self alloc] initWithURL: url + andTableType: tableType]; [newFolder autorelease]; return newFolder; @@ -85,16 +87,29 @@ static NSString *privateDir = nil; } - (id) initWithURL: (NSURL *) url + andTableType: (uint8_t) tableType { - NSString *path; + NSString *path, *tableParticle; if ((self = [self init])) { + if (tableType == MAPISTORE_MESSAGE_TABLE) + tableParticle = @"message"; + else if (tableType == MAPISTORE_FAI_TABLE) + tableParticle = @"fai"; + else + { + [NSException raise: @"MAPIStoreIOException" + format: @"unsupported table type: %d", tableType]; + tableParticle = nil; + } + path = [url path]; if (![path hasSuffix: @"/"]) path = [NSString stringWithFormat: @"%@/", path]; - directory = [NSString stringWithFormat: @"%@/mapistore/SOGo/%@/%@%@", - privateDir, [url user], [url host], path]; + directory = [NSString stringWithFormat: @"%@/mapistore/SOGo/%@/%@/%@%@", + privateDir, [url user], tableParticle, + [url host], path]; [self logWithFormat: @"directory: %@", directory]; [directory retain]; ASSIGN (nameInContainer, [path stringByDeletingLastPathComponent]);