pull/60/merge
Ludovic Marcotte 2015-02-09 16:12:59 -05:00
parent 98e4c8ca55
commit 6c9b1a494f
5 changed files with 57 additions and 12 deletions

1
NEWS
View File

@ -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)

View File

@ -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];
}

View File

@ -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.";

View File

@ -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];

View File

@ -600,7 +600,7 @@
<var:string label:value="Add default email addresses" /></span></a>
</span>
</label><br/>
<label><var:string label:value="Days between responses :"/>
<var:popup list="daysBetweenResponsesList" item="item"
const:id="daysBetweenResponsesList"
@ -623,8 +623,14 @@
date="vacationEndDate"
const:dayStartHour="0"
const:dayEndHour="23"
/>
/><br/>
<label><input type="checkbox"
const:name="alwaysSend"
const:id="alwaysSend"
var:checked="alwaysSend" />
<var:string label:value="Always send vacation message response" /></label><br/>
</div>
</div>
</var:if