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

trac at roundcube.net trac at roundcube.net
Sun Aug 8 12:53:58 CEST 2010


Author: alec
Date: 2010-08-08 05:53:57 -0500 (Sun, 08 Aug 2010)
New Revision: 3881

Modified:
   trunk/roundcubemail/program/include/rcube_imap_generic.php
Log:
- Improved performance of LIST/LSUB response parsing


Modified: trunk/roundcubemail/program/include/rcube_imap_generic.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_imap_generic.php	2010-08-07 13:58:05 UTC (rev 3880)
+++ trunk/roundcubemail/program/include/rcube_imap_generic.php	2010-08-08 10:53:57 UTC (rev 3881)
@@ -1669,8 +1669,11 @@
             $command = 'LIST';
         }
 
+        $ref = $this->escape($ref);
+        $mailbox = $this->escape($mailbox);
+
     	// send command
-	    if (!$this->putLine($key." ".$command." \"". $this->escape($ref) ."\" \"". $this->escape($mailbox) ."\"")) {
+	    if (!$this->putLine($key." ".$command." \"". $ref ."\" \"". $mailbox ."\"")) {
 		    $this->error = "Couldn't send $command command";
 	        return false;
 	    }
@@ -1679,16 +1682,15 @@
 	    do {
 		    $line = $this->readLine(500);
 		    $line = $this->multLine($line, true);
-		    $a    = explode(' ', $line);
+		    $line = trim($line);
 
-		    if (($line[0] == '*') && ($a[1] == $command)) {
-			    $line = rtrim($line);
-        		// split one line
-			    $a = rcube_explode_quoted_string(' ', $line);
-        		// last string is folder name
-			    $folders[] = preg_replace(array('/^"/', '/"$/'), '', $this->unEscape($a[count($a)-1]));
-		        // second from last is delimiter
-        		$delim = trim($a[count($a)-2], '"');
+		    if (preg_match('/^\* '.$command.' \(([^\)]*)\) "*([^"]+)"* (.*)$/', $line, $m)) {
+        		// folder name
+   			    $folders[] = preg_replace(array('/^"/', '/"$/'), '', $this->unEscape($m[3]));
+		        // attributes
+//        		$attrib = explode(' ', $m[1]);
+		        // delimiter
+//        		$delim = $m[2];
 		    }
 	    } while (!$this->startsWith($line, $key, true));
 

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



More information about the Svn mailing list