* 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
maint-2.0.2
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,6 +1,13 @@
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
new defaults. Also added documentation in the SOGo Installation new defaults. Also added documentation in the SOGo Installation
and Configuration Guide. and Configuration Guide.

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;
rc = [[sourceMail mailHeaders] objectForKey: @"from"];
if ([rc isKindOfClass: [NSArray class]])
rc = [rc componentsJoinedByString: @", "];
if (htmlComposition) if (htmlComposition)
rc = [[[sourceMail mailHeaders] objectForKey: @"from"] rc = [rc stringByEscapingHTMLString];
stringByEscapingHTMLString];
else
rc = [[sourceMail mailHeaders] objectForKey: @"from"];
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;
} }