From 9709e144bc170588ba783ec8ccd85a811bd6eed8 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Mon, 14 Aug 2006 20:29:14 +0000 Subject: [PATCH] Monotone-Parent: a8e6d3c082060d0b8f4e1c547734baf974d5ee7c Monotone-Revision: 5cf7ca16573b57f14380a1da5611560a68f5fd45 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-08-14T20:29:14 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 7 +++++++ SoObjects/Contacts/NGLdapEntry+Contact.h | 1 + SoObjects/Contacts/NGLdapEntry+Contact.m | 26 ++++++++++++++++++++---- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 85c0e71a7..00c96993d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-08-14 Wolfgang Sourdeau + + * SoObjects/Contacts/NGLdapEntry+Contact.m ([NGLdapEntry + -asDictionaryWithAttributeNames:withUID:andCName:cName]): add an + entry for "uid" with the field name representing the login name of + the user in the corresponding LDAP branch. + 2006-08-10 Wolfgang Sourdeau * SoObjects/Contacts/SOGoContactGCSFolder.m ([SOGoContactGCSFolder diff --git a/SoObjects/Contacts/NGLdapEntry+Contact.h b/SoObjects/Contacts/NGLdapEntry+Contact.h index 557911724..0551e6110 100644 --- a/SoObjects/Contacts/NGLdapEntry+Contact.h +++ b/SoObjects/Contacts/NGLdapEntry+Contact.h @@ -33,6 +33,7 @@ - (NSString *) singleAttributeWithName: (NSString *) key; - (NSDictionary *) asDictionaryWithAttributeNames: (NSArray *) attributes + withUID: (NSString *) uid andCName: (NSString *) cName; @end diff --git a/SoObjects/Contacts/NGLdapEntry+Contact.m b/SoObjects/Contacts/NGLdapEntry+Contact.m index 880f7b779..60aabf0cc 100644 --- a/SoObjects/Contacts/NGLdapEntry+Contact.m +++ b/SoObjects/Contacts/NGLdapEntry+Contact.m @@ -37,11 +37,12 @@ } - (NSDictionary *) asDictionaryWithAttributeNames: (NSArray *) attributeNames + withUID: (NSString *) uid andCName: (NSString *) cName { NSMutableDictionary *valuesDict; NSEnumerator *attrEnum; - NSString *attribute; + NSString *attribute, *value; if (!attributeNames) attributeNames = [self attributeNames]; @@ -56,9 +57,26 @@ forKey: attribute]; attribute = [attrEnum nextObject]; } - [valuesDict setObject: [[self attributeWithName: cName] - stringValueAtIndex: 0] - forKey: @"c_name"]; + if (cName) + { + value = [[self attributeWithName: cName] + stringValueAtIndex: 0]; + if (!value) + value = @""; + NSLog (@"value for '%@' = '%@'", cName, value); + [valuesDict setObject: value + forKey: @"c_name"]; + } + if (uid) + { + value = [[self attributeWithName: uid] + stringValueAtIndex: 0]; + if (!value) + value = @""; + NSLog (@"value for '%@' = '%@'", uid, value); + [valuesDict setObject: value + forKey: @"c_uid"]; + } return valuesDict; }