merge of '2918fd48475c28fab3fffda506a3e755d3121d38'

and '46e53471ba15a415a840ddb058785b89b6415704'

Monotone-Parent: 2918fd48475c28fab3fffda506a3e755d3121d38
Monotone-Parent: 46e53471ba15a415a840ddb058785b89b6415704
Monotone-Revision: 4bfedf0d0ab8fc8042756a4922e29e7270a9c9c0

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-12-21T21:50:34
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2007-12-21 21:50:34 +00:00
commit 7574a9bb3a
2 changed files with 23 additions and 7 deletions

View File

@ -1,3 +1,11 @@
2007-12-21 Ludovic Marcotte <ludovic@inverse.ca>
* UI/Contacts/UIxContactView.m
Modified -secondaryEmail so that we always get
the "last" email address in case no preferred
one was specified in the vCard. Also fixed
a memory leak in this method.
2007-12-20 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/SOGoContentObject.m ([SOGoContentObject

View File

@ -104,20 +104,28 @@
NSMutableArray *emails;
emails = [NSMutableArray new];
mailTo = nil;
[emails addObjectsFromArray: [card childrenWithTag: @"email"]];
[emails removeObjectsInArray: [card childrenWithTag: @"email"
andAttribute: @"type"
havingValue: @"pref"]];
if ([emails count] > 1)
// We might not have a preferred item but rather something like this:
// EMAIL;TYPE=work:dd@ee.com
// EMAIL;TYPE=home:ff@gg.com
// In this case, we always return the last entry.
if ([emails count] > 0)
{
email = [[emails objectAtIndex: 0] value: 0];
mailTo = [NSString stringWithFormat: @"<a href=\"mailto:%@\""
@" onclick=\"return onContactMailTo(this);\">"
@"%@</a>", email, email];
email = [[emails objectAtIndex: [emails count]-1] value: 0];
if ([email caseInsensitiveCompare: [card preferredEMail]] != NSOrderedSame)
mailTo = [NSString stringWithFormat: @"<a href=\"mailto:%@\""
@" onclick=\"return onContactMailTo(this);\">"
@"%@</a>", email, email];
}
else
mailTo = nil;
[emails release];
return [self _cardStringWithLabel: @"Additional Email:"
value: mailTo];