Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Automatically activate first ruleset even when multi rulesets enabled

  • Loading branch information...
commit 3f281377b5944d1b82e3d809b45c62d89f6606d3 1 parent a977987
@JohnDoh authored
Showing with 13 additions and 6 deletions.
  1. +1 −0  CHANGELOG
  2. +12 −6 sieverules.php
View
1  CHANGELOG
@@ -1,6 +1,7 @@
Roundcube Webmail SieveRules
============================
+ * automatically activate first ruleset even when multi rulesets enabled
* add option to use "friendly" names in :from params
* rename default skin to classic (c40419bdfe)
* rcube_ui > rcube_utils (r6091)
View
18 sieverules.php
@@ -487,7 +487,8 @@ function gen_setup()
), true, false);
$this->sieve->save();
- if (!$rcmail->config->get('sieverules_multiplerules', false)) $this->sieve->set_active($this->current_ruleset);
+ if (!($rcmail->config->get('sieverules_multiplerules', false) && sizeof($this->sieve->list) > 1))
+ $this->sieve->set_active($this->current_ruleset);
if (isset($_GET['_framed']) || isset($_POST['_framed'])) {
$this->api->output->add_script("parent.". rcmail::JS_OBJECT_NAME .".goto_url('plugin.sieverules');");
@@ -1010,7 +1011,7 @@ function save()
if ($result === true)
$save = $this->sieve->save();
- if ($save === true && $result === true && !$rcmail->config->get('sieverules_multiplerules', false))
+ if ($save === true && $result === true && !($rcmail->config->get('sieverules_multiplerules', false) && sizeof($this->sieve->list) > 1))
$save = $this->sieve->set_active($this->current_ruleset);
if ($save === true && $result === true) {
@@ -1110,7 +1111,7 @@ function import($type = null, $ruleset = null, $redirect = true)
$this->sieve->script->add_text(file_get_contents($rcmail->config->get('sieverules_default_file')));
$save = $this->sieve->save();
- if ($save === true && !$rcmail->config->get('sieverules_multiplerules', false))
+ if ($save === true && !($rcmail->config->get('sieverules_multiplerules', false) && sizeof($this->sieve->list) > 1))
$save = $this->sieve->set_active($this->current_ruleset);
if ($save === true)
@@ -1150,7 +1151,8 @@ function import($type = null, $ruleset = null, $redirect = true)
}
$this->sieve->save();
- if (!$rcmail->config->get('sieverules_multiplerules', false)) $this->sieve->set_active($this->current_ruleset);
+ if (!($rcmail->config->get('sieverules_multiplerules', false) && sizeof($this->sieve->list) > 1))
+ $this->sieve->set_active($this->current_ruleset);
// update rule list
if ($this->sieve_error)
@@ -1161,7 +1163,8 @@ function import($type = null, $ruleset = null, $redirect = true)
}
elseif ($ruleset == '_none_') {
$this->sieve->save();
- if (!$rcmail->config->get('sieverules_multiplerules', false)) $this->sieve->set_active($this->current_ruleset);
+ if (!($rcmail->config->get('sieverules_multiplerules', false) && sizeof($this->sieve->list) > 1))
+ $this->sieve->set_active($this->current_ruleset);
}
elseif ($ruleset == '_copy_') {
$this->rename_ruleset(true);
@@ -1173,7 +1176,10 @@ function import($type = null, $ruleset = null, $redirect = true)
if ($import) {
$this->script = $this->sieve->script->as_array();
$this->sieve->save();
- if (!$rcmail->config->get('sieverules_multiplerules', false)) $this->sieve->set_active($this->current_ruleset);
+
+ if (!($rcmail->config->get('sieverules_multiplerules', false) && sizeof($this->sieve->list) > 1))
+ $this->sieve->set_active($this->current_ruleset);
+
$this->api->output->command('display_message', $this->gettext('filterimported'), 'confirmation');
}
else {
Please sign in to comment.
Something went wrong with that request. Please try again.