Skip to content

Commit

Permalink
Fix Sieve activation with vacation start date
Browse files Browse the repository at this point in the history
Fixes #3885
  • Loading branch information
cgx committed Nov 9, 2016
1 parent 839384f commit bc10e09
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -16,6 +16,7 @@ Bug fixes
- [web] disable submit button while saving an event or a task (#3880)
- [web] fixed computation of week number
- [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)
------------------
Expand Down
8 changes: 6 additions & 2 deletions SoObjects/SOGo/SOGoSieveManager.m
@@ -1,6 +1,6 @@
/* 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>
*
Expand All @@ -20,6 +20,7 @@
* Boston, MA 02111-1307, USA.
*/

#import <Foundation/NSCalendarDate.h>
#import <Foundation/NSURL.h>
#import <Foundation/NSValue.h>

Expand Down Expand Up @@ -783,6 +784,7 @@ - (BOOL) updateFiltersForAccount: (SOGoMailAccount *) theAccount
NGSieveClient *client;
NSString *filterScript, *v;
BOOL b;
unsigned int now;

dd = [user domainDefaults];
if (!([dd sieveScriptsEnabled] || [dd vacationEnabled] || [dd forwardEnabled]))
Expand Down Expand Up @@ -830,8 +832,10 @@ - (BOOL) updateFiltersForAccount: (SOGoMailAccount *) theAccount
// We handle vacation messages.
// See http://ietfreport.isoc.org/idref/draft-ietf-sieve-vacation/
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;
NSArray *addresses;
Expand Down

0 comments on commit bc10e09

Please sign in to comment.