[Svn] r4128 - trunk/roundcubemail/program/include

trac at roundcube.net trac at roundcube.net
Mon Oct 25 09:45:35 CEST 2010


Author: alec
Date: 2010-10-25 02:45:35 -0500 (Mon, 25 Oct 2010)
New Revision: 4128

Modified:
   trunk/roundcubemail/program/include/rcube_imap_generic.php
Log:
- Improve performance by reading optional capability response from AUTHENTICATE


Modified: trunk/roundcubemail/program/include/rcube_imap_generic.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_imap_generic.php	2010-10-23 17:38:32 UTC (rev 4127)
+++ trunk/roundcubemail/program/include/rcube_imap_generic.php	2010-10-25 07:45:35 UTC (rev 4128)
@@ -119,6 +119,7 @@
     const ERROR_UNKNOWN = -4;
 
     const COMMAND_NORESPONSE = 1;
+    const COMMAND_CAPABILITY = 2;
 
     /**
      * Object constructor
@@ -476,7 +477,8 @@
 
             // RFC 4959 (SASL-IR): save one round trip
             if ($this->getCapability('SASL-IR')) {
-                $result = $this->execute("AUTHENTICATE PLAIN", array($reply), self::COMMAND_NORESPONSE);
+                $result = $this->execute("AUTHENTICATE PLAIN", array($reply),
+                    self::COMMAND_NORESPONSE | self::COMMAND_CAPABILITY);
             }
             else {
     		    $this->putLine($this->next_tag() . " AUTHENTICATE PLAIN");
@@ -494,6 +496,10 @@
         }
 
         if ($result == self::ERROR_OK) {
+    	    // optional CAPABILITY response
+	        if ($line && preg_match('/\[CAPABILITY ([^]]+)\]/i', $line, $matches)) {
+		        $this->parseCapability($matches[1]);
+	        }
             return $this->fp;
         }
         else {
@@ -514,7 +520,7 @@
     function login($user, $password)
     {
         list($code, $response) = $this->execute('LOGIN', array(
-            $this->escape($user), $this->escape($password)));
+            $this->escape($user), $this->escape($password)), self::COMMAND_CAPABILITY);
 
         // re-set capabilities list if untagged CAPABILITY response provided
 	    if (preg_match('/\* CAPABILITY (.+)/i', $response, $matches)) {
@@ -2802,6 +2808,13 @@
             $response = substr($response, 0, -$line_len);
         }
 
+   	    // optional CAPABILITY response
+	    if (($options & self::COMMAND_CAPABILITY) && $code == self::ERROR_OK
+            && preg_match('/\[CAPABILITY ([^]]+)\]/i', $line, $matches)
+        ) {
+		    $this->parseCapability($matches[1]);
+	    }
+
 	    return $noresp ? $code : array($code, $response);
     }
 

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list