]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1241 d1b88da0-ebda-0310...
authorwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 6 Nov 2007 21:25:28 +0000 (21:25 +0000)
committerwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 6 Nov 2007 21:25:28 +0000 (21:25 +0000)
ChangeLog
SOPE/GDLContentStore/gcs_mkdir.m
SOPE/NGCards/iCalRepeatableEntityObject.h
SoObjects/Mailer/NSData+Mail.h
SoObjects/Mailer/NSString+Mail.h
SoObjects/Mailer/SOGoMailObject.m
SoObjects/Mailer/SOGoMailReply.m
SoObjects/SOGo/SOGoUser.m
UI/MailerUI/UIxMailToSelection.m
UI/SOGoUI/UIxComponent.m

index 54838b558d8058ec69319abf45c034b4a891c696..a379bb64bc75a1691990de5ee5f87c11ffd9a462 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-11-06  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
+
+       * UI/MailerUI/UIxMailToSelection.m ([UIxMailToSelection
+       -getAddressesFromFormValues:_dict]): take NSString and NSArray
+       values. Ignore addresses with a length of 0.
+
+       * SoObjects/SOGo/SOGoUser.m ([SOGoUser -mailAccounts]): we now
+       fetch the accounts from the user defaults and create default
+       values if missing.
+
 2007-11-05  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
 
        * UI/MailPartViewers/UIxMailPartTextViewer.m
index fc3b3547304d892eccf4c9b611259bd828d537ac..9e62ee87836e5aa1731ca81b7bcf71d26fc822eb 100644 (file)
@@ -66,7 +66,9 @@
     return 1;
   }
   
-  if ((error = [self->folderManager createFolderOfType:_type atPath:_path])) {
+  if ((error = [self->folderManager createFolderOfType:_type
+                   withName: @"testFolder"
+                   atPath:_path])) {
     [self logWithFormat:@"creation of folder %@ at %@ failed: %@",
            _type, _path, error];
     return 1;
index 08f19f81927dece8d30cfc3e9871388f6624f23b..fa475a01c4ec51fb946466dd04e73547fe3234c7 100644 (file)
@@ -43,7 +43,7 @@
 
 - (void)removeAllRecurrenceRules;
 - (void)addToRecurrenceRules:(id)_rrule;
-- (void)setRecurrenceRules:(id)_rrule;
+- (void)setRecurrenceRules:(NSArray *)_rrule;
 - (BOOL)hasRecurrenceRules;
 - (NSArray *)recurrenceRules;
 
index 45e033f74ae13acf621883081db677d25d88f551..d223178204600cc5a781dfb32366be37fd12fd45 100644 (file)
@@ -30,6 +30,7 @@
 @interface NSData (SOGoMailUtilities)
 
 - (NSData *) bodyDataFromEncoding: (NSString *) encoding;
+- (NSString *) decodedSubject;
 
 @end
 
index 72bc984a986f1c0b45d8c2a3c1b50c246a8f2b47..3b34491cbdeb436025c20fde486092cec823d2a8 100644 (file)
@@ -28,7 +28,6 @@
 @interface NSString (SOGoExtension)
 
 - (NSString *) htmlToText;
-
 - (NSString *) decodedSubject;
 
 @end
index 934f1c61ced1b5765dc0b69ab78ac3b200c50636..87a86fa294d30a69abeb71ded0d5b764e398a307 100644 (file)
@@ -44,6 +44,7 @@
 #import <SoObjects/SOGo/SOGoPermissions.h>
 #import <SoObjects/SOGo/SOGoUser.h>
 
+#import "NSString+Mail.h"
 #import "NSData+Mail.h"
 #import "SOGoMailFolder.h"
 #import "SOGoMailAccount.h"
index d2e939d943124e851d6ee1721db095a1b3d750bb..f1758ed6a3751b393503c7106a8078909d03dfb2 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #import <NGObjWeb/WOContext+SoObjects.h>
+#import <NGExtensions/NSString+misc.h>
 
 #import <SoObjects/SOGo/SOGoDateFormatter.h>
 #import <SoObjects/SOGo/SOGoUser.h>
index 708ed4f96e564a80f524da4e4589cfeb7a0d363b..64671657c587cee6a91e9c001ba8cfe9b5bc2031 100644 (file)
@@ -368,44 +368,58 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
 }
 
 /* mail */
-- (NSArray *) mailAccounts
+- (void) _prepareDefaultMailAccounts
 {
-#warning should be implemented with the user defaults interfaces
   NSMutableDictionary *mailAccount, *identity;
   NSMutableArray *identities;
   NSString *name, *fullName;
+  NSArray *mails;
+  unsigned int count, max;
+
+  mailAccount = [NSMutableDictionary dictionary];
+  name = [NSString stringWithFormat: @"%@@%@",
+                  login, fallbackIMAP4Server];
+  [mailAccount setObject: login forKey: @"userName"];
+  [mailAccount setObject: fallbackIMAP4Server forKey: @"serverName"];
+  [mailAccount setObject: name forKey: @"name"];
+
+  identities = [NSMutableArray array];
+  mails = [self allEmails];
+
+  max = [mails count];
+  if (max > 1)
+    max--;
+  for (count = 0; count < max; count++)
+    {
+      identity = [NSMutableDictionary dictionary];
+      fullName = [self cn];
+      if (![fullName length])
+       fullName = login;
+      [identity setObject: fullName forKey: @"fullName"];
+      [identity setObject: [mails objectAtIndex: count] forKey: @"email"];
+      [identities addObject: identity];
+    }
+  [[identities objectAtIndex: 0] setObject: [NSNumber numberWithBool: YES]
+                                forKey: @"isDefault"];
+
+  [mailAccount setObject: identities forKey: @"identities"];
+
+  mailAccounts = [NSMutableArray new];
+  [mailAccounts addObject: mailAccount];
+}
+
+- (NSArray *) mailAccounts
+{
+  NSUserDefaults *ud;
 
   if (!mailAccounts)
     {
-      NSArray *mails;
-      int i;
-
-      mailAccount = [NSMutableDictionary dictionary];
-      name = [NSString stringWithFormat: @"%@@%@", login, fallbackIMAP4Server];
-      [mailAccount setObject: login forKey: @"userName"];
-      [mailAccount setObject: fallbackIMAP4Server forKey: @"serverName"];
-      [mailAccount setObject: name forKey: @"name"];
-
-      identities = [NSMutableArray array];
-      mails = [self allEmails];
-
-      for (i = 0; i < [mails count]; i++)
-       {
-         identity = [NSMutableDictionary dictionary];
-         fullName = [self cn];
-         if (![fullName length])
-           fullName = login;
-         [identity setObject: fullName forKey: @"fullName"];
-         [identity setObject: [mails objectAtIndex: i] forKey: @"email"];
-         
-         if (i == 0) [identity setObject: [NSNumber numberWithBool: YES] forKey: @"isDefault"];
-         [identities addObject: identity];
-       }
-       
-      [mailAccount setObject: identities forKey: @"identities"];
-
-      mailAccounts = [NSMutableArray new];
-      [mailAccounts addObject: mailAccount];
+      ud = [self userDefaults];
+      mailAccounts = [ud objectForKey: @"MailAccounts"];
+      if (mailAccounts)
+       [mailAccounts retain];
+      else
+       [self _prepareDefaultMailAccounts];
     }
 
   return mailAccounts;
index ef5c141bc6a1006155ca945c47b509923bebb111..cdcc83bf05e8e75575f8181bbd657e94d4a5aab3 100644 (file)
@@ -285,11 +285,31 @@ static NSArray *headers = nil;
 
 /* handling requests */
 
+- (void) _fillAddresses: (NSMutableArray *) addresses
+            withObject: (id) object
+{
+  NSEnumerator *list;
+  NSString *currentAddress;
+
+  if ([object isKindOfClass: [NSString class]])
+    [addresses addObject: object];
+  else if ([object isKindOfClass: [NSArray class]])
+    {
+      list = [object objectEnumerator];
+      while ((currentAddress
+             = [[list nextObject] stringByTrimmingSpaces]))
+       if ([currentAddress length])
+         [addresses addObject: currentAddress];
+    }
+}
+
 - (void) getAddressesFromFormValues: (NSDictionary *) _dict
 {
   NSMutableArray *rawTo, *rawCc, *rawBcc;
+  NSString *idx, *popupKey, *popupValue;
   NSArray *keys;
   unsigned i, count;
+  id addr;
 
   rawTo  = [NSMutableArray arrayWithCapacity:4];
   rawCc  = [NSMutableArray arrayWithCapacity:4];
@@ -304,18 +324,16 @@ static NSArray *headers = nil;
       key = [keys objectAtIndex:i];
       if ([key hasPrefix:@"addr_"])
        {
-         NSString *idx, *addr, *popupKey, *popupValue;
-         
-         addr = [[_dict objectForKey:key] lastObject];
+         addr = [_dict objectForKey:key];
          idx  = [self getIndexFromIdentifier:key];
          popupKey = [NSString stringWithFormat:@"popup_%@", idx];
          popupValue = [[_dict objectForKey:popupKey] lastObject];
          if([popupValue isEqualToString:@"0"])
-           [rawTo addObject:addr];
+           [self _fillAddresses: rawTo withObject: addr];
          else if([popupValue isEqualToString:@"1"])
-           [rawCc addObject:addr];
+           [self _fillAddresses: rawCc withObject: addr];
          else
-           [rawBcc addObject:addr];
+           [self _fillAddresses: rawBcc withObject: addr];
        }
     }
   
index 273d3e20b9ffd48936b5fd88ef4743a66727ec21..efbe22c9125959a6e3ac0340ce77ae2533b38c6e 100644 (file)
 #import <Foundation/NSUserDefaults.h>
 #import <Foundation/NSKeyValueCoding.h>
 #import <Foundation/NSPathUtilities.h>
+
 #import <NGObjWeb/SoHTTPAuthenticator.h>
 #import <NGObjWeb/SoObjects.h>
 #import <NGObjWeb/WOResourceManager.h>
 #import <NGObjWeb/WORequest.h>
+#import <NGObjWeb/WOResponse.h>
 #import <NGObjWeb/WOContext+SoObjects.h>
 #import <NGExtensions/NSObject+Logs.h>
 #import <NGExtensions/NSString+misc.h>
 #import <NGExtensions/NSURL+misc.h>
+
 #import <SoObjects/SOGo/SOGoUser.h>
 #import <SoObjects/SOGo/SOGoObject.h>
 #import <SoObjects/SOGo/SOGoCustomGroupFolder.h>
 #import <SoObjects/SOGo/NSCalendarDate+SOGo.h>
 #import <SoObjects/SOGo/NSString+Utilities.h>
 
-#import "UIxComponent.h"
 #import "UIxJSClose.h"
 
+#import "UIxComponent.h"
+
 @interface UIxComponent (PrivateAPI)
 - (void)_parseQueryString:(NSString *)_s;
 - (NSMutableDictionary *)_queryParameters;