Monotone-Parent: 6d3ffdac670dcdb4b4ded0a4c992663c091081b4
Monotone-Revision: 38034fab3edb528144b8d3e433e6e9bb5ff1a41c Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-01-31T12:54:36 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
8ffac8727d
commit
a0060fd7ce
|
@ -1,3 +1,12 @@
|
||||||
|
2012-01-31 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* OpenChange/MAPIStoreMailContext.m
|
||||||
|
(+listContextsForUser:withTDBIndexing:inMemCtx:): now returns
|
||||||
|
secondary folders.
|
||||||
|
(+[MAPIStoreOutboxContext
|
||||||
|
listContextsForUser:withTDBIndexing:inMemCtx:]): overridden method
|
||||||
|
in outbox-specific class.
|
||||||
|
|
||||||
2012-01-30 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2012-01-30 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
* OpenChange/MAPIStoreMailFolder.m (-addProperties): overriden
|
* OpenChange/MAPIStoreMailFolder.m (-addProperties): overriden
|
||||||
|
|
|
@ -28,9 +28,7 @@
|
||||||
@interface MAPIStoreMailContext : MAPIStoreContext
|
@interface MAPIStoreMailContext : MAPIStoreContext
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#import "MAPIStoreFSBaseContext.h"
|
@interface MAPIStoreOutboxContext : MAPIStoreMailContext
|
||||||
|
|
||||||
@interface MAPIStoreDeletedItemsContext : MAPIStoreFSBaseContext
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif /* MAPISTOREMAILCONTEXT_H */
|
#endif /* MAPISTOREMAILCONTEXT_H */
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#import <Foundation/NSArray.h>
|
||||||
#import <Foundation/NSDictionary.h>
|
#import <Foundation/NSDictionary.h>
|
||||||
#import <Foundation/NSString.h>
|
#import <Foundation/NSString.h>
|
||||||
|
|
||||||
|
@ -54,34 +55,38 @@ static Class MAPIStoreMailFolderK;
|
||||||
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
{
|
{
|
||||||
struct mapistore_contexts_list *firstContext, *context;
|
struct mapistore_contexts_list *firstContext = NULL, *context;
|
||||||
NSString *urlBase, *stringData;
|
NSString *urlBase, *stringData, *currentName, *inboxName, *draftsName, *sentName, *trashName;
|
||||||
|
NSMutableArray *secondaryFolders;
|
||||||
enum mapistore_context_role role[] = {MAPISTORE_MAIL_ROLE,
|
enum mapistore_context_role role[] = {MAPISTORE_MAIL_ROLE,
|
||||||
MAPISTORE_DRAFTS_ROLE,
|
MAPISTORE_DRAFTS_ROLE,
|
||||||
MAPISTORE_SENTITEMS_ROLE,
|
MAPISTORE_SENTITEMS_ROLE};
|
||||||
MAPISTORE_OUTBOX_ROLE};
|
NSString *folderName[3];
|
||||||
NSString *folderName[4];
|
NSUInteger count, max;
|
||||||
NSUInteger count;
|
|
||||||
SOGoMailAccount *accountFolder;
|
SOGoMailAccount *accountFolder;
|
||||||
MAPIStoreUserContext *userContext;
|
MAPIStoreUserContext *userContext;
|
||||||
WOContext *woContext;
|
WOContext *woContext;
|
||||||
|
|
||||||
firstContext = NULL;
|
|
||||||
|
|
||||||
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
||||||
andTDBIndexing: indexingTdb];
|
andTDBIndexing: indexingTdb];
|
||||||
accountFolder = [[userContext rootFolders] objectForKey: @"mail"];
|
accountFolder = [[userContext rootFolders] objectForKey: @"mail"];
|
||||||
woContext = [userContext woContext];
|
woContext = [userContext woContext];
|
||||||
folderName[0] = @"folderINBOX";
|
|
||||||
folderName[1] = [NSString stringWithFormat: @"folder%@",
|
inboxName = @"folderINBOX";
|
||||||
[accountFolder draftsFolderNameInContext: woContext]];
|
folderName[0] = inboxName;
|
||||||
folderName[2] = [NSString stringWithFormat: @"folder%@",
|
|
||||||
[accountFolder sentFolderNameInContext: woContext]];
|
draftsName = [NSString stringWithFormat: @"folder%@",
|
||||||
folderName[3] = folderName[1];
|
[accountFolder draftsFolderNameInContext: woContext]];
|
||||||
|
folderName[1] = draftsName;
|
||||||
|
sentName = [NSString stringWithFormat: @"folder%@",
|
||||||
|
[accountFolder sentFolderNameInContext: woContext]];
|
||||||
|
folderName[2] = sentName;
|
||||||
|
trashName = [NSString stringWithFormat: @"folder%@",
|
||||||
|
[accountFolder trashFolderNameInContext: woContext]];
|
||||||
|
|
||||||
urlBase = [NSString stringWithFormat: @"sogo://%@:%@@mail/", userName, userName];
|
urlBase = [NSString stringWithFormat: @"sogo://%@:%@@mail/", userName, userName];
|
||||||
|
|
||||||
for (count = 0; count < 4; count++)
|
for (count = 0; count < 3; count++)
|
||||||
{
|
{
|
||||||
context = talloc_zero (memCtx, struct mapistore_contexts_list);
|
context = talloc_zero (memCtx, struct mapistore_contexts_list);
|
||||||
stringData = [NSString stringWithFormat: @"%@%@", urlBase,
|
stringData = [NSString stringWithFormat: @"%@%@", urlBase,
|
||||||
|
@ -96,6 +101,29 @@ static Class MAPIStoreMailFolderK;
|
||||||
DLIST_ADD_END (firstContext, context, void);
|
DLIST_ADD_END (firstContext, context, void);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
secondaryFolders = [[accountFolder toManyRelationshipKeysWithNamespaces: NO]
|
||||||
|
mutableCopy];
|
||||||
|
[secondaryFolders autorelease];
|
||||||
|
[secondaryFolders removeObject: inboxName];
|
||||||
|
[secondaryFolders removeObject: draftsName];
|
||||||
|
[secondaryFolders removeObject: draftsName];
|
||||||
|
[secondaryFolders removeObject: sentName];
|
||||||
|
[secondaryFolders removeObject: trashName];
|
||||||
|
max = [secondaryFolders count];
|
||||||
|
for (count = 0; count < max; count++)
|
||||||
|
{
|
||||||
|
context = talloc_zero (memCtx, struct mapistore_contexts_list);
|
||||||
|
currentName = [secondaryFolders objectAtIndex: count];
|
||||||
|
stringData = [NSString stringWithFormat: @"%@%@", urlBase, currentName];
|
||||||
|
context->url = [stringData asUnicodeInMemCtx: context];
|
||||||
|
stringData = [currentName substringFromIndex: 6];
|
||||||
|
context->name = [stringData asUnicodeInMemCtx: context];
|
||||||
|
context->main_folder = false;
|
||||||
|
context->role = MAPISTORE_MAIL_ROLE;
|
||||||
|
context->tag = "tag";
|
||||||
|
DLIST_ADD_END (firstContext, context, void);
|
||||||
|
}
|
||||||
|
|
||||||
return firstContext;
|
return firstContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,25 +137,44 @@ static Class MAPIStoreMailFolderK;
|
||||||
return [[userContext rootFolders] objectForKey: @"mail"];
|
return [[userContext rootFolders] objectForKey: @"mail"];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (enum mapistore_context_role) contextRole
|
|
||||||
{
|
|
||||||
return MAPISTORE_MAIL_ROLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#import "MAPIStoreFSFolder.h"
|
@implementation MAPIStoreOutboxContext
|
||||||
|
|
||||||
@implementation MAPIStoreDeletedItemsContext
|
|
||||||
|
|
||||||
+ (NSString *) MAPIModuleName
|
+ (NSString *) MAPIModuleName
|
||||||
{
|
{
|
||||||
return @"deleted-items";
|
return @"outbox";
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (enum mapistore_context_role) contextRole
|
+ (struct mapistore_contexts_list *) listContextsForUser: (NSString *) userName
|
||||||
|
withTDBIndexing: (struct tdb_wrap *) indexingTdb
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
{
|
{
|
||||||
return MAPISTORE_DELETEDITEMS_ROLE;
|
struct mapistore_contexts_list *context;
|
||||||
|
NSString *url, *folderName;
|
||||||
|
SOGoMailAccount *accountFolder;
|
||||||
|
MAPIStoreUserContext *userContext;
|
||||||
|
WOContext *woContext;
|
||||||
|
|
||||||
|
userContext = [MAPIStoreUserContext userContextWithUsername: userName
|
||||||
|
andTDBIndexing: indexingTdb];
|
||||||
|
accountFolder = [[userContext rootFolders] objectForKey: @"mail"];
|
||||||
|
woContext = [userContext woContext];
|
||||||
|
folderName = [NSString stringWithFormat: @"folder%@",
|
||||||
|
[accountFolder draftsFolderNameInContext: woContext]];
|
||||||
|
url = [NSString stringWithFormat: @"sogo://%@:%@@outbox/%@", userName,
|
||||||
|
userName, folderName];
|
||||||
|
|
||||||
|
context = talloc_zero (memCtx, struct mapistore_contexts_list);
|
||||||
|
context->url = [url asUnicodeInMemCtx: context];
|
||||||
|
/* TODO: use a localized version of this display name */
|
||||||
|
context->name = [@"Outbox" asUnicodeInMemCtx: context];
|
||||||
|
context->main_folder = true;
|
||||||
|
context->role = MAPISTORE_OUTBOX_ROLE;
|
||||||
|
context->tag = "tag";
|
||||||
|
context->prev = context;
|
||||||
|
|
||||||
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in a new issue