diff --git a/Documentation/SOGoInstallationGuide.asciidoc b/Documentation/SOGoInstallationGuide.asciidoc index 34f27c630..a09ab36b2 100644 --- a/Documentation/SOGoInstallationGuide.asciidoc +++ b/Documentation/SOGoInstallationGuide.asciidoc @@ -2071,13 +2071,17 @@ Requires Sieve script support on the IMAP host. Defaults to `NO` when unset. -When enabling this parameter, one may have to also enable the associated +|D |SOGoVacationPeriodEnabled +|When enabling this parameter, one may have to also enable the associated cronjob in `/etc/cron.d/sogo` in order to activate automatic vacation -message activation and expiration. +message activation and expiration if your Sieve server does not support +the date extension. See the _Cronjob — Vacation messages activation and expiration_ section below for details. +Defaults to `YES` when unset. + |D |SOGoVacationDefaultSubject |Parameter used to define a default vacation subject if user don't specify a custom subject. diff --git a/SoObjects/SOGo/SOGoDomainDefaults.h b/SoObjects/SOGo/SOGoDomainDefaults.h index 371954726..a56c71c5c 100644 --- a/SoObjects/SOGo/SOGoDomainDefaults.h +++ b/SoObjects/SOGo/SOGoDomainDefaults.h @@ -52,6 +52,7 @@ - (int) forwardConstraints; - (NSArray *) forwardConstraintsDomains; - (BOOL) vacationEnabled; +- (BOOL) vacationPeriodEnabled; - (NSString *) vacationDefaultSubject; - (NSString *) vacationHeaderTemplateFile; - (NSString *) vacationFooterTemplateFile; diff --git a/SoObjects/SOGo/SOGoDomainDefaults.m b/SoObjects/SOGo/SOGoDomainDefaults.m index 39fd58888..df710083e 100644 --- a/SoObjects/SOGo/SOGoDomainDefaults.m +++ b/SoObjects/SOGo/SOGoDomainDefaults.m @@ -220,6 +220,18 @@ return [self boolForKey: @"SOGoVacationEnabled"]; } +- (BOOL) vacationPeriodEnabled +{ + id o; + + o = [self stringForKey: @"SOGoVacationPeriodEnabled"]; + + if (o) + return [o boolValue]; + + return YES; +} + - (NSString *) vacationDefaultSubject { return [self stringForKey: @"SOGoVacationDefaultSubject"]; diff --git a/SoObjects/SOGo/SOGoSieveManager.m b/SoObjects/SOGo/SOGoSieveManager.m index d7de49c20..ee8d81a0b 100644 --- a/SoObjects/SOGo/SOGoSieveManager.m +++ b/SoObjects/SOGo/SOGoSieveManager.m @@ -927,7 +927,9 @@ static NSString *sieveScriptName = @"sogo"; } // Start date of auto-reply - if ([[values objectForKey: @"startDateEnabled"] boolValue] && dateCapability) + if ([dd vacationPeriodEnabled] && + [[values objectForKey: @"startDateEnabled"] boolValue] && + dateCapability) { [req addObjectUniquely: @"date"]; [req addObjectUniquely: @"relational"]; @@ -938,7 +940,9 @@ static NSString *sieveScriptName = @"sogo"; } // End date of auto-reply - if ([[values objectForKey: @"endDateEnabled"] boolValue] && dateCapability) + if ([dd vacationPeriodEnabled] && + [[values objectForKey: @"endDateEnabled"] boolValue] && + dateCapability) { [req addObjectUniquely: @"date"]; [req addObjectUniquely: @"relational"]; diff --git a/Tools/SOGoToolUpdateAutoReply.m b/Tools/SOGoToolUpdateAutoReply.m index 2a0b2f707..b37786b1e 100644 --- a/Tools/SOGoToolUpdateAutoReply.m +++ b/Tools/SOGoToolUpdateAutoReply.m @@ -83,6 +83,7 @@ BOOL result; user = [SOGoUser userWithLogin: theLogin]; + userDefaults = [user userDefaults]; vacationOptions = [[userDefaults vacationOptions] mutableCopy]; [vacationOptions autorelease]; @@ -93,6 +94,14 @@ } else { + // We do NOT enable the vacation message automatically if the domain + // preference is disabled by default. + if (![[user domainDefaults] vacationPeriodEnabled]) + { + NSLog(@"SOGoVacationPeriodEnabled set to NO for the domain - ignoring."); + return NO; + } + [vacationOptions setObject: [NSNumber numberWithBool: NO] forKey: @"startDateEnabled"]; } diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index 6a79469a3..f5a9cc5f6 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -1108,6 +1108,11 @@ static NSArray *reminderValues = nil; return [[user domainDefaults] vacationEnabled]; } +- (BOOL) isVacationPeriodEnabled +{ + return [[user domainDefaults] vacationPeriodEnabled]; +} + - (NSString *) vacationHeader { NSString *path; @@ -1142,54 +1147,6 @@ static NSArray *reminderValues = nil; return text; } -// - (void) setSieveFiltersValue: (NSString *) newValue -// { -// sieveFilters = [newValue objectFromJSONString]; -// if (sieveFilters) -// { -// if ([sieveFilters isKindOfClass: [NSArray class]]) -// [sieveFilters retain]; -// else -// sieveFilters = nil; -// } -// } - -// - (NSString *) sieveFiltersValue -// { -// return [sieveFilters jsonRepresentation]; -// } - -// - (void) setEnableVacation: (BOOL) enableVacation -// { -// [vacationOptions setObject: [NSNumber numberWithBool: enableVacation] -// forKey: @"enabled"]; -// } - -// - (BOOL) enableVacation -// { -// return [[vacationOptions objectForKey: @"enabled"] boolValue]; -// } - -// - (void) setAutoReplyText: (NSString *) theText -// { -// [vacationOptions setObject: theText forKey: @"autoReplyText"]; -// } - -// - (NSString *) autoReplyText -// { -// return [vacationOptions objectForKey: @"autoReplyText"]; -// } - -// - (void) setAutoReplyEmailAddresses: (NSString *) theAddresses -// { -// NSArray *addresses; - -// addresses = [[theAddresses componentsSeparatedByString: @","] -// trimmedComponents]; -// [vacationOptions setObject: addresses -// forKey: @"autoReplyEmailAddresses"]; -// } - // // Used internally // @@ -1334,105 +1291,6 @@ static NSArray *reminderValues = nil; return daysBetweenResponses; } -// - (void) setDaysBetweenResponses: (NSNumber *) theDays -// { -// [vacationOptions setObject: theDays -// forKey: @"daysBetweenResponse"]; -// } - -// - (NSString *) daysBetweenResponses -// { -// NSString *days; - -// days = [vacationOptions objectForKey: @"daysBetweenResponse"]; -// if (!days) -// days = @"7"; // defaults to 7 days - -// return days; -// } - -// - (void) setIgnoreLists: (BOOL) ignoreLists -// { -// [vacationOptions setObject: [NSNumber numberWithBool: ignoreLists] -// forKey: @"ignoreLists"]; -// } - -// - (BOOL) ignoreLists -// { -// NSNumber *obj; -// BOOL ignore; - -// obj = [vacationOptions objectForKey: @"ignoreLists"]; - -// if (obj == nil) -// ignore = YES; // defaults to YES -// else -// ignore = [obj boolValue]; - -// return ignore; -// } - -// -// See http://sogo.nu/bugs/view.php?id=2332 for details -// -// - (void) setAlwaysSend: (BOOL) ignoreLists -// { -// [vacationOptions setObject: [NSNumber numberWithBool: ignoreLists] -// forKey: @"alwaysSend"]; -// } - -// - (BOOL) alwaysSend -// { -// NSNumber *obj; -// BOOL ignore; - -// obj = [vacationOptions objectForKey: @"alwaysSend"]; - -// if (obj == nil) -// ignore = NO; // defaults to NO -// else -// ignore = [obj boolValue]; - -// return ignore; -// } - -// - (BOOL) enableVacationEndDate -// { -// return [[vacationOptions objectForKey: @"endDateEnabled"] boolValue]; -// } - -// - (BOOL) disableVacationEndDate -// { -// return ![self enableVacationEndDate]; -// } - -// - (void) setEnableVacationEndDate: (BOOL) enableVacationEndDate -// { -// [vacationOptions setObject: [NSNumber numberWithBool: enableVacationEndDate] -// forKey: @"endDateEnabled"]; -// } - -// - (void) setVacationEndDate: (NSCalendarDate *) endDate -// { -// NSNumber *time; - -// time = [NSNumber numberWithInt: [endDate timeIntervalSince1970]]; - -// [vacationOptions setObject: time forKey: @"endDate"]; -// } - -// - (NSCalendarDate *) vacationEndDate -// { -// int time; - -// time = [[vacationOptions objectForKey: @"endDate"] intValue]; - -// if (time > 0) -// return [NSCalendarDate dateWithTimeIntervalSince1970: time]; -// else -// return [NSCalendarDate calendarDate]; -// } - /* mail forward */ // @@ -1443,49 +1301,6 @@ static NSArray *reminderValues = nil; return [[user domainDefaults] forwardEnabled]; } -// - (void) setEnableForward: (BOOL) enableForward -// { -// [forwardOptions setObject: [NSNumber numberWithBool: enableForward] -// forKey: @"enabled"]; -// } - -// - (BOOL) enableForward -// { -// return [[forwardOptions objectForKey: @"enabled"] boolValue]; -// } - -// - (void) setForwardAddress: (NSString *) forwardAddress -// { -// NSArray *addresses; - -// addresses = [[forwardAddress componentsSeparatedByString: @","] -// trimmedComponents]; -// [forwardOptions setObject: addresses -// forKey: @"forwardAddress"]; -// } - -// - (NSString *) forwardAddress -// { -// id addresses; - -// addresses = [forwardOptions objectForKey: @"forwardAddress"]; - -// return ([addresses respondsToSelector: @selector(componentsJoinedByString:)] -// ? [(NSArray *)addresses componentsJoinedByString: @", "] -// : (NSString *)addresses); -// } - -// - (void) setForwardKeepCopy: (BOOL) keepCopy -// { -// [forwardOptions setObject: [NSNumber numberWithBool: keepCopy] -// forKey: @"keepCopy"]; -// } - -// - (BOOL) forwardKeepCopy -// { -// return [[forwardOptions objectForKey: @"keepCopy"] boolValue]; -// } - - (NSString *) forwardConstraints { SOGoDomainDefaults *dd; @@ -1617,52 +1432,6 @@ static NSArray *reminderValues = nil; : NO); } -// - (id ) defaultAction -// { -// id results; -// SOGoDomainDefaults *dd; -// SOGoMailAccount *account; -// SOGoMailAccounts *folder; -// WORequest *request; - -// request = [context request]; -// if ([[request method] isEqualToString: @"POST"]) -// { -// dd = [[context activeUser] domainDefaults]; -// if ([dd sieveScriptsEnabled]) -// [userDefaults setSieveFilters: sieveFilters]; -// if ([dd vacationEnabled]) -// [userDefaults setVacationOptions: vacationOptions]; -// if ([dd forwardEnabled]) -// [userDefaults setForwardOptions: forwardOptions]; - -// if (!([dd sieveScriptsEnabled] || [dd vacationEnabled] || [dd forwardEnabled]) || [self _isSieveServerAvailable]) -// { -// [userDefaults synchronize]; -// folder = [[self clientObject] mailAccountsFolder: @"Mail" -// inContext: context]; -// account = [folder lookupName: @"0" inContext: context acquire: NO]; - -// if ([account updateFilters]) -// // If Sieve is not enabled, the SOGoSieveManager will immediatly return a positive answer -// // See [SOGoSieveManager updateFiltersForAccount:withUsername:andPassword:] -// results = (id )[self responseWithStatus: 200 -// andJSONRepresentation: [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:hasChanged], @"hasChanged", nil]]; - -// else -// results = (id )[self responseWithStatus: 502 -// andJSONRepresentation: [NSDictionary dictionaryWithObjectsAndKeys: @"Connection error", @"textStatus", nil]]; -// } -// else -// results = (id )[self responseWithStatus: 503 -// andJSONRepresentation: [NSDictionary dictionaryWithObjectsAndKeys: @"Service temporarily unavailable", @"textStatus", nil]]; -// } -// else -// results = self; - -// return results; -// } - - (BOOL) shouldTakeValuesFromRequest: (WORequest *) request inContext: (WOContext*) context { diff --git a/UI/Templates/PreferencesUI/UIxPreferences.wox b/UI/Templates/PreferencesUI/UIxPreferences.wox index 88c110c8d..ef4923b6b 100644 --- a/UI/Templates/PreferencesUI/UIxPreferences.wox +++ b/UI/Templates/PreferencesUI/UIxPreferences.wox @@ -974,47 +974,49 @@ -
- - - - - - - -
+ +
+ + + + + + + +
-
- - - - - - - -
+
+ + + + + + + +
+