diff --git a/ChangeLog b/ChangeLog index e30c6e076..6fda9625b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2010-01-06 Wolfgang Sourdeau + * SoObjects/Mailer/SOGoMailNamespace.m + (-lookupName:inContext:acquire:): overriden method because the + namespace "folders" cannot be created and cannot contain messages. + * SoObjects/Mailer/SOGoMailAccount.m (-otherUsersFolderNamespaces): new method that returns all the namespace "folders" in the "other user" namespace. Replaces the diff --git a/SoObjects/Mailer/SOGoMailNamespace.m b/SoObjects/Mailer/SOGoMailNamespace.m index 2677a51e9..3dda1402e 100644 --- a/SoObjects/Mailer/SOGoMailNamespace.m +++ b/SoObjects/Mailer/SOGoMailNamespace.m @@ -20,6 +20,10 @@ * Boston, MA 02111-1307, USA. */ +#import + +#import "SOGoMailAccount.h" + #import "SOGoMailNamespace.h" @implementation SOGoMailNamespace @@ -29,4 +33,42 @@ return nil; } +- (id) lookupName: (NSString *) _key + inContext: (id)_ctx + acquire: (BOOL) _acquire +{ + NSString *folderName, *fullFolderName, *className; + SOGoMailAccount *mailAccount; + id obj; + + if ([_key hasPrefix: @"folder"]) + { + mailAccount = [self mailAccountFolder]; + folderName = [[_key substringFromIndex: 6] fromCSSIdentifier]; + fullFolderName = [NSString stringWithFormat: @"%@/%@", + [self traversalFromMailAccount], folderName]; + if ([fullFolderName + isEqualToString: [mailAccount sentFolderNameInContext: _ctx]]) + className = @"SOGoSentFolder"; + else if ([fullFolderName isEqualToString: + [mailAccount draftsFolderNameInContext: _ctx]]) + className = @"SOGoDraftsFolder"; + else if ([fullFolderName isEqualToString: + [mailAccount trashFolderNameInContext: _ctx]]) + className = @"SOGoTrashFolder"; + /* else if ([folderName isEqualToString: + [mailAccount sieveFolderNameInContext: _ctx]]) + obj = [self lookupFiltersFolder: _key inContext: _ctx]; */ + else + className = @"SOGoMailFolder"; + + obj = [NSClassFromString (className) objectWithName: _key + inContainer: self]; + } + else + obj = [super lookupName: _key inContext: _ctx acquire: NO]; + + return obj; +} + @end