From 2457678e563d01f9f306711761f214bc8d653fec Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Mon, 21 Dec 2009 19:53:22 +0100 Subject: [PATCH] MFB: Fix unconditional debug output with Net_Sieve earlier than 1.2.0 (Bug #8794). --- ingo/config/backends.php.dist | 4 ++++ ingo/docs/CHANGES | 2 ++ ingo/lib/Driver/Timsieved.php | 15 +++++++-------- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ingo/config/backends.php.dist b/ingo/config/backends.php.dist index 1f4b7457a..5b2702c97 100644 --- a/ingo/config/backends.php.dist +++ b/ingo/config/backends.php.dist @@ -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( diff --git a/ingo/docs/CHANGES b/ingo/docs/CHANGES index 48940517b..bc207e7fd 100644 --- a/ingo/docs/CHANGES +++ b/ingo/docs/CHANGES @@ -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). diff --git a/ingo/lib/Driver/Timsieved.php b/ingo/lib/Driver/Timsieved.php index 816c3761e..d4b8fb163 100644 --- a/ingo/lib/Driver/Timsieved.php +++ b/ingo/lib/Driver/Timsieved.php @@ -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); } -- 2.11.0