summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/managesieve/Changelog2
-rw-r--r--plugins/managesieve/lib/rcube_sieve.php16
2 files changed, 9 insertions, 9 deletions
diff --git a/plugins/managesieve/Changelog b/plugins/managesieve/Changelog
index 8bbb12a90..7eb9f64dd 100644
--- a/plugins/managesieve/Changelog
+++ b/plugins/managesieve/Changelog
@@ -1,3 +1,5 @@
+- Moved elsif replacement code to handle only imports from other formats
+
* version 4.1 [2011-03-07]
-----------------------------------------------------------
- Fix fileinto target is always INBOX (#1487776)
diff --git a/plugins/managesieve/lib/rcube_sieve.php b/plugins/managesieve/lib/rcube_sieve.php
index d701095f2..932522d22 100644
--- a/plugins/managesieve/lib/rcube_sieve.php
+++ b/plugins/managesieve/lib/rcube_sieve.php
@@ -291,18 +291,16 @@ class rcube_sieve
if (empty($script->content)) {
$script = $this->_import_rules($txt);
$script = new rcube_sieve_script($script, $this->disabled, $this->exts);
- }
- // replace all elsif with if+stop, we support only ifs
- foreach ($script->content as $idx => $rule) {
- if (!isset($script->content[$idx+1])
- || preg_match('/^else|elsif$/', $script->content[$idx+1]['type'])) {
+ // replace all elsif with if+stop, we support only ifs
+ foreach ($script->content as $idx => $rule) {
// 'stop' not found?
- if (!preg_match('/^(stop|vacation)$/', $rule['actions'][count($rule['actions'])-1]['type'])) {
- $script->content[$idx]['actions'][] = array(
- 'type' => 'stop'
- );
+ foreach ($rule['actions'] as $action) {
+ if (preg_match('/^(stop|vacation)$/', $action['type'])) {
+ continue 2;
+ }
}
+ $script->content[$idx]['actions'][] = array('type' => 'stop');
}
}