From 396755fffb85b9012a32afdc5ff6f428c3ec075a Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Fri, 20 Jul 2018 09:44:20 -0400 Subject: [PATCH] (fix) handle multi-valued mozillasecondemail attribute mapping --- NEWS | 6 ++++++ SoObjects/Contacts/NGVCard+SOGo.m | 20 ++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 3ceff16e0..ff8e29b33 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +4.x.x (2018-xx-xx) +------------------ + +Bug fixes + - [core] handle multi-valued mozillasecondemail attribute mapping + 4.0.1 (2018-07-10) ------------------ diff --git a/SoObjects/Contacts/NGVCard+SOGo.m b/SoObjects/Contacts/NGVCard+SOGo.m index 5909928b2..d96b66cb3 100644 --- a/SoObjects/Contacts/NGVCard+SOGo.m +++ b/SoObjects/Contacts/NGVCard+SOGo.m @@ -274,8 +274,24 @@ convention: } } - homeMail = [self elementWithTag: @"email" ofType: @"home"]; - [homeMail setSingleValue: [ldifRecord objectForKey: @"mozillasecondemail"] forKey: @""]; + mail = [ldifRecord objectForKey: @"mozillasecondemail"]; + if ([mail isKindOfClass: [NSArray class]]) + { + mailList = [(NSArray *)mail objectEnumerator]; + while ((mail = [mailList nextObject])) + { + if ([mail length] && ![emails containsObject: mail]) + [self addElementWithTag: @"email" + ofType: @"home" + withValue: mail]; + } + } + else + { + homeMail = [self elementWithTag: @"email" ofType: @"home"]; + [homeMail setSingleValue: mail forKey: @""]; + } + [[self uniqueChildWithTag: @"x-mozilla-html"] setSingleValue: [ldifRecord objectForKey: @"mozillausehtmlmail"] forKey: @""];