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

trac at roundcube.net trac at roundcube.net
Tue Nov 2 15:31:27 CET 2010


Author: alec
Date: 2010-11-02 09:31:27 -0500 (Tue, 02 Nov 2010)
New Revision: 4168

Modified:
   trunk/roundcubemail/program/include/rcube_imap_generic.php
Log:
- Small code improvements


Modified: trunk/roundcubemail/program/include/rcube_imap_generic.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_imap_generic.php	2010-11-02 09:39:56 UTC (rev 4167)
+++ trunk/roundcubemail/program/include/rcube_imap_generic.php	2010-11-02 14:31:27 UTC (rev 4168)
@@ -455,7 +455,7 @@
                 // send result
                 $this->putLine($reply);
                 $line = $this->readLine(1024);
-                
+
                 if ($line[0] == '+') {
 			        $challenge = substr($line, 2);
                 }
@@ -643,7 +643,7 @@
         if (array_key_exists('namespace', $this->prefs)) {
             return $this->prefs['namespace'];
         }
-    
+
         if (!$this->getCapability('NAMESPACE')) {
 	        return self::ERROR_BAD;
 	    }
@@ -1324,7 +1324,7 @@
 		    return false;
 	    }
 	    do {
-		    $line = $this->readLine(1024);
+		    $line = $this->readLine(4096);
 		    $line = $this->multLine($line);
 
             if (!$line)
@@ -1565,17 +1565,15 @@
 	    if ($field == 'date' || $field == 'internaldate') {
 	        $field = 'timestamp';
 	    }
+
     	if (empty($flag)) {
 	        $flag = 'ASC';
 	    } else {
         	$flag = strtoupper($flag);
         }
 
-	    $stripArr = ($field=='subject') ? array('Re: ','Fwd: ','Fw: ','"') : array('"');
-
 	    $c = count($a);
 	    if ($c > 0) {
-
 			// Strategy:
 			// First, we'll create an "index" array.
 			// Then, we'll use sort() on that array,
@@ -1593,14 +1591,17 @@
 			    } else {
 				    $data = $val->$field;
 				    if (is_string($data)) {
-					    $data = strtoupper(str_replace($stripArr, '', $data));
+				        $data = str_replace('"', '', $data);
+                	    if ($field == 'subject') {
+				            $data = preg_replace('/^(Re: \s*|Fwd:\s*|Fw:\s*)+/i', '', $data);
+                        }
+					    $data = strtoupper($data);
             		}
 			    }
-    			$index[$key]=$data;
+    			$index[$key] = $data;
 	    	}
 
 		    // sort index
-    		$i = 0;
 	    	if ($flag == 'ASC') {
 		    	asort($index);
     		} else {
@@ -1611,8 +1612,7 @@
 	    	$result = array();
 		    reset($index);
     		while (list($key, $val) = each($index)) {
-	    		$result[$key]=$a[$key];
-		    	$i++;
+	    		$result[$key] = $a[$key];
 		    }
 	    }
 

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



More information about the Svn mailing list