deleting of folders should work now
[squirrelmail.git] / functions / imap_mailbox.php
index 16b50a2e1d524f7fb0ee9241dbe55f7904ce3033..143edfdc9bf2bcd2a7ce24583bcce96c89070bdb 100755 (executable)
@@ -5,7 +5,6 @@
     **  This impliments all functions that manipulate mailboxes
     **/
 
-
    /******************************************************************************
     **  Expunges a mailbox 
     ******************************************************************************/
     **  The array returned looks like this:
     ******************************************************************************/
    function sqimap_mailbox_list ($imap_stream) {
+      global $special_folders, $list_special_folders_first;
+      
       if (!function_exists ("ary_sort"))
          include ("../functions/array.php");
       
       }
 
       $original = $boxes;
+
+      /** Get the folders into lower case so sorting is not case sensative */
+      for ($i = 0; $i < count($original); $i++) {
+         $boxes[$i]["unformatted"] = strtolower($boxes[$i]["unformatted"]);
+      }
+
+      /** Sort them **/
       $boxes = ary_sort($boxes, "unformatted", 1);
-      
+
+      /** Get them back from the original array, still sorted by the id **/
       for ($i = 0; $i < count($boxes); $i++) {
          for ($j = 0; $j < count($original); $j++) {
             if ($boxes[$i]["id"] == $original[$j]["id"]) {
          }
       }     
  
+      
       for ($i = 0; $i < count($boxes); $i++) {
          if ($boxes[$i]["unformatted"] == $special_folders[0]) {
             $boxesnew[0] = $boxes[$i];
+            $boxes[$i]["used"] = true;
          }
       }
+      
       if ($list_special_folders_first == true) {
          for ($i = 0; $i < count($boxes); $i++) {
             for ($j = 1; $j < count($special_folders); $j++) {
             }
          }
       }
+      
       for ($i = 0; $i < count($boxes); $i++) {
          if (($boxes[$i]["unformatted"] != $special_folders[0]) &&
              ($boxes[$i]["used"] == false))  {
          }
       }
 
-      return $boxes;
+      return $boxesnew;
    }
    
-?>   
+?>