From a78f91f5dcae04f6844021675639b4f2a561b8b6 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 9 Apr 2019 08:57:48 +0200 Subject: [PATCH] Small code de-duplication --- .../managesieve/lib/Roundcube/rcube_sieve.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve.php b/plugins/managesieve/lib/Roundcube/rcube_sieve.php index fb610e8da..38f06afd0 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve.php @@ -363,21 +363,17 @@ class rcube_sieve */ public function load($name) { - if (!$this->sieve) { - return $this->_set_error(self::ERROR_INTERNAL); - } - - if ($this->current == $name) { + if ($this->current === $name) { return true; } - $script = $this->sieve->getScript($name); + $script = $this->get_script($name); - if (is_a($script, 'PEAR_Error')) { - return $this->_set_error(self::ERROR_OTHER); + if ($script === false) { + return false; } - // try to parse from Roundcube format + // try to parse to Roundcube format $this->script = $this->_parse($script); $this->current = $name; @@ -394,7 +390,7 @@ class rcube_sieve return $this->_set_error(self::ERROR_INTERNAL); } - // try to parse from Roundcube format + // try to parse to Roundcube format $this->script = $this->_parse($script); }