summaryrefslogtreecommitdiff
path: root/plugins/managesieve/lib
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-02-10 08:13:13 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-02-10 08:13:13 +0000
commit552607f5affe961d6c771f38a8eba32044f710b1 (patch)
treedcbfaaa2928edf8f188c46a9fbec8a632090fadf /plugins/managesieve/lib
parentb40c338186679c086d25ed5d43553d3216d7190a (diff)
- Added setflag/addflag/removeflag support (#1487449)
git-svn-id: https://svn.roundcube.net/trunk@4522 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'plugins/managesieve/lib')
-rw-r--r--plugins/managesieve/lib/rcube_sieve.php27
1 files changed, 26 insertions, 1 deletions
diff --git a/plugins/managesieve/lib/rcube_sieve.php b/plugins/managesieve/lib/rcube_sieve.php
index 1ed0da9ab..be9c75496 100644
--- a/plugins/managesieve/lib/rcube_sieve.php
+++ b/plugins/managesieve/lib/rcube_sieve.php
@@ -406,7 +406,9 @@ class rcube_sieve_script
'vacation', // RFC5230
'relational', // RFC3431
'regex', // draft-ietf-sieve-regex-01
- // TODO: (most wanted first) body, imapflags, notify
+ 'imapflags',
+ 'imap4flags', // RFC5232
+ // TODO: (most wanted first) body, notify
);
/**
@@ -569,6 +571,7 @@ class rcube_sieve_script
// action(s)
foreach ($rule['actions'] as $action) {
switch ($action['type']) {
+
case 'fileinto':
array_push($exts, 'fileinto');
$script .= "\tfileinto ";
@@ -578,6 +581,7 @@ class rcube_sieve_script
}
$script .= self::escape_string($action['target']) . ";\n";
break;
+
case 'redirect':
$script .= "\tredirect ";
if ($action['copy']) {
@@ -586,17 +590,29 @@ class rcube_sieve_script
}
$script .= self::escape_string($action['target']) . ";\n";
break;
+
case 'reject':
case 'ereject':
array_push($exts, $action['type']);
$script .= "\t".$action['type']." "
. self::escape_string($action['target']) . ";\n";
break;
+
+ case 'addflag':
+ case 'setflag':
+ case 'removeflag':
+ $imapflags = strtolower($action['mode']) == 'imap4flags' ? 'imap4flags' : 'imapflags';
+ array_push($exts, $imapflags);
+ $script .= "\t".$action['type']." "
+ . self::escape_string($action['target']) . ";\n";
+ break;
+
case 'keep':
case 'discard':
case 'stop':
$script .= "\t" . $action['type'] .";\n";
break;
+
case 'vacation':
array_push($exts, 'vacation');
$script .= "\tvacation";
@@ -879,6 +895,15 @@ class rcube_sieve_script
$result[] = $vacation;
break;
+
+ case 'setflag':
+ case 'addflag':
+ case 'removeflag':
+ $result[] = array('type' => $token,
+ // Flags list: last token (skip optional variable)
+ 'target' => $tokens[count($tokens)-1]
+ );
+ break;
}
}