From a15f06c844457bdcc28ddab83d59ddc940518d93 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 11 Jan 2011 17:18:11 +0000 Subject: [PATCH] Monotone-Parent: cb5cc3133ac0a2327dd3cc8408ecc03e59d08d44 Monotone-Revision: 9466acabd40c4707e1c9468170d5b231345d8cf9 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-01-11T17:18:11 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 +++ OpenChange/SOGoContactGCSEntry+MAPIStore.m | 38 ++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8dd1fefdf..9785e22de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-01-11 Wolfgang Sourdeau + + * OpenChange/SOGoContactGCSEntry+MAPIStore.m + (-setMAPIProperties:): added support for work address. + 2011-01-10 Wolfgang Sourdeau * OpenChange/MAPIStoreContext.m (-typeLessTag:): removed method as diff --git a/OpenChange/SOGoContactGCSEntry+MAPIStore.m b/OpenChange/SOGoContactGCSEntry+MAPIStore.m index 9a3b78ff6..ebd6fe59d 100644 --- a/OpenChange/SOGoContactGCSEntry+MAPIStore.m +++ b/OpenChange/SOGoContactGCSEntry+MAPIStore.m @@ -20,6 +20,7 @@ * Boston, MA 02111-1307, USA. */ +#import #import #import #import @@ -38,6 +39,8 @@ - (void) setMAPIProperties: (NSDictionary *) properties { NGVCard *newCard, *oldCard; + NSArray *addresses; + CardElement *adr; id value; [self logWithFormat: @"setMAPIProperties: %@", properties]; @@ -66,6 +69,41 @@ if (value) [newCard addEmail: value types: nil]; + /* Work address */ + addresses = [newCard childrenWithTag: @"adr" + andAttribute: @"type" + havingValue: @"work"]; + if ([addresses count] > 0) + { + adr = [addresses objectAtIndex: 0]; + [adr setValues: nil]; + } + else + { + adr = [CardElement elementWithTag: @"adr"]; + [adr addAttribute: @"type" value: @"work"]; + [card addChild: adr]; + } + + value = [properties objectForKey: MAPIPropertyKey (PidLidWorkAddressPostOfficeBox)]; + if (value) + [adr setValue: 0 to: value]; + value = [properties objectForKey: MAPIPropertyKey (PidLidWorkAddressStreet)]; + if (value) + [adr setValue: 2 to: value]; + value = [properties objectForKey: MAPIPropertyKey (PidLidWorkAddressCity)]; + if (value) + [adr setValue: 3 to: value]; + value = [properties objectForKey: MAPIPropertyKey (PidLidWorkAddressState)]; + if (value) + [adr setValue: 4 to: value]; + value = [properties objectForKey: MAPIPropertyKey (PidLidWorkAddressPostalCode)]; + if (value) + [adr setValue: 5 to: value]; + value = [properties objectForKey: MAPIPropertyKey (PidLidWorkAddressCountry)]; + if (value) + [adr setValue: 6 to: value]; + ASSIGN (content, [newCard versitString]); }