Monotone-Parent: 2a9b39358109c6ab8ccbb87ab7b22624cce16512

Monotone-Revision: cb40a9c82d22aadee4be035334aad9f79c4e019e

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-11-01T13:53:56
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2007-11-01 13:53:56 +00:00
parent c962c7126e
commit b2ba78f1c3
2 changed files with 41 additions and 4 deletions

View File

@@ -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".

View 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];