(feat) handle multiple home/work phones, emails and urls

This commit is contained in:
Ludovic Marcotte 2015-08-18 16:21:47 -04:00
parent 8cef98eba1
commit 38713a6c67
3 changed files with 16 additions and 9 deletions

View file

@ -1,6 +1,6 @@
/* NGVCard+SOGo.h - this file is part of SOGo /* NGVCard+SOGo.h - this file is part of SOGo
* *
* Copyright (C) 2009-2014 Inverse inc. * Copyright (C) 2009-2015 Inverse inc.
* *
* This file is free software; you can redistribute it and/or modify * This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -31,6 +31,10 @@
- (CardElement *) elementWithTag: (NSString *) elementTag - (CardElement *) elementWithTag: (NSString *) elementTag
ofType: (NSString *) type; ofType: (NSString *) type;
- (void) addElementWithTag: (NSString *) elementTag
ofType: (NSString *) type
withValue: (id) value;
- (void) updateFromLDIFRecord: (NSDictionary *) ldifRecord; - (void) updateFromLDIFRecord: (NSDictionary *) ldifRecord;
- (NSMutableDictionary *) asLDIFRecord; - (NSMutableDictionary *) asLDIFRecord;

View file

@ -188,8 +188,8 @@ convention:
} }
- (void) addElementWithTag: (NSString *) elementTag - (void) addElementWithTag: (NSString *) elementTag
ofType: (NSString *) type ofType: (NSString *) type
withValue: (id) value withValue: (id) value
{ {
NSArray *allValues; NSArray *allValues;
NSEnumerator *list; NSEnumerator *list;

View file

@ -430,8 +430,9 @@ static Class SOGoContactGCSEntryK = Nil;
{ {
if ([attrs isKindOfClass: [NSDictionary class]]) if ([attrs isKindOfClass: [NSDictionary class]])
{ {
element = [card elementWithTag: @"tel" ofType: [attrs objectForKey: @"type"]]; [card addElementWithTag: @"tel"
[element setSingleValue: [attrs objectForKey: @"value"] forKey: @""]; ofType: [attrs objectForKey: @"type"]
withValue: [attrs objectForKey: @"value"]];
} }
} }
} }
@ -448,8 +449,9 @@ static Class SOGoContactGCSEntryK = Nil;
{ {
if ([o isKindOfClass: [NSDictionary class]]) if ([o isKindOfClass: [NSDictionary class]])
{ {
element = [card elementWithTag: @"email" ofType: [o objectForKey: @"type"]]; [card addElementWithTag: @"email"
[element setSingleValue: [o objectForKey: @"value"] forKey: @""]; ofType: [o objectForKey: @"type"]
withValue: [o objectForKey: @"value"]];
} }
} }
} }
@ -466,8 +468,9 @@ static Class SOGoContactGCSEntryK = Nil;
{ {
if ([attrs isKindOfClass: [NSDictionary class]]) if ([attrs isKindOfClass: [NSDictionary class]])
{ {
element = [card elementWithTag: @"url" ofType: [attrs objectForKey: @"type"]]; [card addElementWithTag: @"url"
[element setSingleValue: [attrs objectForKey: @"value"] forKey: @""]; ofType: [attrs objectForKey: @"type"]
withValue: [attrs objectForKey: @"value"]];
} }
} }
} }