]> err.no Git - scalable-opengroupware.org/commitdiff
improved special mail folders
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 7 Feb 2005 01:07:03 +0000 (01:07 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 7 Feb 2005 01:07:03 +0000 (01:07 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@520 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/SoObjects/Mailer/ChangeLog
SOGo/SoObjects/Mailer/SOGoMailAccount.h
SOGo/SoObjects/Mailer/SOGoMailAccount.m
SOGo/SoObjects/Mailer/SOGoMailFolder.h
SOGo/SoObjects/Mailer/SOGoMailFolder.m
SOGo/SoObjects/Mailer/Version

index 2578a09abc7d8bcc070c27f77c507bff6a5a3a3d..2d9d7440defb7e282b338de4abd195defecc15e3 100644 (file)
@@ -1,3 +1,13 @@
+2005-02-07  Helge Hess  <helge.hess@opengroupware.org>
+
+       * v0.9.67
+
+       * SOGoMailFolder.m: detect special folder names and return proper
+         folder type
+
+       * SOGoMailAccount.m: made Sent/Trash folder name configurable using the
+         'SOGoSentFolderName'/'SOGoTrashFolderName' defaults
+
 2005-02-06  Helge Hess  <helge.hess@opengroupware.org>
 
        * SOGoMailFolder.m, SOGoDraftsFolder.m: added proper folder classes
index 20c30d6d9aa12f59e086f493aafcbeead58ca6d9..1c3b4ae6bbd5094ca84b64f2e69e18584bb524b2 100644 (file)
 
 /* special folders */
 
+- (NSString *)inboxFolderNameInContext:(id)_ctx;
+- (NSString *)draftsFolderNameInContext:(id)_ctx;
+- (NSString *)sieveFolderNameInContext:(id)_ctx;
+- (NSString *)sentFolderNameInContext:(id)_ctx;
+- (NSString *)trashFolderNameInContext:(id)_ctx;
+
 - (SOGoMailFolder *)inboxFolderInContext:(id)_ctx;
 - (SOGoMailFolder *)sentFolderInContext:(id)_ctx;
 - (SOGoMailFolder *)trashFolderInContext:(id)_ctx;
index 658af71eb89a299d6ace190fd0bd9d7f375962f0..68c6ca8e348125137f3394eab2fbd86f95e0ca04 100644 (file)
 
 @implementation SOGoMailAccount
 
+static NSArray  *rootFolderNames  = nil;
 static NSString *inboxFolderName  = @"INBOX";
 static NSString *draftsFolderName = @"Drafts";
 static NSString *sieveFolderName  = @"Filters";
-static NSArray  *rootFolderNames  = nil;
 
 + (void)initialize {
   NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
@@ -159,6 +159,44 @@ static NSArray  *rootFolderNames  = nil;
 
 /* special folders */
 
+- (NSString *)inboxFolderNameInContext:(id)_ctx {
+  return inboxFolderName; /* cannot be changed in Cyrus ? */
+}
+- (NSString *)draftsFolderNameInContext:(id)_ctx {
+  return draftsFolderName; /* SOGo managed folder */
+}
+- (NSString *)sieveFolderNameInContext:(id)_ctx {
+  return sieveFolderName;  /* SOGo managed folder */
+}
+- (NSString *)sentFolderNameInContext:(id)_ctx {
+  /* OGo issue #1225 */
+  static NSString *s = nil;
+  
+  if (s == nil) {
+    NSUserDefaults *ud;
+    
+    ud = [NSUserDefaults standardUserDefaults];
+    s = [[ud stringForKey:@"SOGoSentFolderName"] copy];
+    if ([s length] == 0) s = @"Sent";
+    NSLog(@"Note: using SOGoSentFolderName: '%@'", s);
+  }
+  return s;
+}
+- (NSString *)trashFolderNameInContext:(id)_ctx {
+  /* OGo issue #1225 */
+  static NSString *s = nil;
+  
+  if (s == nil) {
+    NSUserDefaults *ud;
+    
+    ud = [NSUserDefaults standardUserDefaults];
+    s = [[ud stringForKey:@"SOGoTrashFolderName"] copy];
+    if ([s length] == 0) s = @"Trash";
+    NSLog(@"Note: using SOGoTrashFolderName: '%@'", s);
+  }
+  return s;
+}
+
 - (SOGoMailFolder *)inboxFolderInContext:(id)_ctx {
   // TODO: use some profile to determine real location, use a -traverse lookup
   SOGoMailFolder *folder;
@@ -166,7 +204,8 @@ static NSArray  *rootFolderNames  = nil;
   if (self->inboxFolder != nil)
     return self->inboxFolder;
   
-  folder = [self lookupName:inboxFolderName inContext:_ctx acquire:NO];
+  folder = [self lookupName:[self inboxFolderNameInContext:_ctx]
+                inContext:_ctx acquire:NO];
   if ([folder isKindOfClass:[NSException class]]) return folder;
   
   return ((self->inboxFolder = [folder retain]));
@@ -182,7 +221,8 @@ static NSArray  *rootFolderNames  = nil;
   folder = [self inboxFolderInContext:_ctx];
   if ([folder isKindOfClass:[NSException class]]) return folder;
   
-  folder = [folder lookupName:@"Sent" inContext:_ctx acquire:NO];
+  folder = [folder lookupName:[self sentFolderNameInContext:_ctx]
+                  inContext:_ctx acquire:NO];
   if ([folder isKindOfClass:[NSException class]]) return folder;
   
   if (![folder isNotNull]) {
@@ -203,7 +243,8 @@ static NSArray  *rootFolderNames  = nil;
   folder = [self inboxFolderInContext:_ctx];
   if ([folder isKindOfClass:[NSException class]]) return folder;
   
-  folder = [folder lookupName:@"Trash" inContext:_ctx acquire:NO];
+  folder = [folder lookupName:[self trashFolderNameInContext:_ctx]
+                  inContext:_ctx acquire:NO];
   if ([folder isKindOfClass:[NSException class]]) return folder;
   
   if (![folder isNotNull]) {
index ddb014d10fa8f4a7d60b74e9e775c72cfa550983..ffdd06f6558d9517f53225471da0e98ed8e8556d 100644 (file)
@@ -37,7 +37,8 @@
 
 @interface SOGoMailFolder : SOGoMailBaseObject
 {
-  NSArray *filenames;
+  NSArray  *filenames;
+  NSString *folderType;
 }
 
 /* messages */
index 43a0e61a61655c939d5ee2a154afc7ee640c4b45..2e5591252bc687558ba262caf35f7f8f21eec006 100644 (file)
 
 #include "SOGoMailFolder.h"
 #include "SOGoMailObject.h"
+#include "SOGoMailAccount.h"
 #include "SOGoMailManager.h"
 #include "common.h"
 
 @implementation SOGoMailFolder
 
 - (void)dealloc {
-  [self->filenames release];
+  [self->filenames  release];
+  [self->folderType release];
   [super dealloc];
 }
 
 
 - (NSString *)outlookFolderClass {
   // TODO: detect Trash/Sent/Drafts folders
-  return @"IPF.Folder";
+  SOGoMailAccount *account;
+  NSString *n;
+
+  if (self->folderType != nil)
+    return self->folderType;
+  
+  account = [self mailAccountFolder];
+  n       = [self nameInContainer];
+  
+  if ([n isEqualToString:[account trashFolderNameInContext:nil]])
+    self->folderType = @"IPF.Trash";
+  else if ([n isEqualToString:[account inboxFolderNameInContext:nil]])
+    self->folderType = @"IPF.Inbox";
+  else if ([n isEqualToString:[account sentFolderNameInContext:nil]])
+    self->folderType = @"IPF.Sent";
+  else
+    self->folderType = @"IPF.Folder";
+  
+  return self->folderType;
 }
 
 /* operations */
index 37ff74e8347b451a382cb519ee08e5b9ed674749..c5364fcf3ef25bc81f45772e9227dcd5bb549309 100644 (file)
@@ -1,6 +1,6 @@
 # Version file
 
-SUBMINOR_VERSION:=66
+SUBMINOR_VERSION:=67
 
 # v0.9.55 requires NGExtensions v4.5.136
 # v0.9.44 requires libNGMime    v4.3.194