MFB: Fix unconditional debug output with Net_Sieve earlier than 1.2.0 (Bug #8794).
authorJan Schneider <jan@horde.org>
Mon, 21 Dec 2009 18:53:22 +0000 (19:53 +0100)
committerJan Schneider <jan@horde.org>
Tue, 22 Dec 2009 01:46:13 +0000 (02:46 +0100)
ingo/config/backends.php.dist
ingo/docs/CHANGES
ingo/lib/Driver/Timsieved.php

index 1f4b745..5b2702c 100644 (file)
@@ -207,6 +207,10 @@ $backends['sieve'] = array(
         // an admin user if you want to use shared rules.
         // 'username' => 'cyrus',
         // 'password' => '*****',
+        // Enable debugging. With Net_Sieve 1.2.0 or later, the sieve protocol
+        // communication is logged with the DEBUG level. Earlier versions
+        // print the log to the screen.
+        'debug' => false,
     ),
     'script' => 'sieve',
     'scriptparams' => array(
index 4894051..bc207e7 100644 (file)
@@ -10,6 +10,8 @@ v2.0-git
 v1.2.4-cvs
 ----------
 
+[jan] Fix unconditional debug output with Net_Sieve earlier than 1.2.0
+      (Bug #8794).
 [jan] Add Sieve configuration to use UTF-8 encoded folder names (for Dovecot).
 
 
index 816c376..d4b8fb1 100644 (file)
@@ -41,14 +41,12 @@ class Ingo_Driver_Timsieved extends Ingo_Driver
     }
 
     /**
-     * Connect to the sieve server.
-     *
-     * @return mixed  True on success, PEAR_Error on false.
+     * Connects to the sieve server.
      */
-    public function _connect()
+    protected function _connect()
     {
         if (!empty($this->_sieve)) {
-            return true;
+            return;
         }
 
         if (empty($this->_params['admin'])) {
@@ -70,9 +68,10 @@ class Ingo_Driver_Timsieved extends Ingo_Driver
         if (is_a($res, 'PEAR_Error')) {
             unset($this->_sieve);
             return $res;
-        } else {
+        }
+
+        if (!empty($this->_params['debug'])) {
             $this->_sieve->setDebug(true, array($this, '_debug'));
-            return true;
         }
     }
 
@@ -82,7 +81,7 @@ class Ingo_Driver_Timsieved extends Ingo_Driver
      * @param Net_Sieve $sieve  A Net_Sieve object.
      * @param string $message   The tracked Sieve communication.
      */
-    function _debug($sieve, $message)
+    protected function _debug($sieve, $message)
     {
         Horde::logMessage($message, __FILE__, __LINE__, PEAR_LOG_DEBUG);
     }