From: wolfgang Date: Thu, 1 Nov 2007 14:04:38 +0000 (+0000) Subject: git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1211 d1b88da0-ebda-0310... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca68834d6eaebcdd8cd202143e341493ef0b1e55;p=scalable-opengroupware.org git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1211 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/ChangeLog b/ChangeLog index 14fbeaa3..ce73e9ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2007-11-01 Wolfgang Sourdeau + * 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". diff --git a/SoObjects/Mailer/SOGoDraftObject.m b/SoObjects/Mailer/SOGoDraftObject.m index 2cc71010..77a1f58c 100644 --- a/SoObjects/Mailer/SOGoDraftObject.m +++ b/SoObjects/Mailer/SOGoDraftObject.m @@ -23,6 +23,7 @@ #import #import #import +#import #import #import #import @@ -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]; diff --git a/SoObjects/Mailer/SOGoMailAccount.h b/SoObjects/Mailer/SOGoMailAccount.h index e6e55ebb..8c720e1f 100644 --- a/SoObjects/Mailer/SOGoMailAccount.h +++ b/SoObjects/Mailer/SOGoMailAccount.h @@ -36,10 +36,9 @@ @class NSArray; @class NSString; -@class SOGoDraftsFolder; -@class SOGoMailFolder; -@class SOGoSentFolder; -@class SOGoTrashFolder; +#import "SOGoDraftsFolder.h" +#import "SOGoSentFolder.h" +#import "SOGoTrashFolder.h" @interface SOGoMailAccount : SOGoMailBaseObject {