mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-20 10:55:25 +00:00
(feat) added custom fields support from Thunderbird's address book
This commit is contained in:
@@ -270,14 +270,15 @@
|
||||
* @apiSuccess (Success 200) {Object[]} [urls] URLs
|
||||
* @apiSuccess (Success 200) {String} urls.type Type (e.g., personal or work)
|
||||
* @apiSuccess (Success 200) {String} urls.value URL
|
||||
* @apiSuccess (Success 200) {Object[]} customFields Custom fields from Thunderbird
|
||||
*/
|
||||
- (id <WOActionResults>) dataAction
|
||||
{
|
||||
id <WOActionResults> result;
|
||||
id o;
|
||||
NSMutableDictionary *customFields, *data;
|
||||
SOGoObject <SOGoContactObject> *contact;
|
||||
id <WOActionResults> result;
|
||||
NSArray *values;
|
||||
NSMutableDictionary *data;
|
||||
id o;
|
||||
|
||||
contact = [self clientObject];
|
||||
card = [contact vCard];
|
||||
@@ -355,6 +356,23 @@
|
||||
if ([contact hasPhoto])
|
||||
[data setObject: [self photoURL] forKey: @"photoURL"];
|
||||
|
||||
// Custom fields from Thunderbird
|
||||
customFields = [NSMutableDictionary dictionary];
|
||||
if ((o = [[card uniqueChildWithTag: @"custom1"] flattenedValuesForKey: @""]) && [o length])
|
||||
[customFields setObject: o forKey: @"1"];
|
||||
|
||||
if ((o = [[card uniqueChildWithTag: @"custom2"] flattenedValuesForKey: @""]) && [o length])
|
||||
[customFields setObject: o forKey: @"2"];
|
||||
|
||||
if ((o = [[card uniqueChildWithTag: @"custom3"] flattenedValuesForKey: @""]) && [o length])
|
||||
[customFields setObject: o forKey: @"3"];
|
||||
|
||||
if ((o = [[card uniqueChildWithTag: @"custom4"] flattenedValuesForKey: @""]) && [o length])
|
||||
[customFields setObject: o forKey: @"4"];
|
||||
|
||||
if ([customFields count])
|
||||
[data setObject: customFields forKey: @"customFields"];
|
||||
|
||||
result = [self responseWithStatus: 200
|
||||
andString: [data jsonRepresentation]];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user