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>
* SoObjects/SOGo/SOGoGCSFolder.m ([SOGoGCSFolder

2
NEWS
View File

@ -7,6 +7,8 @@
- improvements to the underlying SOGo cache infrastructure
- fixed bug with LDAP-based address books and the entries references (ID vs UID)
- 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)
--------------------

View File

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

View File

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

View File

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

View File

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

View File

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