diff --git a/Documentation/SOGo Installation Guide.odt b/Documentation/SOGo Installation Guide.odt index 33c02be5b..d648c53b9 100644 Binary files a/Documentation/SOGo Installation Guide.odt and b/Documentation/SOGo Installation Guide.odt differ diff --git a/SoObjects/SOGo/LDAPSource.h b/SoObjects/SOGo/LDAPSource.h index 6842dd220..13b37f876 100644 --- a/SoObjects/SOGo/LDAPSource.h +++ b/SoObjects/SOGo/LDAPSource.h @@ -62,8 +62,11 @@ NSString *IDField; // the first part of a user DN NSString *CNField; NSString *UIDField; - NSArray *mailFields, *searchFields; - NSString *IMAPHostField, *IMAPLoginField; + NSArray *mailFields; + NSArray *searchFields; + NSString *IMAPHostField; + NSString *IMAPLoginField; + NSString *SieveHostField; NSArray *bindFields; BOOL listRequiresDot; @@ -110,6 +113,7 @@ searchFields: (NSArray *) newSearchFields IMAPHostField: (NSString *) newIMAPHostField IMAPLoginField: (NSString *) newIMAPLoginField + SieveHostField: (NSString *) newSieveHostField bindFields: (id) newBindFields kindField: (NSString *) newKindField andMultipleBookingsField: (NSString *) newMultipleBookingsField; diff --git a/SoObjects/SOGo/LDAPSource.m b/SoObjects/SOGo/LDAPSource.m index 96a98ef83..8948e5f9e 100644 --- a/SoObjects/SOGo/LDAPSource.m +++ b/SoObjects/SOGo/LDAPSource.m @@ -107,6 +107,7 @@ static Class NSStringK; [searchFields retain]; IMAPHostField = nil; IMAPLoginField = nil; + SieveHostField = nil; bindFields = nil; _scope = @"sub"; _filter = nil; @@ -149,6 +150,7 @@ static Class NSStringK; [searchFields release]; [IMAPHostField release]; [IMAPLoginField release]; + [SieveHostField release]; [bindFields release]; [_filter release]; [_userPasswordAlgorithm release]; @@ -194,6 +196,7 @@ static Class NSStringK; searchFields: [udSource objectForKey: @"SearchFieldNames"] IMAPHostField: [udSource objectForKey: @"IMAPHostFieldName"] IMAPLoginField: [udSource objectForKey: @"IMAPLoginFieldName"] + SieveHostField: [udSource objectForKey: @"SieveHostFieldName"] bindFields: [udSource objectForKey: @"bindFields"] kindField: [udSource objectForKey: @"KindFieldName"] andMultipleBookingsField: [udSource objectForKey: @"MultipleBookingsFieldName"]]; @@ -311,6 +314,7 @@ static Class NSStringK; searchFields: (NSArray *) newSearchFields IMAPHostField: (NSString *) newIMAPHostField IMAPLoginField: (NSString *) newIMAPLoginField + SieveHostField: (NSString *) newSieveHostField bindFields: (id) newBindFields kindField: (NSString *) newKindField andMultipleBookingsField: (NSString *) newMultipleBookingsField @@ -326,6 +330,8 @@ andMultipleBookingsField: (NSString *) newMultipleBookingsField ASSIGN(IMAPHostField, [newIMAPHostField lowercaseString]); if (newIMAPLoginField) ASSIGN(IMAPLoginField, [newIMAPLoginField lowercaseString]); + if (newSieveHostField) + ASSIGN(SieveHostField, [newSieveHostField lowercaseString]); if (newMailFields) ASSIGN(mailFields, newMailFields); if (newSearchFields) @@ -848,6 +854,13 @@ andMultipleBookingsField: (NSString *) newMultipleBookingsField if ([ldapValue length] > 0) [ldifRecord setObject: ldapValue forKey: @"c_imaplogin"]; } + + if (SieveHostField) + { + ldapValue = [[ldapEntry attributeWithName: SieveHostField] stringValueAtIndex: 0]; + if ([ldapValue length] > 0) + [ldifRecord setObject: ldapValue forKey: @"c_sievehostname"]; + } } - (void) _fillConstraints: (NGLdapEntry *) ldapEntry @@ -1609,6 +1622,7 @@ _makeLDAPChanges (NGLdapConnection *ldapConnection, searchFields: nil IMAPHostField: nil IMAPLoginField: nil + SieveHostField: nil bindFields: nil kindField: nil andMultipleBookingsField: nil]; diff --git a/SoObjects/SOGo/SOGoSieveManager.m b/SoObjects/SOGo/SOGoSieveManager.m index c050911a5..aab2b3291 100644 --- a/SoObjects/SOGo/SOGoSieveManager.m +++ b/SoObjects/SOGo/SOGoSieveManager.m @@ -736,7 +736,12 @@ static NSString *sieveScriptName = @"sogo"; // // Values such as "localhost" or "localhost:2000" are NOT supported. // - sieveServer = [dd sieveServer]; + // We first try to get the user's preferred Sieve server + sieveServer = [[[user mailAccounts] objectAtIndex: 0] objectForKey: @"sieveServerName"]; + + if (!sieveServer) + sieveServer = [dd sieveServer]; + sievePort = 2000; url = nil; diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index 6a6f7b7b3..9102653a8 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -577,7 +577,7 @@ - (void) _appendSystemMailAccount { NSString *fullName, *replyTo, *imapLogin, *imapServer, *signature, - *encryption, *scheme, *action, *query, *customEmail; + *encryption, *scheme, *action, *query, *customEmail, *sieveServer; NSMutableDictionary *mailAccount, *identity, *mailboxes, *receipts; NSNumber *port; NSMutableArray *identities; @@ -637,6 +637,15 @@ [mailAccount setObject: port forKey: @"port"]; [mailAccount setObject: encryption forKey: @"encryption"]; + // Sieve server + sieveServer = [self _fetchFieldForUser: @"c_sievehostname"]; + + if (sieveServer) + { + [mailAccount setObject: sieveServer forKey: @"sieveServerName"]; + } + + /* identities */ identities = [NSMutableArray new]; mails = [self allEmails]; diff --git a/SoObjects/SOGo/SQLSource.h b/SoObjects/SOGo/SQLSource.h index eeac526cf..00bf48dda 100644 --- a/SoObjects/SOGo/SQLSource.h +++ b/SoObjects/SOGo/SQLSource.h @@ -43,6 +43,7 @@ NSArray *_mailFields; NSString *_imapLoginField; NSString *_imapHostField; + NSString *_sieveHostField; NSString *_userPasswordAlgorithm; NSURL *_viewURL; BOOL _prependPasswordScheme; diff --git a/SoObjects/SOGo/SQLSource.m b/SoObjects/SOGo/SQLSource.m index d3ceecacf..c2db99f7d 100644 --- a/SoObjects/SOGo/SQLSource.m +++ b/SoObjects/SOGo/SQLSource.m @@ -98,6 +98,7 @@ _kindField = nil; _multipleBookingsField = nil; _imapHostField = nil; + _sieveHostField = nil; } return self; @@ -115,6 +116,7 @@ [_multipleBookingsField release]; [_domainField release]; [_imapHostField release]; + [_sieveHostField release]; [super dealloc]; } @@ -131,6 +133,7 @@ ASSIGN(_userPasswordAlgorithm, [udSource objectForKey: @"userPasswordAlgorithm"]); ASSIGN(_imapLoginField, [udSource objectForKey: @"IMAPLoginFieldName"]); ASSIGN(_imapHostField, [udSource objectForKey: @"IMAPHostFieldName"]); + ASSIGN(_sieveHostField, [udSource objectForKey: @"SieveHostFieldName"]); ASSIGN(_kindField, [udSource objectForKey: @"KindFieldName"]); ASSIGN(_multipleBookingsField, [udSource objectForKey: @"MultipleBookingsFieldName"]); ASSIGN(_domainField, [udSource objectForKey: @"DomainFieldName"]); @@ -524,6 +527,13 @@ [response setObject: value forKey: @"c_imaphostname"]; } + if (_sieveHostField) + { + value = [response objectForKey: _sieveHostField]; + if ([value isNotNull]) + [response setObject: value forKey: @"c_sievehostname"]; + } + // We check if the user can authenticate if (_authenticationFilter) {