Skip to content

Commit

Permalink
Merge pull request #267 from tfux/4929
Browse files Browse the repository at this point in the history
fix(eas): additional name fields (fixes #4929)
  • Loading branch information
extrafu committed Jan 20, 2020
2 parents 94af9bb + 3f94516 commit 0e5514e
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions ActiveSync/NGVCard+ActiveSync.m
Expand Up @@ -99,7 +99,16 @@ - (NSString *) activeSyncRepresentationInContext: (WOContext *) context

if ((o = [n flattenedValueAtIndex: 1 forKey: @""]))
[s appendFormat: @"<FirstName xmlns=\"Contacts:\">%@</FirstName>", [o activeSyncRepresentationInContext: context]];


if ((o = [n flattenedValueAtIndex: 2 forKey: @""]))
[s appendFormat: @"<MiddleName xmlns=\"Contacts:\">%@</MiddleName>", [o activeSyncRepresentationInContext: context]];

if ((o = [n flattenedValueAtIndex: 3 forKey: @""]))
[s appendFormat: @"<Title xmlns=\"Contacts:\">%@</Title>", [o activeSyncRepresentationInContext: context]];

if ((o = [n flattenedValueAtIndex: 4 forKey: @""]))
[s appendFormat: @"<Suffix xmlns=\"Contacts:\">%@</Suffix>", [o activeSyncRepresentationInContext: context]];

if ((o = [self workCompany]))
[s appendFormat: @"<CompanyName xmlns=\"Contacts:\">%@</CompanyName>", [o activeSyncRepresentationInContext: context]];

Expand Down Expand Up @@ -302,8 +311,10 @@ - (void) takeActiveSyncValues: (NSDictionary *) theValues
{
CardElement *element;
NSMutableArray *addressLines, *other_addresses;
id o;

id o, l, m, f, p, s;

l = m = f = p = s = nil;

// Contact's note
if ((o = [[theValues objectForKey: @"Body"] objectForKey: @"Data"]))
[self setNote: o];
Expand Down Expand Up @@ -529,10 +540,23 @@ - (void) takeActiveSyncValues: (NSDictionary *) theValues
if ((o = [theValues objectForKey: @"FileAs"]) || ![self _isGhosted: @"FileAs" inContext: context])
[self setFn: [theValues objectForKey: @"FileAs"]];

[self setNWithFamily: [theValues objectForKey: @"LastName"]
given: [theValues objectForKey: @"FirstName"]
additional: nil prefixes: nil suffixes: nil];

if ((o = [theValues objectForKey: @"LastName"]) || ![self _isGhosted: @"LastName" inContext: context])
l = o ? o : @"";

if ((o = [theValues objectForKey: @"FirstName"]) || ![self _isGhosted: @"FirstName" inContext: context])
f = o ? o : @"";

if ((o = [theValues objectForKey: @"MiddleName"]) || ![self _isGhosted: @"MiddleName" inContext: context])
m = o ? o : @"";

if ((o = [theValues objectForKey: @"Title"]) || ![self _isGhosted: @"Title" inContext: context])
p = o ? o : @"";

if ((o = [theValues objectForKey: @"Suffix"]) || ![self _isGhosted: @"Suffix" inContext: context])
s = o ? o : @"";

[self setNWithFamily: l given: f additional: m prefixes: p suffixes: s];

// IM information
if ((o = [theValues objectForKey: @"IMAddress"]) || ![self _isGhosted: @"IMAddress" inContext: context])
[[self uniqueChildWithTag: @"x-aim"]
Expand Down

0 comments on commit 0e5514e

Please sign in to comment.