* SoObjects/Mailer/SOGoMailForward.m (from, to, cc, reply-to):

mailHeaders returns an array if there are multiple headers of the same type.
  Handle this case to correctly show multiple from, to, cc and reply-to headers
  in mail replies/forwards instead of crashing.

Monotone-Parent: dac25405c6ab2f1d735ddb9f6db4243e5e96d14b
Monotone-Revision: 29aefdeb26834742b8cd9f01120573b4dcbcc7ed

Monotone-Author: jraby@inverse.ca
Monotone-Date: 2012-07-12T16:47:23
This commit is contained in:
Jean Raby 2012-07-12 16:47:23 +00:00
parent 825686eaed
commit ef848303a3
3 changed files with 32 additions and 17 deletions

View file

@ -1,3 +1,10 @@
2012-07-12 Jean Raby <jraby@inverse.ca>
* SoObjects/Mailer/SOGoMailForward.m (from, to, cc, reply-to):
mailHeaders returns an array if there are multiple headers of the same type.
Handle this case to correctly show multiple from, to, cc and reply-to headers
in mail replies/forwards instead of crashing.
2012-07-11 Ludovic Marcotte <lmarcotte@inverse.ca> 2012-07-11 Ludovic Marcotte <lmarcotte@inverse.ca>
* Finished the implementation and testing of the two * Finished the implementation and testing of the two

2
NEWS
View file

@ -12,7 +12,7 @@ Enhancements
limited to one additional address) limited to one additional address)
Bug Fixes Bug Fixes
- - Fixed a crash when multiple mail header of the same type were encountered.
1.3.16 (2012-06-07) 1.3.16 (2012-06-07)
------------------- -------------------

View file

@ -89,13 +89,13 @@
- (NSString *) from - (NSString *) from
{ {
NSString *rc; id rc;
if (htmlComposition)
rc = [[[sourceMail mailHeaders] objectForKey: @"from"]
stringByEscapingHTMLString];
else
rc = [[sourceMail mailHeaders] objectForKey: @"from"]; rc = [[sourceMail mailHeaders] objectForKey: @"from"];
if ([rc isKindOfClass: [NSArray class]])
rc = [rc componentsJoinedByString: @", "];
if (htmlComposition)
rc = [rc stringByEscapingHTMLString];
return rc; return rc;
} }
@ -119,13 +119,16 @@
- (NSString *) replyTo - (NSString *) replyTo
{ {
NSString *rc; id rc;
rc = [self _headerField: @"reply-to"];
if ([rc isKindOfClass: [NSArray class]])
rc = [rc componentsJoinedByString: @", "];
if (htmlComposition) if (htmlComposition)
rc = [NSString stringWithFormat: @"%@<br/>", rc = [NSString stringWithFormat: @"%@<br/>",
[[self _headerField: @"reply-to"] stringByEscapingHTMLString]]; [rc stringByEscapingHTMLString]];
else else
rc = ([NSString stringWithFormat: @"%@\n", [self _headerField: @"reply-to"]]); rc = ([NSString stringWithFormat: @"%@\n", rc]);
return rc; return rc;
} }
@ -149,12 +152,13 @@
- (NSString *) to - (NSString *) to
{ {
NSString *rc; id rc;
rc = [self _headerField: @"to"];
if ([rc isKindOfClass: [NSArray class]])
rc = [rc componentsJoinedByString: @", "];
if (htmlComposition) if (htmlComposition)
rc = [[[sourceMail mailHeaders] objectForKey: @"to"] stringByEscapingHTMLString]; rc = [rc stringByEscapingHTMLString];
else
rc = [[sourceMail mailHeaders] objectForKey: @"to"];
return rc; return rc;
} }
@ -166,13 +170,17 @@
- (NSString *) cc - (NSString *) cc
{ {
NSString *rc; id *rc;
rc = [self _headerField: @"cc"];
if ([rc isKindOfClass: [NSArray class]])
rc = [rc componentsJoinedByString: @", "];
if (htmlComposition) if (htmlComposition)
rc = [NSString stringWithFormat: @"%@<br/>", rc = [NSString stringWithFormat: @"%@<br/>",
[[self _headerField: @"cc"] stringByEscapingHTMLString]]; [rc stringByEscapingHTMLString]];
else else
rc = ([NSString stringWithFormat: @"%@\n", [self _headerField: @"cc"]]); rc = [NSString stringWithFormat: @"%@\n", rc];
return rc; return rc;
} }