increased performance of reading mailboxes 20-30% by doing 2 things:
[squirrelmail.git] / functions / mailbox.php
index 45d9021ae6268fc56692bdbdd70227ffd8969926..f5aba2f167b2109c0acfdf27d073de5619ad7222 100644 (file)
     **  individually.  I'm not sure why it happens like that, but that's what my
     **  testing found.  Perhaps later I will be proven wrong and this will change.
     **/
-   function getMessageFlags($imapConnection, $j, &$flags) {
+   function getMessageFlags($imapConnection, $low, $high, &$flags) {
       /**   * 2 FETCH (FLAGS (\Answered \Seen))   */
-      fputs($imapConnection, "messageFetch FETCH $j:$j FLAGS\n");
+      fputs($imapConnection, "messageFetch FETCH $low:$high FLAGS\n");
       $read = fgets($imapConnection, 1024);
       $count = 0;
       while ((substr($read, 0, 15) != "messageFetch OK") && (substr($read, 0, 16) != "messageFetch BAD")) {
          if (strpos($read, "FLAGS")) {
             $read = ereg_replace("\(", "", $read);
             $read = ereg_replace("\)", "", $read);
+            $read = str_replace("\\", "", $read);
             $read = substr($read, strpos($read, "FLAGS")+6, strlen($read));
             $read = trim($read);
-            $flags = explode(" ", $read);;
-            $s = 0;
-            while ($s < count($flags)) {
-               $flags[$s] = substr($flags[$s], 1, strlen($flags[$s]));
-               $s++;
-            }
+            $flags[$count] = explode(" ", $read);;
          } else {
-            $flags[0] = "None";
+            $flags[$count][0] = "None";
          }
          $count++;
          $read = fgets($imapConnection, 1024);