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]); }