From c994e0e7cd9f593eb21ff80c7c1ddbeaf2a1b12a Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 18 Nov 2011 09:44:48 -0500
Subject: [PATCH] - Applied fixes from trunk up to r5451

---
 plugins/managesieve/lib/rcube_sieve.php |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/plugins/managesieve/lib/rcube_sieve.php b/plugins/managesieve/lib/rcube_sieve.php
index 7b7ea6e..2ed2e54 100644
--- a/plugins/managesieve/lib/rcube_sieve.php
+++ b/plugins/managesieve/lib/rcube_sieve.php
@@ -44,7 +44,6 @@
 
     public $script;                 // rcube_sieve_script object
     public $current;                // name of currently loaded script
-    private $disabled;              // array of disabled extensions
     private $exts;                  // array of supported extensions
 
 
@@ -89,7 +88,17 @@
         }
 
         $this->exts     = $this->get_extensions();
-        $this->disabled = $disabled;
+
+        // disable features by config
+        if (!empty($disabled)) {
+            // we're working on lower-cased names
+            $disabled = array_map('strtolower', (array) $disabled);
+            foreach ($disabled as $ext) {
+                if (($idx = array_search($ext, $this->exts)) !== false) {
+                    unset($this->exts[$idx]);
+                }
+            }
+        }
     }
 
     public function __destruct() {
@@ -301,7 +310,7 @@
     private function _parse($txt)
     {
         // parse
-        $script = new rcube_sieve_script($txt, $this->disabled, $this->exts);
+        $script = new rcube_sieve_script($txt, $this->exts);
 
         // fix/convert to Roundcube format
         if (!empty($script->content)) {

--
Gitblit v1.9.1