From: wolfgang Date: Fri, 21 Dec 2007 21:50:57 +0000 (+0000) Subject: git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1315 d1b88da0-ebda-0310... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6337588928bb0aafdc7789791ebeb5919c14d07a;p=scalable-opengroupware.org git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1315 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/ChangeLog b/ChangeLog index cefc413c..8832f35d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-12-21 Ludovic Marcotte + + * 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 * SoObjects/SOGo/SOGoContentObject.m ([SOGoContentObject diff --git a/UI/Contacts/UIxContactView.m b/UI/Contacts/UIxContactView.m index dc789fa7..ec2c8f27 100644 --- a/UI/Contacts/UIxContactView.m +++ b/UI/Contacts/UIxContactView.m @@ -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: @"" - @"%@", email, email]; + email = [[emails objectAtIndex: [emails count]-1] value: 0]; + + if ([email caseInsensitiveCompare: [card preferredEMail]] != NSOrderedSame) + mailTo = [NSString stringWithFormat: @"" + @"%@", email, email]; } - else - mailTo = nil; + + [emails release]; return [self _cardStringWithLabel: @"Additional Email:" value: mailTo];