]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1315 d1b88da0-ebda-0310...
authorwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Fri, 21 Dec 2007 21:50:57 +0000 (21:50 +0000)
committerwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Fri, 21 Dec 2007 21:50:57 +0000 (21:50 +0000)
ChangeLog
UI/Contacts/UIxContactView.m

index cefc413c399fb39bbb37a721605cb3dc472de01d..8832f35d1f236d245aea23bee367d8105d531d33 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index dc789fa7b485bce88ae2d9b1a1ccf56e1346fbbb..ec2c8f27ab03b447f124ac3ca99556004715bfb2 100644 (file)
   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];