]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1211 d1b88da0-ebda-0310...
authorwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 1 Nov 2007 14:04:38 +0000 (14:04 +0000)
committerwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 1 Nov 2007 14:04:38 +0000 (14:04 +0000)
ChangeLog
SoObjects/Mailer/SOGoDraftObject.m
SoObjects/Mailer/SOGoMailAccount.h

index 14fbeaa35c90d02472044667418a596c100b4462..ce73e9ed1102197a02a8f7fae977e56ff81d9577 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2007-11-01  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
 
+       * SoObjects/Mailer/SOGoDraftObject.m ([SOGoDraftObject
+       -setHeaders:newHeaders]): make sure there is a message id in the
+       headers dictionary, if not, generate one.
+       ([SOGoDraftObject -fetchMailForEditing:sourceMail]): retrieve the
+       message id from the existing draft.
+       ([SOGoDraftObject -mimeHeaderMapWithHeaders:_headers]): store the
+       message id in the header map.
+
        * UI/MailerUI/UIxMailFolderActions.m ([UIxMailFolderActions
        -deleteFolderAction]): no longer prefix the target folder with
        "folder".
index 2cc71010e49324d027058eefafd6d656707c3bd9..77a1f58c4b00423b75c6da55218b03c31de6e5a7 100644 (file)
@@ -23,6 +23,7 @@
 #import <Foundation/NSAutoreleasePool.h>
 #import <Foundation/NSDictionary.h>
 #import <Foundation/NSKeyValueCoding.h>
+#import <Foundation/NSProcessInfo.h>
 #import <Foundation/NSURL.h>
 #import <Foundation/NSUserDefaults.h>
 #import <Foundation/NSValue.h>
@@ -67,7 +68,7 @@
 
 static NSString *contentTypeValue = @"text/plain; charset=utf-8";
 static NSString *headerKeys[] = {@"subject", @"to", @"cc", @"bcc", 
-                                @"from", @"replyTo",
+                                @"from", @"replyTo", @"message-id",
                                 nil};
 
 @implementation SOGoDraftObject
@@ -161,12 +162,26 @@ static BOOL        showTextAttachmentsInline  = NO;
 
 /* contents */
 
+- (NSString *) _generateMessageID
+{
+  NSMutableString *messageID;
+  NSString *pGUID;
+
+  messageID = [NSMutableString string];
+  [messageID appendFormat: @"<%@", [self globallyUniqueObjectId]];
+  pGUID = [[NSProcessInfo processInfo] globallyUniqueString];
+  [messageID appendFormat: @"@%u>", [pGUID hash]];
+
+  return [messageID lowercaseString];
+}
+
 - (void) setHeaders: (NSDictionary *) newHeaders
 {
   id headerValue;
   unsigned int count;
+  NSString *messageID;
 
-  for (count = 0; count < 7; count++)
+  for (count = 0; count < 8; count++)
     {
       headerValue = [newHeaders objectForKey: headerKeys[count]];
       if (headerValue)
@@ -175,6 +190,13 @@ static BOOL        showTextAttachmentsInline  = NO;
       else
        [headers removeObjectForKey: headerKeys[count]];
     }
+
+  messageID = [headers objectForKey: @"message-id"];
+  if (!messageID)
+    {
+      messageID = [self _generateMessageID];
+      [headers setObject: messageID forKey: @"message-id"];
+    }
 }
 
 - (NSDictionary *) headers
@@ -462,7 +484,7 @@ static BOOL        showTextAttachmentsInline  = NO;
 
 - (void) fetchMailForEditing: (SOGoMailObject *) sourceMail
 {
-  NSString *subject;
+  NSString *subject, *msgid;
   NSMutableDictionary *info;
   NSMutableArray *addresses;
   NGImap4Envelope *sourceEnvelope;
@@ -477,6 +499,10 @@ static BOOL        showTextAttachmentsInline  = NO;
     [info setObject: subject forKey: @"subject"];
 
   sourceEnvelope = [sourceMail envelope];
+  msgid = [sourceEnvelope messageID];
+  if ([msgid length] > 0)
+    [info setObject: msgid forKey: @"message-id"];
+
   addresses = [NSMutableArray array];
   [self _addEMailsOfAddresses: [sourceEnvelope to] toArray: addresses];
   [info setObject: addresses forKey: @"to"];
@@ -1055,7 +1081,10 @@ static BOOL        showTextAttachmentsInline  = NO;
     [map setObject: [s asQPSubjectString: @"utf-8"]
         forKey: @"subject"];
 //     [map setObject: [s asQPSubjectString: @"utf-8"] forKey: @"subject"];
-  
+
+  [map setObject: [headers objectForKey: @"message-id"]
+       forKey: @"message-id"];
+
   /* add standard headers */
 
   dateString = [[NSCalendarDate date] rfc822DateString];
index e6e55ebb6b8cfc1d831619d8498b4c74a60a9517..8c720e1f1852c56f1e2965eb53f74e96d8225536 100644 (file)
 @class NSArray;
 @class NSString;
 
-@class SOGoDraftsFolder;
-@class SOGoMailFolder;
-@class SOGoSentFolder;
-@class SOGoTrashFolder;
+#import "SOGoDraftsFolder.h"
+#import "SOGoSentFolder.h"
+#import "SOGoTrashFolder.h"
 
 @interface SOGoMailAccount : SOGoMailBaseObject
 {