applied Patch #101198 There was an inconsistancy, where a color was hardcoded, and...
[squirrelmail.git] / functions / imap_mailbox.php
index 1ac79cffa1b122ff556ef3594af16c0cb8276303..422638ed3193150b8a06adb94ac9cfce9ade72ad 100755 (executable)
@@ -12,6 +12,7 @@
       sqimap_mailbox_select ($imap_stream, $mailbox);
       fputs ($imap_stream, "a001 EXPUNGE\r\n");
       $read = sqimap_read_data($imap_stream, "a001", true, $response, $message);
+      sqimap_mailbox_close ($imap_stream);
    }
 
 
       }
    }
 
+   /******************************************************************************
+    **  Closes an open mailbox 
+    ******************************************************************************/
+   function sqimap_mailbox_close ($imap_stream) {
+      fputs ($imap_stream, "a001 CLOSE\r\n");
+      $tmp = sqimap_read_data($imap_stream, "a001", false, $response, $message);
+   }
 
-   
    /******************************************************************************
     **  Selects a mailbox
     ******************************************************************************/
-   function sqimap_mailbox_select ($imap_stream, $mailbox, $hide=true) {
+   function sqimap_mailbox_select ($imap_stream, $mailbox, $hide=true, $recent=false) {
       fputs ($imap_stream, "a001 SELECT \"$mailbox\"\r\n");
        $read = sqimap_read_data($imap_stream, "a001", true, $response, $message);
+      if ($recent) {
+         for ($i=0; $i<count($read); $i++) {
+            if (strpos(strtolower($read[$i]), "recent")) {
+               $r = explode(" ", $read[$i]);
+            }
+         }
+         return $r[1];
+      }
    }
 
    
             $dm_count--;
             
          for ($j = 0; $j < $dm_count - (countCharInString($folder_prefix, $dm)); $j++)
-            $boxes[$g]["formatted"] = $boxes[$g]["formatted"] . "  ";
+            $boxes[$g]["formatted"] = $boxes[$g]["formatted"] . "&nbsp;&nbsp;";
          $boxes[$g]["formatted"] .= readShortMailboxName($mailbox, $dm);
             
          $boxes[$g]["unformatted-dm"] = $mailbox;