diff --git a/ChangeLog b/ChangeLog index 31872acd6..c3080acc6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2012-01-30 Wolfgang Sourdeau + * 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. diff --git a/OpenChange/MAPIStoreFallbackContext.m b/OpenChange/MAPIStoreFallbackContext.m index 23c6285b2..c234e1f84 100644 --- a/OpenChange/MAPIStoreFallbackContext.m +++ b/OpenChange/MAPIStoreFallbackContext.m @@ -20,9 +20,13 @@ * Boston, MA 02111-1307, USA. */ +#import #import +#import #import "MAPIStoreFallbackContext.h" +#import "NSString+MAPIStore.h" +#import "SOGoMAPIFSFolder.h" #undef DEBUG #include @@ -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