Logging & error reporting tweaks
authorMichael M Slusarz <slusarz@curecanti.org>
Sun, 5 Jul 2009 21:05:59 +0000 (15:05 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Sun, 5 Jul 2009 21:05:59 +0000 (15:05 -0600)
framework/Imap_Client/lib/Horde/Imap/Client/Exception.php
framework/Imap_Client/lib/Horde/Imap/Client/Socket.php
framework/Imap_Client/lib/Horde/Imap/Client/Socket/Pop3.php

index f77bc8d..5765870 100644 (file)
@@ -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;
index 4274d9f..52b05a0 100644 (file)
@@ -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 = '';
index a11de74..a75efb1 100644 (file)
@@ -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