]> err.no Git - scalable-opengroupware.org/commitdiff
fixed for libNGMime v4.5.210
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 8 Feb 2005 17:04:04 +0000 (17:04 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 8 Feb 2005 17:04:04 +0000 (17:04 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@533 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/SoObjects/Mailer/ChangeLog
SOGo/SoObjects/Mailer/SOGoDraftObject.m
SOGo/SoObjects/Mailer/SOGoMailObject.h
SOGo/SoObjects/Mailer/SOGoMailObject.m
SOGo/SoObjects/Mailer/Version
SOGo/UI/Mailer/ChangeLog
SOGo/UI/Mailer/UIxMailEditorAction.m
SOGo/UI/Mailer/UIxMailListView.m
SOGo/UI/Mailer/UIxMailView.m
SOGo/UI/Mailer/UIxMailView.wox
SOGo/UI/Mailer/Version

index 2cfcfb0c54faa0202f8ea3b00afcad24b2c34cd8..e5807252bd484375380e0724b0e5d141a2586266 100644 (file)
@@ -1,3 +1,12 @@
+2005-02-08  Helge Hess  <helge.hess@opengroupware.org>
+
+       * v0.9.69
+       
+       * reworked for new NGImap4 v4.5.210 API
+       
+       * SOGoMailObject.m: removed fromEnvelopeAddress in favor of
+         fromEnvelopeAddresses to match the new NGImap4 v4.5.210 API
+
 2005-02-07  Helge Hess  <helge.hess@opengroupware.org>
 
        * v0.9.68
index 721a48d8db98c9ff78c88070553781c75449e6f2..cee6d885fbb068f318640bd6ca8198a0d3b4349d 100644 (file)
@@ -143,7 +143,13 @@ static BOOL       debugOn = NO;
 /* accessors */
 
 - (NSString *)sender {
-  return [[self fetchInfo] objectForKey:@"from"];
+  id tmp;
+  
+  if ((tmp = [[self fetchInfo] objectForKey:@"from"]) == nil)
+    return nil;
+  if ([tmp isKindOfClass:[NSArray class]])
+    return [tmp count] > 0 ? [tmp objectAtIndex:0] : nil;
+  return tmp;
 }
 
 /* attachments */
@@ -501,11 +507,25 @@ static BOOL       debugOn = NO;
   }
 }
 
+- (BOOL)isEmptyValue:(id)_value {
+  if (![_value isNotNull])
+    return YES;
+  
+  if ([_value isKindOfClass:[NSArray class]])
+    return [_value count] == 0 ? YES : NO;
+  
+  if ([_value isKindOfClass:[NSString class]])
+    return [_value length] == 0 ? YES : NO;
+  
+  return NO;
+}
+
 - (NGMutableHashMap *)mimeHeaderMapWithHeaders:(NSDictionary *)_headers {
   NGMutableHashMap *map;
   NSDictionary *lInfo; // TODO: this should be some kind of object?
   NSArray      *emails;
   NSString     *s;
+  id           from, replyTo;
   
   if ((lInfo = [self fetchInfo]) == nil)
     return nil;
@@ -528,13 +548,24 @@ static BOOL       debugOn = NO;
   
   /* add senders */
   
-  if ([(s = [lInfo objectForKey:@"from"]) length] > 0)
-    [map setObject:s forKey:@"from"];
+  from    = [lInfo objectForKey:@"from"];
+  replyTo = [lInfo objectForKey:@"replyTo"];
   
-  if ([(s = [lInfo objectForKey:@"replyTo"]) length] > 0)
-    [map setObject:s forKey:@"reply-to"];
-  else if ([(s = [lInfo objectForKey:@"from"]) length] > 0)
-    [map setObject:s forKey:@"reply-to"];
+  if (![self isEmptyValue:from]) {
+    if ([from isKindOfClass:[NSArray class]])
+      [map setObjects:from forKey:@"from"];
+    else
+      [map setObject:from forKey:@"from"];
+  }
+  
+  if (![self isEmptyValue:replyTo]) {
+    if ([from isKindOfClass:[NSArray class]])
+      [map setObjects:from forKey:@"reply-to"];
+    else
+      [map setObject:from forKey:@"reply-to"];
+  }
+  else if (![self isEmptyValue:from])
+    [map setObjects:[map objectsForKey:@"from"] forKey:@"reply-to"];
   
   /* add subject */
   
@@ -866,17 +897,25 @@ static BOOL       debugOn = NO;
 
 - (NGImap4Envelope *)envelope {
   NSDictionary *lInfo;
+  id from, replyTo;
   
   if (self->envelope != nil)
     return self->envelope;
   if ((lInfo = [self fetchInfo]) == nil)
     return nil;
   
+  if ((from = [self sender]) != nil)
+    from = [NSArray arrayWithObjects:&from count:1];
+
+  if ((replyTo = [lInfo objectForKey:@"replyTo"]) != nil) {
+    if (![replyTo isKindOfClass:[NSArray class]])
+      replyTo = [NSArray arrayWithObjects:&replyTo count:1];
+  }
+  
   self->envelope = 
     [[NGImap4Envelope alloc] initWithMessageID:[self nameInContainer]
                             subject:[lInfo objectForKey:@"subject"]
-                            sender:[self sender]
-                            replyTo:[lInfo objectForKey:@"replyTo"]
+                            from:from replyTo:replyTo
                             to:[lInfo objectForKey:@"to"]
                             cc:[lInfo objectForKey:@"cc"]
                             bcc:[lInfo objectForKey:@"bcc"]];
index 148a5a8e1bad2126b2518b54c3f4d90945427805..225881826bbaba9ac9fb73821066eca0b33b83be 100644 (file)
@@ -56,7 +56,7 @@
 - (NGImap4Envelope *)envelope;
 - (NSString *)subject;
 - (NSCalendarDate *)date;
-- (NGImap4EnvelopeAddress *)fromEnvelopeAddress;
+- (NSArray *)fromEnvelopeAddresses;
 - (NSArray *)toEnvelopeAddresses;
 - (NSArray *)ccEnvelopeAddresses;
 
index 008fc8f66626922db9090139606f82abcb77125e..51ee3e7ff80d90b78fbfa8d07c76391f52fe9dff 100644 (file)
@@ -165,7 +165,7 @@ static BOOL debugBodyStructure = NO;
 - (NSCalendarDate *)date {
   return [[self envelope] date];
 }
-- (NGImap4EnvelopeAddress *)fromEnvelopeAddress {
+- (NSArray *)fromEnvelopeAddresses {
   return [[self envelope] from];
 }
 - (NSArray *)toEnvelopeAddresses {
index 6ce68cb93f18792d99246b1653181d4ec78bc9cc..4a26ace74ea17bd9ac90c286ac146045f2507ef3 100644 (file)
@@ -1,9 +1,10 @@
 # Version file
 
-SUBMINOR_VERSION:=68
+SUBMINOR_VERSION:=69
 
-# v0.9.55 requires NGExtensions v4.5.136
-# v0.9.44 requires libNGMime    v4.3.194
-# v0.9.41 requires libNGMime    v4.3.190
-# v0.9.35 requires libSOGoLogic v0.9.24
-# v0.9.34 requires libSOGoLogic v0.9.22
+# v0.9.69 requires libNGMime       v4.5.210
+# v0.9.55 requires libNGExtensions v4.5.136
+# v0.9.44 requires libNGMime       v4.3.194
+# v0.9.41 requires libNGMime       v4.3.190
+# v0.9.35 requires libSOGoLogic    v0.9.24
+# v0.9.34 requires libSOGoLogic    v0.9.22
index 52d64f36c033cad530d5fd3431005ba1961b64b1..8fd5d3d0764d41d126259e6e7d08c52bf41166b6 100644 (file)
@@ -1,5 +1,12 @@
 2005-02-08  Helge Hess  <helge.hess@opengroupware.org>
 
+       * v0.9.94
+
+       * UIxMailListView.m: properly show "to" address in tableview for
+         Sent folder
+
+       * UIxMailView.m: fixed for new 'from' API
+
        * v0.9.93
 
        * mailer.js: work on the read-mail marking code, properly change the
index 6a88bdd58290b4be0378e1d0be55921e47f8058d..675a673cb3b5e9a2276be4e7980342900d3a2227 100644 (file)
   return r;
 }
 
-/* response actions */
+/* reply */
+
+- (BOOL)hasReplyPrefix:(NSString *)_subject {
+  static NSString *replyPrefixes[] = {
+    @"Re:", // regular
+    @"RE:", // Outlook v11 (English?)
+    @"AW:", // German Outlook v11
+    @"Re[", // numbered Re, eg "Re[2]:"
+    nil
+  };
+  unsigned i;
+  for (i = 0; replyPrefixes[i] != nil; i++) {
+    if ([_subject hasPrefix:replyPrefixes[i]])
+      return YES;
+  }
+  return NO;
+}
+
+- (NSString *)replySubject:(NSString *)_subject {
+  if (![_subject isNotNull] || [_subject length] == 0)
+    return _subject;
+  
+  if ([self hasReplyPrefix:_subject]) {
+    /* do not do: "Re: Re: Re: My Mail" - a single Re is sufficient ;-) */
+    return _subject;
+  }
+  
+  return [@"Re: " stringByAppendingString:_subject];
+}
+
+- (void)fillInReplyAddresses:(NSMutableDictionary *)_info
+  replyToAll:(BOOL)_replyToAll
+  envelope:(NGImap4Envelope *)_envelope
+{
+  /*
+    The rules (as checked against Thunderbird):
+    - if there is a 'reply-to' header, only include that (as TO)
+    - if we reply to all, all non-from addresses are added as CC
+    - the from is always the lone TO (except for reply-to)
+
+    TODO: what about sender (RFC 822 3.6.2)
+  */
+  [self logWithFormat:@"env: %@", _envelope];
+}
 
 - (id)replyToAll:(BOOL)_replyToAll {
+  NSMutableDictionary *info;
   NSException *error;
+  id result;
   id tmp;
   
   /* ensure mail exists and is filled */
   if ((error = [self _setupNewDraft]) != nil)
     return error;
   
+  /* fill draft info */
+  
+  info = [NSMutableDictionary dictionaryWithCapacity:16];
+  
+  [info setObject:[self replySubject:[[self clientObject] subject]]
+       forKey:@"subject"];
+  [self fillInReplyAddresses:info replyToAll:_replyToAll 
+       envelope:[[self clientObject] envelope]];
+  
+  /* fill content */
+  
+  /* save draft info */
+
+  [self logWithFormat:@"INFO: %@", info];
+  
+#if 0
+  if ((error = [self->newDraft storeInfo:info]) != nil)
+    return error;
+#endif
+  
 #if 0
-  [self logWithFormat:@"CORE: %@", [[self clientObject] fetchCoreInfos]];
+  // TODO: we might want to pass the original URL to the editor for a final
+  //       redirect back to the message?
+  result = [self redirectToEditNewDraft];
+#else
+  result = [NSException exceptionWithHTTPStatus:501 /* Not Implemented */
+                       reason:@"Sorry, reply is not yet implemented!"];
 #endif
   [self reset];
-  return [NSException exceptionWithHTTPStatus:501 /* Not Implemented */
-                     reason:@"Sorry, reply is not yet implemented!"];
+  return result;
 }
 
 - (id)replyAction {
   return [self replyToAll:YES];
 }
 
+/* forwarding */
+
 - (NSString *)getAttachmentNameForSubject:(NSString *)_subject {
   /* SOGoDraftObject disallows some strings - anything else required? */
   static NSString *sescape[] = { 
     return error;
   
   /* set subject (do we need to set anything else?) */
-
+  
   info = [NSDictionary dictionaryWithObjectsAndKeys:
                         [self forwardSubject:[[self clientObject] subject]],
                         @"subject",
index 917edaf35d66966feca298f781cf9536b6671063..63365076b0fd465930d6a81180ad05fd6b138cb3 100644 (file)
@@ -78,8 +78,10 @@ static int attachmentFlagSize = 8096;
 }
 
 - (BOOL)showToAddress {
-  // TODO: switch for Sent folder
-  return NO;
+  NSString *ftype;
+  
+  ftype = [[self clientObject] valueForKey:@"outlookFolderClass"];
+  return [ftype isEqual:@"IPF.Sent"];
 }
 
 /* title */
index d7ffaedd3605932c8089f8fb4d903cb912c0cc1b..9cb519c000d37d8b0c62584606ac8f71c141876b 100644 (file)
   return [@"mailto:" stringByAppendingString:[_address baseEMail]];
 }
 
-- (NSString *)fromLink {
-  return [self linkToEnvelopeAddress:
-                [[self clientObject] fromEnvelopeAddress]];
-}
 - (NSString *)currentAddressLink {
   return [self linkToEnvelopeAddress:[self currentAddress]];
 }
index 381d69b0db0e82a1e07149769696d35c46ab0cd8..be283004f135bab28fda15fa5d8fc7d9e2842f50 100644 (file)
@@ -10,6 +10,8 @@
   title="panelTitle"
   const:hideFolderTree="1"
 >
+  <!-- TODO: refactor address rendering into an own component -->
+
   <!-- 
     Note: We cannot make this section static (like the toolbar) because the CC
           list has a dynamic height (would require some tricky JavaScript).
     <tr class="mailer_fieldrow">
       <td class="mailer_fieldname" ><var:string label:value="From"/>:</td>
       <td class="mailer_fieldvalue">
-        <a var:href="fromLink">
-          <var:string value="clientObject.fromEnvelopeAddress"
-               formatter="context.mailEnvelopeFullAddressFormatter" /></a>
+        <var:foreach list="clientObject.fromEnvelopeAddresses"
+                     item="currentAddress">
+          <a var:href="currentAddressLink">
+            <var:string value="currentAddress"
+                 formatter="context.mailEnvelopeFullAddressFormatter" /></a>
+        </var:foreach>
       </td>
     </tr>
     <tr class="mailer_fieldrow">
index 3cdf3491de5cce0ae51afa6314dab000442e4a37..0a00b14216ab6a593c86c07196ae96d4a88ef3d7 100644 (file)
@@ -1,7 +1,9 @@
 # version file
 
-SUBMINOR_VERSION:=93
+SUBMINOR_VERSION:=94
 
+# v0.9.94 requires SoObjects/Mailer v0.9.69
+# v0.9.94 requires libNGMime        v4.5.210
 # v0.9.91 requires SoObjects/Mailer v0.9.68
 # v0.9.89 requires SoObjects/Mailer v0.9.67
 # v0.9.87 requires SoObjects/Mailer v0.9.65