Fix Sieve activation with vacation start date

Fixes #3885
pull/225/head
Francis Lachapelle 2016-11-09 16:25:16 -05:00
parent 839384f77e
commit bc10e0983a
2 changed files with 7 additions and 2 deletions

1
NEWS
View File

@ -16,6 +16,7 @@ Bug fixes
- [web] disable submit button while saving an event or a task (#3880) - [web] disable submit button while saving an event or a task (#3880)
- [web] fixed computation of week number - [web] fixed computation of week number
- [web] fixed and improved IMAP folder subscriptions manager (#3865) - [web] fixed and improved IMAP folder subscriptions manager (#3865)
- [web] fixed Sieve script activation when vacation start date is in the future (#3885)
3.2.1 (2016-11-02) 3.2.1 (2016-11-02)
------------------ ------------------

View File

@ -1,6 +1,6 @@
/* SOGoSieveManager.m - this file is part of SOGo /* SOGoSieveManager.m - this file is part of SOGo
* *
* Copyright (C) 2010-2015 Inverse inc. * Copyright (C) 2010-2016 Inverse inc.
* *
* Author: Inverse <info@inverse.ca> * Author: Inverse <info@inverse.ca>
* *
@ -20,6 +20,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#import <Foundation/NSCalendarDate.h>
#import <Foundation/NSURL.h> #import <Foundation/NSURL.h>
#import <Foundation/NSValue.h> #import <Foundation/NSValue.h>
@ -783,6 +784,7 @@ static NSString *sieveScriptName = @"sogo";
NGSieveClient *client; NGSieveClient *client;
NSString *filterScript, *v; NSString *filterScript, *v;
BOOL b; BOOL b;
unsigned int now;
dd = [user domainDefaults]; dd = [user domainDefaults];
if (!([dd sieveScriptsEnabled] || [dd vacationEnabled] || [dd forwardEnabled])) if (!([dd sieveScriptsEnabled] || [dd vacationEnabled] || [dd forwardEnabled]))
@ -830,8 +832,10 @@ static NSString *sieveScriptName = @"sogo";
// We handle vacation messages. // We handle vacation messages.
// See http://ietfreport.isoc.org/idref/draft-ietf-sieve-vacation/ // See http://ietfreport.isoc.org/idref/draft-ietf-sieve-vacation/
values = [ud vacationOptions]; values = [ud vacationOptions];
now = [[NSCalendarDate calendarDate] timeIntervalSince1970];
if (values && [[values objectForKey: @"enabled"] boolValue]) if (values && [[values objectForKey: @"enabled"] boolValue] &&
(![values objectForKey: @"startDateEnabled"] || [[values objectForKey: @"startDate"] intValue] < now))
{ {
NSMutableString *vacation_script; NSMutableString *vacation_script;
NSArray *addresses; NSArray *addresses;