diff --git a/CHANGELOG b/CHANGELOG index a38ec3aff..799a69105 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -11,6 +11,7 @@ CHANGELOG Roundcube Webmail - Fix addressbook searching by gender (#5757) - Fix prevention from using % and * characters in folder name (#5762) - Enigma: Fix compatibility with assets_dir +- Managesieve: Skip redundant LISTSCRIPTS command RELEASE 1.3-rc -------------- diff --git a/plugins/managesieve/Changelog b/plugins/managesieve/Changelog index 397503cfc..daa817725 100644 --- a/plugins/managesieve/Changelog +++ b/plugins/managesieve/Changelog @@ -1,5 +1,8 @@ +* version 8.9 [2017-05-22] +----------------------------------------------------------- - Fix handling of scripts with nested rules (#5540) - Fix possible defect in handling \r\n in scripts (#5685) +- Performance: Skip redundant LISTSCRIPTS command * version 8.8 [2016-11-27] ----------------------------------------------------------- diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve.php b/plugins/managesieve/lib/Roundcube/rcube_sieve.php index 75f94af78..7457d0d65 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve.php @@ -27,11 +27,12 @@ class rcube_sieve private $sieve; // Net_Sieve object private $error = false; // error flag private $errorLines = array(); // array of line numbers within sieve script which raised an error - private $list = array(); // scripts list + private $list = array(); // scripts list + private $exts; // array of supported extensions + private $active; // active script name public $script; // rcube_sieve_script object public $current; // name of currently loaded script - private $exts; // array of supported extensions const ERROR_CONNECTION = 1; const ERROR_LOGIN = 2; @@ -215,6 +216,8 @@ class rcube_sieve return $this->_set_error(self::ERROR_ACTIVATE); } + $this->active = $name; + return true; } @@ -233,6 +236,8 @@ class rcube_sieve return $this->_set_error(self::ERROR_DEACTIVATE); } + $this->active = null; + return true; } @@ -256,6 +261,8 @@ class rcube_sieve if (is_a($result, 'PEAR_Error')) { return $this->_set_error(self::ERROR_DELETE); } + + $this->active = null; } $result = $this->sieve->removeScript($name); @@ -268,6 +275,8 @@ class rcube_sieve $this->current = null; } + $this->list = null; + return true; } @@ -311,13 +320,14 @@ class rcube_sieve if (!$this->sieve) return $this->_set_error(self::ERROR_INTERNAL); - $list = $this->sieve->listScripts(); + $list = $this->sieve->listScripts($active); if (is_a($list, 'PEAR_Error')) { return $this->_set_error(self::ERROR_OTHER); } - $this->list = $list; + $this->list = $list; + $this->active = $active; } return $this->list; @@ -328,10 +338,15 @@ class rcube_sieve */ public function get_active() { - if (!$this->sieve) + if ($this->active !== null) { + return $this->active; + } + + if (!$this->sieve) { return $this->_set_error(self::ERROR_INTERNAL); + } - return $this->sieve->getActive(); + return $this->active = $this->sieve->getActive(); } /**