(fix) LDIF to vCard conversion for non-handled multi-value attributes (fixes #4086)

pull/236/head
Ludovic Marcotte 2017-04-21 12:31:18 -04:00
parent 2b4e357da6
commit 513d81eb59
9 changed files with 49 additions and 45 deletions

1
NEWS
View File

@ -15,6 +15,7 @@ Bug fixes
- [core] fix sogo-tool restore potentially crashing on corrupted data (#4048)
- [core] handle properly mails using windows-1255 charset (#4124)
- [core] fixed email reminders sent multiple times (#4100)
- [core] fixed LDIF to vCard conversion for non-handled multi-value attributes (#4086)
- [eas] set reply/forwarded flags when ReplaceMime is set (#4133)
- [eas] remove alarms over EAS if we don't want them (#4059)
- [eas] correctly set RSVP on event invitations

View File

@ -1,6 +1,6 @@
/* CardElement.h - this file is part of SOPE
*
* Copyright (C) 2006-2014 Inverse inc.
* Copyright (C) 2006-2017 Inverse inc.
*
* 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
@ -64,7 +64,7 @@
- (NSMutableDictionary *) values;
/* ELEM:...;value1,value2,...;... */
- (void) setValues: (NSMutableArray *) newValues
- (void) setValues: (id) newValues
atIndex: (NSUInteger) idx
forKey: (NSString *) key;

View File

@ -1,6 +1,6 @@
/* CardElement.m - this file is part of SOPE
*
* Copyright (C) 2006-2014 Inverse inc.
* Copyright (C) 2006-2017 Inverse inc.
*
* 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
@ -130,12 +130,17 @@
return values;
}
- (void) setValues: (NSMutableArray *) newValues
- (void) setValues: (id) newValues
atIndex: (NSUInteger) idx
forKey: (NSString *) key
{
NSMutableArray *oldValues, *subValues;
if ([newValues isKindOfClass: [NSString class]])
return [self setSingleValue: (NSString *)newValues
atIndex: idx
forKey: key];
oldValues = [self valuesForKey: key];
if (!oldValues)
{

View File

@ -277,32 +277,32 @@ convention:
[self setFn: fn];
element = [self elementWithTag: @"adr" ofType: @"home"];
[element setSingleValue: [ldifRecord objectForKey: @"mozillahomestreet2"]
atIndex: 1 forKey: @""];
[element setSingleValue: [ldifRecord objectForKey: @"mozillahomestreet"]
atIndex: 2 forKey: @""];
[element setSingleValue: [ldifRecord objectForKey: @"mozillahomelocalityname"]
atIndex: 3 forKey: @""];
[element setSingleValue: [ldifRecord objectForKey: @"mozillahomestate"]
atIndex: 4 forKey: @""];
[element setSingleValue: [ldifRecord objectForKey: @"mozillahomepostalcode"]
atIndex: 5 forKey: @""];
[element setSingleValue: [ldifRecord objectForKey: @"mozillahomecountryname"]
atIndex: 6 forKey: @""];
[element setValues: [ldifRecord objectForKey: @"mozillahomestreet2"]
atIndex: 1 forKey: @""];
[element setValues: [ldifRecord objectForKey: @"mozillahomestreet"]
atIndex: 2 forKey: @""];
[element setValues: [ldifRecord objectForKey: @"mozillahomelocalityname"]
atIndex: 3 forKey: @""];
[element setValues: [ldifRecord objectForKey: @"mozillahomestate"]
atIndex: 4 forKey: @""];
[element setValues: [ldifRecord objectForKey: @"mozillahomepostalcode"]
atIndex: 5 forKey: @""];
[element setValues: [ldifRecord objectForKey: @"mozillahomecountryname"]
atIndex: 6 forKey: @""];
element = [self elementWithTag: @"adr" ofType: @"work"];
[element setSingleValue: [ldifRecord objectForKey: @"mozillaworkstreet2"]
atIndex: 1 forKey: @""];
[element setSingleValue: [ldifRecord objectForKey: @"street"]
atIndex: 2 forKey: @""];
[element setSingleValue: [ldifRecord objectForKey: @"l"]
atIndex: 3 forKey: @""];
[element setSingleValue: [ldifRecord objectForKey: @"st"]
atIndex: 4 forKey: @""];
[element setSingleValue: [ldifRecord objectForKey: @"postalcode"]
atIndex: 5 forKey: @""];
[element setSingleValue: [ldifRecord objectForKey: @"c"]
atIndex: 6 forKey: @""];
[element setValues: [ldifRecord objectForKey: @"mozillaworkstreet2"]
atIndex: 1 forKey: @""];
[element setValues: [ldifRecord objectForKey: @"street"]
atIndex: 2 forKey: @""];
[element setValues: [ldifRecord objectForKey: @"l"]
atIndex: 3 forKey: @""];
[element setValues: [ldifRecord objectForKey: @"st"]
atIndex: 4 forKey: @""];
[element setValues: [ldifRecord objectForKey: @"postalcode"]
atIndex: 5 forKey: @""];
[element setValues: [ldifRecord objectForKey: @"c"]
atIndex: 6 forKey: @""];
ou = [ldifRecord objectForKey: @"ou"];
if ([ou isKindOfClass: [NSArray class]])
@ -321,13 +321,13 @@ convention:
[self _setPhoneValues: ldifRecord];
[self _setEmails: ldifRecord];
[[self elementWithTag: @"url" ofType: @"home"]
setSingleValue: [ldifRecord objectForKey: @"mozillahomeurl"] forKey: @""];
setValues: [ldifRecord objectForKey: @"mozillahomeurl"] forKey: @""];
[[self elementWithTag: @"url" ofType: @"work"]
setSingleValue: [ldifRecord objectForKey: @"mozillaworkurl"] forKey: @""];
setValues: [ldifRecord objectForKey: @"mozillaworkurl"] forKey: @""];
[[self uniqueChildWithTag: @"x-aim"]
setSingleValue: [ldifRecord objectForKey: @"nsaimid"]
forKey: @""];
setValues: [ldifRecord objectForKey: @"nsaimid"]
forKey: @""];
now = [NSCalendarDate date];
year = [[ldifRecord objectForKey: @"birthyear"] intValue];

View File

@ -1,6 +1,6 @@
/* SOGoContactLDIFEntry.h - this file is part of SOGo
*
* Copyright (C) 2006-2016 Inverse inc.
* Copyright (C) 2006-2017 Inverse inc.
*
* 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

View File

@ -1,6 +1,6 @@
/* SOGoContactLDIFEntry.m - this file is part of SOGo
*
* Copyright (C) 2006-2016 Inverse inc.
* Copyright (C) 2006-2017 Inverse inc.
*
* 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

View File

@ -1,8 +1,6 @@
/* NSDictionary+Utilities.h - this file is part of SOGo
*
* Copyright (C) 2007 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Copyright (C) 2007-2017 Inverse inc.
*
* 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

View File

@ -1,8 +1,6 @@
/* NSDictionary+Utilities.m - this file is part of SOGo
*
* Copyright (C) 2007-2011 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Copyright (C) 2007-2017 Inverse inc.
*
* 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

View File

@ -165,16 +165,17 @@
- (NSArray *) deliveryAddresses
{
NSMutableArray *addresses;
NSMutableDictionary *address;
NSArray *elements;
NSString *type, *postoffice, *street, *street2, *locality, *region, *postalcode, *country;
NSMutableDictionary *address;
NSMutableArray *addresses;
NSArray *elements;
CardElement *adr;
NSUInteger count, max;
elements = [card childrenWithTag: @"adr"];
//values = [org valuesForKey: @""];
max = [elements count];
if (max > 0)
{
addresses = [NSMutableArray arrayWithCapacity: max];
@ -189,7 +190,8 @@
region = [adr flattenedValueAtIndex: 4 forKey: @""];
postalcode = [adr flattenedValueAtIndex: 5 forKey: @""];
country = [adr flattenedValueAtIndex: 6 forKey: @""];
address = [NSMutableDictionary dictionaryWithObject: type forKey: @"type"];
address = [NSMutableDictionary dictionaryWithObject: type forKey: @"type"];
if (postoffice) [address setObject: postoffice forKey: @"postoffice"];
if (street2) [address setObject: street2 forKey: @"street2"];
if (street) [address setObject: street forKey: @"street"];