-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mail): always forward incoming messages, before all filters
This new "Always forward" checkbox allows the user to forward incoming messages before evaluating the other filters, if any. When unchecked, the "redirect" directive is executed after all filters; if a filter stops evaluating the remaining rules, the message won't be forwarded.
- Loading branch information
Showing
3 changed files
with
29 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
/* SOGoSieveManager.m - this file is part of SOGo | ||
* | ||
* Copyright (C) 2010-2019 Inverse inc. | ||
* | ||
* Author: Inverse <[email protected]> | ||
* Copyright (C) 2010-2022 Inverse inc. | ||
* | ||
* This file is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -1159,9 +1157,12 @@ - (NSException *) updateFiltersForAccount: (SOGoMailAccount *) theAccount | |
|
||
if (values && [[values objectForKey: @"enabled"] boolValue]) | ||
{ | ||
BOOL alwaysSend; | ||
NSString *redirect; | ||
id addresses; | ||
int i; | ||
|
||
alwaysSend = [[values objectForKey: @"alwaysSend"] boolValue]; | ||
b = YES; | ||
|
||
addresses = [values objectForKey: @"forwardAddress"]; | ||
|
@@ -1172,11 +1173,22 @@ - (NSException *) updateFiltersForAccount: (SOGoMailAccount *) theAccount | |
{ | ||
v = [addresses objectAtIndex: i]; | ||
if (v && [v length] > 0) | ||
[script appendFormat: @"redirect \"%@\";\r\n", v]; | ||
{ | ||
redirect = [NSString stringWithFormat: @"redirect \"%@\";\r\n", v]; | ||
if (alwaysSend) | ||
[script insertString: redirect atIndex: 0]; | ||
else | ||
[script appendString: redirect]; | ||
} | ||
} | ||
|
||
if ([[values objectForKey: @"keepCopy"] boolValue]) | ||
[script appendString: @"keep;\r\n"]; | ||
{ | ||
if (alwaysSend) | ||
[script insertString: @"keep;\r\n" atIndex: 0]; | ||
else | ||
[script appendString: @"keep;\r\n"]; | ||
} | ||
} | ||
|
||
// We handle header/footer Sieve scripts | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters