merge of '980f8e11a36d32aa3078b0d7bb5d661b1dad120f'
and 'e95189d2eb78ea96edf9291b7136e415251a7eb4' Monotone-Parent: 980f8e11a36d32aa3078b0d7bb5d661b1dad120f Monotone-Parent: e95189d2eb78ea96edf9291b7136e415251a7eb4 Monotone-Revision: 0b736cc980075f71e643c2c71341dee25f434fb9 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-09-06T14:16:25 Monotone-Branch: ca.inverse.sogomaint-2.0.2
commit
6cc4a7fca4
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2012-09-06 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* OpenChange/MAPIStoreMailVolatileMessage.m
|
||||
(FillMessageHeadersFromProperties): build a recipient list for the
|
||||
"from" field from the list stored in the value for "orig" in the
|
||||
recipients dict.
|
||||
(FillMessageHeadersFromProperties): now take a "withBcc" parameter
|
||||
that defines whether the "bcc" field must be ignored in the header.
|
||||
(_generateMailDataWithBcc:): the above code enables use to remove
|
||||
the search and replace hack required to remove the "bcc" header in
|
||||
the message text.
|
||||
|
||||
2012-09-05 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* OpenChange/MAPIStoreMailMessage.m (-getMessageData:inMemCtx:):
|
||||
|
|
|
@ -532,7 +532,7 @@ QuoteSpecials (NSString *address)
|
|||
|
||||
static inline void
|
||||
FillMessageHeadersFromProperties (NGMutableHashMap *headers,
|
||||
NSDictionary *mailProperties,
|
||||
NSDictionary *mailProperties, BOOL withBcc,
|
||||
struct mapistore_connection_info *connInfo)
|
||||
{
|
||||
NSMutableString *subject;
|
||||
|
@ -540,7 +540,7 @@ FillMessageHeadersFromProperties (NGMutableHashMap *headers,
|
|||
NSArray *list;
|
||||
NSCalendarDate *date;
|
||||
NSDictionary *recipients;
|
||||
NSUInteger count;
|
||||
NSUInteger type, bccLimit;
|
||||
SOGoUser *activeUser;
|
||||
|
||||
activeUser
|
||||
|
@ -555,12 +555,21 @@ FillMessageHeadersFromProperties (NGMutableHashMap *headers,
|
|||
recipients = [mailProperties objectForKey: @"recipients"];
|
||||
if (recipients)
|
||||
{
|
||||
for (count = 1; count < 3; count++)
|
||||
if (withBcc)
|
||||
bccLimit = MAPI_BCC;
|
||||
else
|
||||
bccLimit = MAPI_CC;
|
||||
bccLimit++;
|
||||
for (type = MAPI_TO; type < bccLimit; type++)
|
||||
{
|
||||
recId = recTypes[count];
|
||||
recId = recTypes[type];
|
||||
list = MakeRecipientsList ([recipients objectForKey: recId]);
|
||||
[headers setObjects: list forKey: recId];
|
||||
}
|
||||
|
||||
list = MakeRecipientsList ([recipients objectForKey: @"orig"]);
|
||||
if (list)
|
||||
[headers setObjects: list forKey: @"from"];
|
||||
}
|
||||
else
|
||||
NSLog (@"message without recipients");
|
||||
|
@ -791,7 +800,7 @@ MakeMessageBody (NSDictionary *mailProperties, NSDictionary *attachmentParts, NS
|
|||
return messageBody;
|
||||
}
|
||||
|
||||
- (NGMimeMessage *) _generateMessage
|
||||
- (NGMimeMessage *) _generateMessageWithBcc: (BOOL) withBcc
|
||||
{
|
||||
NSString *contentType;
|
||||
NGMimeMessage *message;
|
||||
|
@ -799,7 +808,7 @@ MakeMessageBody (NSDictionary *mailProperties, NSDictionary *attachmentParts, NS
|
|||
id messageBody;
|
||||
|
||||
headers = [[NGMutableHashMap alloc] initWithCapacity: 16];
|
||||
FillMessageHeadersFromProperties (headers, properties,
|
||||
FillMessageHeadersFromProperties (headers, properties, withBcc,
|
||||
[[self context] connectionInfo]);
|
||||
message = [[NGMimeMessage alloc] initWithHeader: headers];
|
||||
[message autorelease];
|
||||
|
@ -820,37 +829,13 @@ MakeMessageBody (NSDictionary *mailProperties, NSDictionary *attachmentParts, NS
|
|||
NGMimeMessage *message;
|
||||
NGMimeMessageGenerator *generator;
|
||||
NSData *messageData;
|
||||
NSMutableData *cleanedMessage;
|
||||
NSRange r1, r2;
|
||||
|
||||
/* mime message generation */
|
||||
generator = [NGMimeMessageGenerator new];
|
||||
message = [self _generateMessage];
|
||||
message = [self _generateMessageWithBcc: withBcc];
|
||||
messageData = [generator generateMimeFromPart: message];
|
||||
[generator release];
|
||||
|
||||
if (!withBcc)
|
||||
{
|
||||
cleanedMessage = [messageData mutableCopy];
|
||||
[cleanedMessage autorelease];
|
||||
r1 = [cleanedMessage rangeOfCString: "\r\n\r\n"];
|
||||
r1 = [cleanedMessage rangeOfCString: "\r\nbcc: "
|
||||
options: 0
|
||||
range: NSMakeRange(0,r1.location-1)];
|
||||
if (r1.location != NSNotFound)
|
||||
{
|
||||
// We search for the first \r\n AFTER the Bcc: header and
|
||||
// replace the whole thing with \r\n.
|
||||
r2 = [cleanedMessage rangeOfCString: "\r\n"
|
||||
options: 0
|
||||
range: NSMakeRange(NSMaxRange(r1)+1,[cleanedMessage length]-NSMaxRange(r1)-1)];
|
||||
[cleanedMessage replaceBytesInRange: NSMakeRange(r1.location, NSMaxRange(r2)-r1.location)
|
||||
withBytes: "\r\n"
|
||||
length: 2];
|
||||
}
|
||||
messageData = cleanedMessage;
|
||||
}
|
||||
|
||||
// [messageData writeToFile: @"/tmp/mimegen.eml" atomically: NO];
|
||||
|
||||
return messageData;
|
||||
|
|
Loading…
Reference in New Issue