diff --git a/NEWS b/NEWS
index 1fc92edbf..a3492a07f 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@
Enhancements
- added support for email categories using EAS (#2995)
+ - now possible to always send vacation messages (#2332)
Bug fixes
- (regression) fixed sending a message when mail module is not active (#3088)
diff --git a/SoObjects/SOGo/SOGoSieveManager.m b/SoObjects/SOGo/SOGoSieveManager.m
index 2f949ad20..f2f5a7b41 100644
--- a/SoObjects/SOGo/SOGoSieveManager.m
+++ b/SoObjects/SOGo/SOGoSieveManager.m
@@ -835,13 +835,16 @@ static NSString *sieveScriptName = @"sogo";
if (values && [[values objectForKey: @"enabled"] boolValue])
{
+ NSMutableString *vacation_script;
NSArray *addresses;
NSString *text;
- BOOL ignore;
+
+ BOOL ignore, alwaysSend;
int days, i;
-
+
days = [[values objectForKey: @"daysBetweenResponse"] intValue];
addresses = [values objectForKey: @"autoReplyEmailAddresses"];
+ alwaysSend = [[values objectForKey: @"alwaysSend"] boolValue];
ignore = [[values objectForKey: @"ignoreLists"] boolValue];
text = [values objectForKey: @"autoReplyText"];
b = YES;
@@ -849,28 +852,38 @@ static NSString *sieveScriptName = @"sogo";
if (days == 0)
days = 7;
+ vacation_script = [NSMutableString string];
+
[req addObjectUniquely: @"vacation"];
// Skip mailing lists
if (ignore)
- [script appendString: @"if allof ( not exists [\"list-help\", \"list-unsubscribe\", \"list-subscribe\", \"list-owner\", \"list-post\", \"list-archive\", \"list-id\", \"Mailing-List\"], not header :comparator \"i;ascii-casemap\" :is \"Precedence\" [\"list\", \"bulk\", \"junk\"], not header :comparator \"i;ascii-casemap\" :matches \"To\" \"Multiple recipients of*\" ) {"];
+ [vacation_script appendString: @"if allof ( not exists [\"list-help\", \"list-unsubscribe\", \"list-subscribe\", \"list-owner\", \"list-post\", \"list-archive\", \"list-id\", \"Mailing-List\"], not header :comparator \"i;ascii-casemap\" :is \"Precedence\" [\"list\", \"bulk\", \"junk\"], not header :comparator \"i;ascii-casemap\" :matches \"To\" \"Multiple recipients of*\" ) {"];
- [script appendFormat: @"vacation :days %d :addresses [", days];
+ [vacation_script appendFormat: @"vacation :days %d :addresses [", days];
for (i = 0; i < [addresses count]; i++)
{
- [script appendFormat: @"\"%@\"", [addresses objectAtIndex: i]];
+ [vacation_script appendFormat: @"\"%@\"", [addresses objectAtIndex: i]];
if (i == [addresses count]-1)
- [script appendString: @"] "];
+ [vacation_script appendString: @"] "];
else
- [script appendString: @", "];
+ [vacation_script appendString: @", "];
}
- [script appendFormat: @"text:\r\n%@\r\n.\r\n;\r\n", text];
+ [vacation_script appendFormat: @"text:\r\n%@\r\n.\r\n;\r\n", text];
if (ignore)
- [script appendString: @"}\r\n"];
+ [vacation_script appendString: @"}\r\n"];
+
+ //
+ // See http://sogo.nu/bugs/view.php?id=2332 for details
+ //
+ if (alwaysSend)
+ [script insertString: vacation_script atIndex: 0];
+ else
+ [script appendString: vacation_script];
}
diff --git a/UI/PreferencesUI/English.lproj/Localizable.strings b/UI/PreferencesUI/English.lproj/Localizable.strings
index 538bd3d9b..e318a2f5b 100644
--- a/UI/PreferencesUI/English.lproj/Localizable.strings
+++ b/UI/PreferencesUI/English.lproj/Localizable.strings
@@ -29,6 +29,7 @@
"Days between responses :" = "Days between responses:";
"Do not send responses to mailing lists" = "Do not send responses to mailing lists";
"Disable auto reply on" = "Disable auto reply on";
+"Always send vacation message response" = "Always send vacation message response";
"Please specify your message and your email addresses for which you want to enable auto reply."
= "Please specify your message and your email addresses for which you want to enable auto reply.";
"Your vacation message must not end with a single dot on a line." = "Your vacation message must not end with a single dot on a line.";
diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m
index a43a8e744..49d5ab350 100644
--- a/UI/PreferencesUI/UIxPreferences.m
+++ b/UI/PreferencesUI/UIxPreferences.m
@@ -1127,6 +1127,30 @@ static NSArray *reminderValues = nil;
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];
diff --git a/UI/Templates/PreferencesUI/UIxPreferences.wox b/UI/Templates/PreferencesUI/UIxPreferences.wox
index a89c8a204..efafdabef 100644
--- a/UI/Templates/PreferencesUI/UIxPreferences.wox
+++ b/UI/Templates/PreferencesUI/UIxPreferences.wox
@@ -600,7 +600,7 @@
-
+