See ChangeLog

Monotone-Parent: 968254dd9df1cf87e5269ec6f7f31e31acc794bc
Monotone-Revision: 6423f19a5a08e1fed0683fb1ab86ffb6e2519da7

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2009-05-12T19:56:39
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Francis Lachapelle 2009-05-12 19:56:39 +00:00
parent ab786b6889
commit 188fda54d4
7 changed files with 61 additions and 14 deletions

View File

@ -1,3 +1,21 @@
2009-05-12 Francis Lachapelle <flachapelle@inverse.ca>
* SoObjects/SOGo/LDAPSource.m ([LDAPSource -initFromSource:]):
retrieves the user default attribute "IMAPHostFieldName" so the
IMAP server name can be fetched from the LDAP directory.
([LDAPSource -_fillEmailsOfEntry:intoContactEntry:]): if a IMAP
hostname field is specified for the source, retrieve the LDAP
attribute and set the value to the key "c_imaphostname".
* SoObjects/Mailer/SOGoMailAccount.m (SOGoMailAccount
-_urlHostString]): the IMAP server name is now retrieved from the
SOGoUser object and no longer hardcoded to the fallbackIMAP4Server
user default.
* SoObjects/SOGo/LDAPUserManager.m ([LDAPUserManager
-_fillContactInfosForUser:withUIDorEmail:]): now fills the user
attributes dictionary with the IMAP hostname if specified and defined.
2009-05-06 Francis Lachapelle <flachapelle@inverse.ca> 2009-05-06 Francis Lachapelle <flachapelle@inverse.ca>
* SoObjects/SOGo/SOGoGCSFolder.m ([SOGoGCSFolder * SoObjects/SOGo/SOGoGCSFolder.m ([SOGoGCSFolder

2
NEWS
View File

@ -7,6 +7,8 @@
- improvements to the underlying SOGo cache infrastructure - improvements to the underlying SOGo cache infrastructure
- fixed bug with LDAP-based address books and the entries references (ID vs UID) - fixed bug with LDAP-based address books and the entries references (ID vs UID)
- added "scope" parameter to LDAP sources - added "scope" parameter to LDAP sources
- added groups support in attendees in ACLs
- added support for user-based IMAP hostname
1.0-20090407 (1.0.1) 1.0-20090407 (1.0.1)
-------------------- --------------------

View File

@ -271,7 +271,7 @@ static NSString *fallbackIMAP4Server = nil;
escUsername escUsername
= [[username stringByEscapingURL] stringByReplacingString: @"@" = [[username stringByEscapingURL] stringByReplacingString: @"@"
withString: @"%40"]; withString: @"%40"];
#if 0 #if 1
// see comment about fallbackIMAP4Server above // see comment about fallbackIMAP4Server above
hostString = [NSString stringWithFormat: @"%@@%@", escUsername, hostString = [NSString stringWithFormat: @"%@@%@", escUsername,
[mailAccount objectForKey: @"serverName"]]; [mailAccount objectForKey: @"serverName"]];

View File

@ -46,6 +46,7 @@
NSString *CNField; NSString *CNField;
NSString *UIDField; NSString *UIDField;
NSArray *mailFields; NSArray *mailFields;
NSString *IMAPHostField;
NSString *bindFields; NSString *bindFields;
NSDictionary *modulesConstraints; NSDictionary *modulesConstraints;
@ -69,6 +70,7 @@
CNField: (NSString *) newCNField CNField: (NSString *) newCNField
UIDField: (NSString *) newUIDField UIDField: (NSString *) newUIDField
mailFields: (NSArray *) newMailFields mailFields: (NSArray *) newMailFields
IMAPHostField: (NSString *) newIMAPHostField
andBindFields: (NSString *) newBindFields; andBindFields: (NSString *) newBindFields;
- (BOOL) checkLogin: (NSString *) login - (BOOL) checkLogin: (NSString *) login

View File

@ -166,6 +166,7 @@ static NSLock *lock;
UIDField = @"uid"; UIDField = @"uid";
mailFields = [NSArray arrayWithObject: @"mail"]; mailFields = [NSArray arrayWithObject: @"mail"];
[mailFields retain]; [mailFields retain];
IMAPHostField = nil;
bindFields = nil; bindFields = nil;
_scope = @"sub"; _scope = @"sub";
_filter = nil; _filter = nil;
@ -188,6 +189,7 @@ static NSLock *lock;
[CNField release]; [CNField release];
[UIDField release]; [UIDField release];
[mailFields release]; [mailFields release];
[IMAPHostField release];
[bindFields release]; [bindFields release];
[_filter release]; [_filter release];
[ldapConnection release]; [ldapConnection release];
@ -213,6 +215,7 @@ static NSLock *lock;
CNField: [udSource objectForKey: @"CNFieldName"] CNField: [udSource objectForKey: @"CNFieldName"]
UIDField: [udSource objectForKey: @"UIDFieldName"] UIDField: [udSource objectForKey: @"UIDFieldName"]
mailFields: [udSource objectForKey: @"MailFieldNames"] mailFields: [udSource objectForKey: @"MailFieldNames"]
IMAPHostField: [udSource objectForKey: @"IMAPHostFieldName"]
andBindFields: [udSource objectForKey: @"bindFields"]]; andBindFields: [udSource objectForKey: @"bindFields"]];
ASSIGN(modulesConstraints, [udSource objectForKey: @"ModulesConstraints"]); ASSIGN(modulesConstraints, [udSource objectForKey: @"ModulesConstraints"]);
ASSIGN(_filter, [udSource objectForKey: @"filter"]); ASSIGN(_filter, [udSource objectForKey: @"filter"]);
@ -242,6 +245,7 @@ static NSLock *lock;
CNField: (NSString *) newCNField CNField: (NSString *) newCNField
UIDField: (NSString *) newUIDField UIDField: (NSString *) newUIDField
mailFields: (NSArray *) newMailFields mailFields: (NSArray *) newMailFields
IMAPHostField: (NSString *) newIMAPHostField
andBindFields: (NSString *) newBindFields andBindFields: (NSString *) newBindFields
{ {
ASSIGN (baseDN, newBaseDN); ASSIGN (baseDN, newBaseDN);
@ -251,6 +255,8 @@ static NSLock *lock;
ASSIGN (CNField, newCNField); ASSIGN (CNField, newCNField);
if (newUIDField) if (newUIDField)
ASSIGN (UIDField, newUIDField); ASSIGN (UIDField, newUIDField);
if (newIMAPHostField)
ASSIGN (IMAPHostField, newIMAPHostField);
if (newMailFields) if (newMailFields)
ASSIGN (mailFields, newMailFields); ASSIGN (mailFields, newMailFields);
if (newBindFields) if (newBindFields)
@ -495,7 +501,7 @@ static NSLock *lock;
if (!searchAttributes) if (!searchAttributes)
{ {
NSUserDefaults *ud; NSUserDefaults *ud;
NSString *contactInfo; NSString *attribute;
ud = [NSUserDefaults standardUserDefaults]; ud = [NSUserDefaults standardUserDefaults];
searchAttributes = [NSMutableArray new]; searchAttributes = [NSMutableArray new];
@ -508,12 +514,17 @@ static NSLock *lock;
[searchAttributes addObjectsFromArray: commonSearchFields]; [searchAttributes addObjectsFromArray: commonSearchFields];
// Add SOGoLDAPContactInfoAttribute from user defaults // Add SOGoLDAPContactInfoAttribute from user defaults
contactInfo = [ud stringForKey: @"SOGoLDAPContactInfoAttribute"]; attribute = [ud stringForKey: @"SOGoLDAPContactInfoAttribute"];
if ([contactInfo length] > 0 && if ([attribute length] > 0 &&
![searchAttributes containsObject: contactInfo]) ![searchAttributes containsObject: attribute])
[searchAttributes addObject: contactInfo]; [searchAttributes addObject: attribute];
}
// Add IMAP hostname from user defaults
if (IMAPHostField && [IMAPHostField length] > 0 &&
![searchAttributes containsObject: IMAPHostField])
[searchAttributes addObject: IMAPHostField];
}
return searchAttributes; return searchAttributes;
} }
@ -577,7 +588,7 @@ static NSLock *lock;
intoContactEntry: (NSMutableDictionary *) contactEntry intoContactEntry: (NSMutableDictionary *) contactEntry
{ {
NSEnumerator *emailFields; NSEnumerator *emailFields;
NSString *currentFieldName; NSString *currentFieldName, *ldapValue;
NSMutableArray *emails; NSMutableArray *emails;
NSArray *allValues; NSArray *allValues;
@ -591,6 +602,13 @@ static NSLock *lock;
} }
[contactEntry setObject: emails forKey: @"c_emails"]; [contactEntry setObject: emails forKey: @"c_emails"];
[emails release]; [emails release];
if (IMAPHostField)
{
ldapValue = [[ldapEntry attributeWithName: IMAPHostField] stringValueAtIndex: 0];
if ([ldapValue length] > 0)
[contactEntry setObject: ldapValue forKey: @"c_imaphostname"];
}
} }
- (void) _fillConstraints: (NGLdapEntry *) ldapEntry - (void) _fillConstraints: (NGLdapEntry *) ldapEntry

View File

@ -342,13 +342,14 @@ static NSLock *lock = nil;
NSDictionary *userEntry; NSDictionary *userEntry;
NSEnumerator *ldapSources; NSEnumerator *ldapSources;
LDAPSource *currentSource; LDAPSource *currentSource;
NSString *sourceID, *cn, *c_uid; NSString *sourceID, *cn, *c_uid, *c_imaphostname;
NSArray *c_emails; NSArray *c_emails;
BOOL access; BOOL access;
emails = [NSMutableArray array]; emails = [NSMutableArray array];
cn = nil; cn = nil;
c_uid = nil; c_uid = nil;
c_imaphostname = nil;
[currentUser setObject: [NSNumber numberWithBool: YES] [currentUser setObject: [NSNumber numberWithBool: YES]
forKey: @"CalendarAccess"]; forKey: @"CalendarAccess"];
@ -369,6 +370,8 @@ static NSLock *lock = nil;
c_emails = [userEntry objectForKey: @"c_emails"]; c_emails = [userEntry objectForKey: @"c_emails"];
if ([c_emails count]) if ([c_emails count])
[emails addObjectsFromArray: c_emails]; [emails addObjectsFromArray: c_emails];
if (!c_imaphostname)
c_imaphostname = [userEntry objectForKey: @"c_imaphostname"];
access = [[userEntry objectForKey: @"CalendarAccess"] boolValue]; access = [[userEntry objectForKey: @"CalendarAccess"] boolValue];
if (!access) if (!access)
[currentUser setObject: [NSNumber numberWithBool: NO] [currentUser setObject: [NSNumber numberWithBool: NO]
@ -377,7 +380,6 @@ static NSLock *lock = nil;
if (!access) if (!access)
[currentUser setObject: [NSNumber numberWithBool: NO] [currentUser setObject: [NSNumber numberWithBool: NO]
forKey: @"MailAccess"]; forKey: @"MailAccess"];
break;
} }
} }
@ -385,7 +387,9 @@ static NSLock *lock = nil;
cn = @""; cn = @"";
if (!c_uid) if (!c_uid)
c_uid = @""; c_uid = @"";
if (c_imaphostname)
[currentUser setObject: c_imaphostname forKey: @"c_imaphostname"];
[currentUser setObject: emails forKey: @"emails"]; [currentUser setObject: emails forKey: @"emails"];
[currentUser setObject: cn forKey: @"cn"]; [currentUser setObject: cn forKey: @"cn"];
[currentUser setObject: c_uid forKey: @"c_uid"]; [currentUser setObject: c_uid forKey: @"c_uid"];

View File

@ -742,16 +742,19 @@ _timeValue (NSString *key)
{ {
NSMutableDictionary *mailAccount, *identity; NSMutableDictionary *mailAccount, *identity;
NSMutableArray *identities, *mailAccounts; NSMutableArray *identities, *mailAccounts;
NSString *name, *fullName, *imapLogin; NSString *name, *fullName, *imapLogin, *imapServer;
NSArray *mails; NSArray *mails;
unsigned int count, max; unsigned int count, max;
imapLogin = [[LDAPUserManager sharedUserManager] getImapLoginForUID: login]; imapLogin = [[LDAPUserManager sharedUserManager] getImapLoginForUID: login];
imapServer = [self _fetchFieldForUser: @"c_imaphostname"];
if (!imapServer)
imapServer = fallbackIMAP4Server;
mailAccount = [NSMutableDictionary dictionary]; mailAccount = [NSMutableDictionary dictionary];
name = [NSString stringWithFormat: @"%@@%@", name = [NSString stringWithFormat: @"%@@%@",
imapLogin, fallbackIMAP4Server]; imapLogin, imapServer];
[mailAccount setObject: imapLogin forKey: @"userName"]; [mailAccount setObject: imapLogin forKey: @"userName"];
[mailAccount setObject: fallbackIMAP4Server forKey: @"serverName"]; [mailAccount setObject: imapServer forKey: @"serverName"];
[mailAccount setObject: name forKey: @"name"]; [mailAccount setObject: name forKey: @"name"];
identities = [NSMutableArray array]; identities = [NSMutableArray array];