Monotone-Parent: 0e5cfd9eddf3cfeb9a5ff45ef7e78508b2d5a686

Monotone-Revision: 9bec05d8cd20a1e980c6381c10c71a9e57b984e6

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2012-01-30T20:20:02
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2012-01-30 20:20:02 +00:00
parent f3cbd4f172
commit 98c9f995c8
2 changed files with 40 additions and 6 deletions

View File

@ -1,5 +1,9 @@
2012-01-30 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreFallbackContext.m
(+listContextsForUser:withTDBIndexing:inMemCtx:): now returns the
fallback subfolders as secondary contexts (tmp hack).
* OpenChange/MAPIStoreUserContext.m (-rootFolders): new method
replacing the "...root" methods in way that can match the
MAPIModuleName.

View File

@ -20,9 +20,13 @@
* Boston, MA 02111-1307, USA.
*/
#import <Foundation/NSArray.h>
#import <Foundation/NSString.h>
#import <Foundation/NSURL.h>
#import "MAPIStoreFallbackContext.h"
#import "NSString+MAPIStore.h"
#import "SOGoMAPIFSFolder.h"
#undef DEBUG
#include <mapistore/mapistore.h>
@ -38,18 +42,44 @@
withTDBIndexing: (struct tdb_wrap *) indexingTdb
inMemCtx: (TALLOC_CTX *) memCtx
{
struct mapistore_contexts_list *context;
struct mapistore_contexts_list *firstContext = NULL, *context;
SOGoMAPIFSFolder *root;
NSArray *names;
NSUInteger count, max;
NSString *baseURL, *url, *name;
context = talloc_zero(memCtx, struct mapistore_contexts_list);
context->url = talloc_asprintf (context, "sogo://%s@fallback/",
[userName UTF8String]);
baseURL = [NSString stringWithFormat: @"sogo://%@@fallback/", userName];
context = talloc_zero (memCtx, struct mapistore_contexts_list);
context->url = [baseURL asUnicodeInMemCtx: context];
context->name = "Fallback";
context->main_folder = true;
context->role = MAPISTORE_FALLBACK_ROLE;
context->tag = "tag";
context->prev = context;
return context;
DLIST_ADD_END (firstContext, context, void);
/* Maybe emsmdbp_provisioning should be fixed in order to only take the uri
returned above to avoid deleting its entries... */
root = [SOGoMAPIFSFolder folderWithURL: [NSURL URLWithString: baseURL]
andTableType: MAPISTORE_MESSAGE_TABLE];
names = [root toManyRelationshipKeys];
max = [names count];
for (count = 0; count < max; count++)
{
name = [names objectAtIndex: count];
url = [NSString stringWithFormat: @"%@%@/", baseURL, name];
context = talloc_zero (memCtx, struct mapistore_contexts_list);
context->url = [url asUnicodeInMemCtx: context];
context->name = [name asUnicodeInMemCtx: context];
context->main_folder = false;
context->role = MAPISTORE_FALLBACK_ROLE;
context->tag = "tag";
DLIST_ADD_END (firstContext, context, void);
}
return firstContext;
}
@end