From 2cd215590c0adc601109d419db746377dc1f1954 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Sun, 5 Jul 2009 15:05:59 -0600 Subject: [PATCH] Logging & error reporting tweaks --- framework/Imap_Client/lib/Horde/Imap/Client/Exception.php | 4 ++-- framework/Imap_Client/lib/Horde/Imap/Client/Socket.php | 4 ++-- framework/Imap_Client/lib/Horde/Imap/Client/Socket/Pop3.php | 9 +++++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/framework/Imap_Client/lib/Horde/Imap/Client/Exception.php b/framework/Imap_Client/lib/Horde/Imap/Client/Exception.php index f77bc8d97..5765870a1 100644 --- a/framework/Imap_Client/lib/Horde/Imap/Client/Exception.php +++ b/framework/Imap_Client/lib/Horde/Imap/Client/Exception.php @@ -26,8 +26,8 @@ class Horde_Imap_Client_Exception extends Exception // There was an unrecoverable error in UTF7IMAP -> UTF8 conversion. const UTF7IMAP_CONVERSION = 3; - // The IMAP server ended the connection. - const IMAP_DISCONNECT = 4; + // The server ended the connection. + const DISCONNECT = 4; // The charset used in the search query is not supported on the server. const BADCHARSET = 5; diff --git a/framework/Imap_Client/lib/Horde/Imap/Client/Socket.php b/framework/Imap_Client/lib/Horde/Imap/Client/Socket.php index 4274d9fcc..52b05a0be 100644 --- a/framework/Imap_Client/lib/Horde/Imap/Client/Socket.php +++ b/framework/Imap_Client/lib/Horde/Imap/Client/Socket.php @@ -3136,7 +3136,7 @@ class Horde_Imap_Client_Socket extends Horde_Imap_Client_Base } else { $this->_temp['logout'] = true; $this->logout(); - throw new Horde_Imap_Client_Exception('IMAP Server closed the connection: ' . implode(' ', array_slice($read, 1)), Horde_Imap_Client_Exception::IMAP_DISCONNECT); + throw new Horde_Imap_Client_Exception('IMAP Server closed the connection: ' . implode(' ', array_slice($read, 1)), Horde_Imap_Client_Exception::DISCONNECT); } } @@ -3222,7 +3222,7 @@ class Horde_Imap_Client_Socket extends Horde_Imap_Client_Base if ($this->_debug) { fwrite($this->_debug, '[ERROR: IMAP server closed the connection.]' . "\n"); } - throw new Horde_Imap_Client_Exception('IMAP server closed the connection unexpectedly.', Horde_Imap_Client_Exception::IMAP_DISCONNECT); + throw new Horde_Imap_Client_Exception('IMAP server closed the connection unexpectedly.', Horde_Imap_Client_Exception::DISCONNECT); } $data = ''; diff --git a/framework/Imap_Client/lib/Horde/Imap/Client/Socket/Pop3.php b/framework/Imap_Client/lib/Horde/Imap/Client/Socket/Pop3.php index a11de7476..a75efb107 100644 --- a/framework/Imap_Client/lib/Horde/Imap/Client/Socket/Pop3.php +++ b/framework/Imap_Client/lib/Horde/Imap/Client/Socket/Pop3.php @@ -272,6 +272,11 @@ class Horde_Imap_Client_Socket_Pop3 extends Horde_Imap_Client_Base stream_set_timeout($this->_stream, $this->_params['timeout']); + // Add separator to make it easier to read debug log. + if ($this->_debug) { + fwrite($this->_debug, str_repeat('-', 30) . "\n"); + } + $line = $this->_getLine(); // Check for string matching APOP timestamp @@ -1167,7 +1172,7 @@ class Horde_Imap_Client_Socket_Pop3 extends Horde_Imap_Client_Base if (feof($this->_stream)) { $this->logout(); - throw new Horde_Imap_Client_Exception('POP3 Server closed the connection unexpectedly.', Horde_Imap_Client_Exception::IMAP_DISCONNECT); + throw new Horde_Imap_Client_Exception('POP3 Server closed the connection unexpectedly.', Horde_Imap_Client_Exception::DISCONNECT); } $read = rtrim(fgets($this->_stream)); @@ -1211,7 +1216,7 @@ class Horde_Imap_Client_Socket_Pop3 extends Horde_Imap_Client_Base /** * Obtain multiline input. * - * @param boolean $retarray Return an arrray? + * @param boolean $retarray Return an array? * * @return mixed An array if $retarray is true, a string otherwise. * @throws Horde_Imap_Client_Exception -- 2.11.0