Monotone-Parent: 9e637be5876312fbc5e2a34d306cd7d8b73773d1

Monotone-Revision: e11d0b2861cf3888ff5f2fa58e01243c5de99a1d

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2009-10-08T22:34:52
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2009-10-08 22:34:52 +00:00
parent 8621f4ced6
commit 768e3cf224
3 changed files with 65 additions and 38 deletions

View File

@ -1,3 +1,16 @@
2009-10-08 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/LDAPSource.m (-_searchAttributes): we already
have knowledge of the LDAPContactInfoAttribute so we no longer
need to fetch it from the user defaults.
* SoObjects/Contacts/SOGoContactLDIFEntry.m
(-initWithName:withLDIFEntry:inContainer:): we no longer retain
"container" in order to avoid a leak.
(-vCard): we now use the "VCARD" profile, all in upper case. We
first resolve the full name using "c_cn", which is the special key
used by the LDAP sources to access the fullname attribute.
2009-10-08 Francis Lachapelle <flachapelle@inverse.ca>
* UI/PreferencesUI/UIxPreferences.m (-shortDateFormatsList): added
@ -10,7 +23,7 @@
-userLongDateFormat, -setUserLongDateFormat): new "default" option
support, like for the short date format.
(- timeFormatsList, -itemTimeFormatText, -setUserTimeFormat): new
"default" option support, like for the short date format.
"default" option support, like for the short date format.
2009-10-08 Wolfgang Sourdeau <wsourdeau@inverse.ca>

View File

@ -32,8 +32,22 @@
#import "SOGoContactGCSEntry.h"
#import "SOGoContactLDIFEntry.h"
static NSString *sogoContactInfoAttribute = nil;
@implementation SOGoContactLDIFEntry
+ (void) initialize
{
NSUserDefaults *ud;
if (!sogoContactInfoAttribute)
{
ud = [NSUserDefaults standardUserDefaults];
ASSIGN (sogoContactInfoAttribute,
[ud stringForKey: @"SOGoLDAPContactInfoAttribute"]);
}
}
+ (SOGoContactLDIFEntry *) contactEntryWithName: (NSString *) newName
withLDIFEntry: (NSDictionary *) newEntry
inContainer: (id) newContainer
@ -54,7 +68,6 @@
{
self = [self init];
ASSIGN (name, newName);
ASSIGN (container, newContainer);
ASSIGN (ldifEntry, newEntry);
vcard = nil;
@ -122,35 +135,36 @@
vcard = [[NGVCard alloc] initWithUid: [self nameInContainer]];
[vcard setVClass: @"PUBLIC"];
[vcard setProdID: @"-//Inverse inc./SOGo 1.0//EN"];
[vcard setProfile: @"vCard"];
info = [ldifEntry objectForKey: @"displayname"];
if (!(info && [info length] > 0))
info = [ldifEntry objectForKey: @"cn"];
[vcard setProfile: @"VCARD"];
info = [ldifEntry objectForKey: @"c_cn"];
if (![info length])
{
info = [ldifEntry objectForKey: @"displayname"];
if (![info length])
info = [ldifEntry objectForKey: @"cn"];
}
[vcard setFn: info];
surname = [ldifEntry objectForKey: @"sn"];
if (!surname)
surname = [ldifEntry objectForKey: @"surname"];
[vcard setNWithFamily: surname
given: [ldifEntry objectForKey: @"givenname"]
additional: nil
prefixes: nil
suffixes: nil];
given: [ldifEntry objectForKey: @"givenname"]
additional: nil
prefixes: nil
suffixes: nil];
info = [ldifEntry objectForKey: @"title"];
if (info)
[vcard setTitle: info];
info = [ldifEntry objectForKey: @"mozillanickname"];
if (info)
[vcard setNickname: info];
// If SOGoLDAPContactInfoAttribute is defined, we set it
// as the NOTE value in order for Thunderbird (or any other
// CardDAV client) to display it.
key = [[NSUserDefaults standardUserDefaults]
stringForKey: @"SOGoLDAPContactInfoAttribute"];
if (!key)
/* If SOGoLDAPContactInfoAttribute is defined, we set as the NOTE value
in order for Thunderbird (or any other CardDAV client) to display it. */
if (sogoContactInfoAttribute)
key = sogoContactInfoAttribute;
else
key = @"description";
info = [ldifEntry objectForKey: key];
if (info)
[vcard setNote: info];
@ -162,22 +176,27 @@
[self _setPhonesOfVCard: vcard];
streetAddress = [ldifEntry objectForKey: @"street"];
if (!streetAddress) streetAddress = [ldifEntry objectForKey: @"streetaddress"];
if (!streetAddress)
streetAddress = [ldifEntry objectForKey: @"streetaddress"];
location = [ldifEntry objectForKey: @"l"];
if (!location) location = [ldifEntry objectForKey: @"locality"];
if (!location)
location = [ldifEntry objectForKey: @"locality"];
region = [ldifEntry objectForKey: @"st"];
if (!region) region = [ldifEntry objectForKey: @"region"];
if (!region)
region = [ldifEntry objectForKey: @"region"];
postalCode = [ldifEntry objectForKey: @"postalcode"];
if (!postalCode) postalCode = [ldifEntry objectForKey: @"zip"];
if (!postalCode)
postalCode = [ldifEntry objectForKey: @"zip"];
country = [ldifEntry objectForKey: @"c"];
if (!country) country = [ldifEntry objectForKey: @"countryname"];
if (!country)
country = [ldifEntry objectForKey: @"countryname"];
element = [CardElement elementWithTag: @"adr"
attributes: nil values: nil];
attributes: nil values: nil];
[element setValue: 0 ofAttribute: @"type" to: @"work"];
if (streetAddress)
@ -199,7 +218,8 @@
attributes: nil values: nil];
org = [ldifEntry objectForKey: @"o"];
orgunit = [ldifEntry objectForKey: @"ou"];
if (!orgunit) orgunit = [ldifEntry objectForKey: @"orgunit"];
if (!orgunit)
orgunit = [ldifEntry objectForKey: @"orgunit"];
if (org)
[element setValue: 0 to: org];

View File

@ -130,7 +130,8 @@ static NSLock *lock;
@"locality",
@"birthyear",
@"serialnumber",
@"calfburl", @"proxyaddresses",
@"calfburl",
@"proxyaddresses",
nil];
[commonSearchFields retain];
@ -497,10 +498,6 @@ static NSLock *lock;
{
if (!searchAttributes)
{
NSUserDefaults *ud;
NSString *attribute;
ud = [NSUserDefaults standardUserDefaults];
searchAttributes = [NSMutableArray new];
[searchAttributes addObject: @"objectClass"];
if (CNField)
@ -512,17 +509,14 @@ static NSLock *lock;
[searchAttributes addObjectsFromArray: commonSearchFields];
// Add SOGoLDAPContactInfoAttribute from user defaults
attribute = [ud stringForKey: @"SOGoLDAPContactInfoAttribute"];
if ([attribute length] > 0 &&
![searchAttributes containsObject: attribute])
[searchAttributes addObject: attribute];
if ([LDAPContactInfoAttribute length])
[searchAttributes addObjectUniquely: LDAPContactInfoAttribute];
// Add IMAP hostname from user defaults
if (IMAPHostField && [IMAPHostField length] > 0 &&
![searchAttributes containsObject: IMAPHostField])
[searchAttributes addObject: IMAPHostField];
if ([IMAPHostField length])
[searchAttributes addObjectUniquely: IMAPHostField];
}
return searchAttributes;
}