diff options
author | Andy Wermke <andy@dev.next-step-software.com> | 2013-04-04 16:10:23 +0200 |
---|---|---|
committer | Andy Wermke <andy@dev.next-step-software.com> | 2013-04-04 16:10:23 +0200 |
commit | 92cd7f34b07e86062f2c024039e3309768b48ce6 (patch) | |
tree | 63b9f39280ebcab80742d9f2b4db6a139c1791e1 /plugins/managesieve/lib | |
parent | 029d18f13bcf01aa2f1f08dbdfc6400c081bf7cb (diff) | |
parent | 443b92a7ee19e321b350750240e0fc54ec5be357 (diff) |
Merge branch 'master' of https://github.com/roundcube/roundcubemail
Diffstat (limited to 'plugins/managesieve/lib')
-rw-r--r-- | plugins/managesieve/lib/Roundcube/rcube_sieve.php | 6 | ||||
-rw-r--r-- | plugins/managesieve/lib/Roundcube/rcube_sieve_script.php | 41 |
2 files changed, 24 insertions, 23 deletions
diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve.php b/plugins/managesieve/lib/Roundcube/rcube_sieve.php index 16c584b7d..a04e3c2a4 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve.php @@ -84,7 +84,7 @@ class rcube_sieve return $this->_set_error(SIEVE_ERROR_LOGIN); } - $this->exts = $this->get_extensions(); + $this->exts = $this->get_extensions(); // disable features by config if (!empty($disabled)) { @@ -325,7 +325,7 @@ class rcube_sieve continue 2; } } - if (empty($script->content[$idx+1]) || $script->content[$idx+1]['type'] != 'if') { + if (!empty($script->content[$idx+1]) && $script->content[$idx+1]['type'] != 'if') { $script->content[$idx]['actions'][] = array('type' => 'stop'); } } @@ -379,6 +379,6 @@ class rcube_sieve */ public function debug_handler(&$sieve, $message) { - write_log('sieve', preg_replace('/\r\n$/', '', $message)); + rcube::write_log('sieve', preg_replace('/\r\n$/', '', $message)); } } diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php index 36eb1bcf8..80f590f4b 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php @@ -33,6 +33,7 @@ class rcube_sieve_script 'ereject', // RFC5429 'copy', // RFC3894 'vacation', // RFC5230 + 'vacation-seconds', // RFC6131 'relational', // RFC3431 'regex', // draft-ietf-sieve-regex-01 'imapflags', // draft-melnikov-sieve-imapflags-06 @@ -447,8 +448,13 @@ class rcube_sieve_script case 'vacation': array_push($exts, 'vacation'); $action_script .= 'vacation'; - if (!empty($action['days'])) - $action_script .= " :days " . $action['days']; + if (isset($action['seconds'])) { + array_push($exts, 'vacation-seconds'); + $action_script .= " :seconds " . intval($action['seconds']); + } + else if (!empty($action['days'])) { + $action_script .= " :days " . intval($action['days']); + } if (!empty($action['addresses'])) $action_script .= " :addresses " . self::escape_string($action['addresses']); if (!empty($action['subject'])) @@ -477,8 +483,15 @@ class rcube_sieve_script } // requires - if (!empty($exts)) - $output = 'require ["' . implode('","', array_unique($exts)) . "\"];\n" . $output; + if (!empty($exts)) { + $exts = array_unique($exts); + + if (in_array('vacation-seconds', $exts) && ($key = array_search('vacation', $exts)) !== false) { + unset($exts[$key]); + } + + $output = 'require ["' . implode('","', $exts) . "\"];\n" . $output; + } if (!empty($this->prefix)) { $output = $this->prefix . "\n\n" . $output; @@ -816,24 +829,12 @@ class rcube_sieve_script for ($i=0, $len=count($tokens); $i<$len; $i++) { $tok = strtolower($tokens[$i]); - if ($tok == ':days') { - $vacation['days'] = $tokens[++$i]; - } - else if ($tok == ':subject') { - $vacation['subject'] = $tokens[++$i]; - } - else if ($tok == ':addresses') { - $vacation['addresses'] = $tokens[++$i]; - } - else if ($tok == ':handle') { - $vacation['handle'] = $tokens[++$i]; - } - else if ($tok == ':from') { - $vacation['from'] = $tokens[++$i]; - } - else if ($tok == ':mime') { + if ($tok == ':mime') { $vacation['mime'] = true; } + else if ($tok[0] == ':') { + $vacation[substr($tok, 1)] = $tokens[++$i]; + } } $result[] = $vacation; |