From 40d6ce66d01e0c5f7d258fde94d9c531edbbe919 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Sat, 17 Nov 2012 16:43:49 -0500 Subject: [PATCH] Small fix over previous commit. --- SoObjects/Contacts/NGVCard+SOGo.m | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/SoObjects/Contacts/NGVCard+SOGo.m b/SoObjects/Contacts/NGVCard+SOGo.m index 3419dea0f..1f26f81fd 100644 --- a/SoObjects/Contacts/NGVCard+SOGo.m +++ b/SoObjects/Contacts/NGVCard+SOGo.m @@ -216,11 +216,12 @@ convention: - (void) updateFromLDIFRecord: (NSDictionary *) ldifRecord { - CardElement *element; - NSArray *units; NSInteger year, yearOfToday, month, day; + CardElement *element; NSCalendarDate *now; + NSArray *units; NSString *ou; + id o; [self setNWithFamily: [ldifRecord objectForKey: @"sn"] given: [ldifRecord objectForKey: @"givenname"] @@ -303,8 +304,15 @@ convention: forKey: @""]; [self setNote: [ldifRecord objectForKey: @"description"]]; - [self setCategories: [[ldifRecord objectForKey: @"vcardcategories"] - componentsSeparatedByString: @","]]; + + o = [ldifRecord objectForKey: @"vcardcategories"]; + + // We can either have an array (from SOGo's web gui) or a + // string (from a LDIF import) as the value here. + if ([o isKindOfClass: [NSArray class]]) + [self setCategories: o]; + else + [self setCategories: [o componentsSeparatedByString: @","]]; [self cleanupEmptyChildren]; }