Hi, this is graf25, and I'm an idiot. :)
[squirrelmail.git] / functions / imap_mailbox.php
index f3121520b047c36bce384b93b0616b7ee7cb4f3d..6c628af58b19c18a6254348f306a9ddbf169cf34 100755 (executable)
@@ -437,14 +437,14 @@ function user_strcasecmp($a, $b) {
  * See comment on sqimap_mailbox_parse() for info about the returned array.
  */
 function sqimap_mailbox_list($imap_stream) {
-    global $boxesnew, $default_folder_prefix;
+    global $default_folder_prefix;
 
     if ( !isset( $boxesnew ) ) {
 
         global $data_dir, $username, $list_special_folders_first,
                $folder_prefix, $trash_folder, $sent_folder, $draft_folder,
                $move_to_trash, $move_to_sent, $save_as_draft,
-               $delimiter;
+               $delimiter, $noselect_fix_enable;
 
         $inbox_in_list = false;
         $inbox_subscribed = false;
@@ -452,10 +452,17 @@ function sqimap_mailbox_list($imap_stream) {
         require_once('../src/load_prefs.php');
         require_once('../functions/array.php');
 
+    if ($noselect_fix_enable) {
+        $lsub_args = "LSUB \"$folder_prefix\" \"*%\"";
+    }
+    else {
+        $lsub_args = "LSUB \"$folder_prefix\" \"*\"";
+    }
         /* LSUB array */
-        $lsub_ary = sqimap_run_command ($imap_stream, "LSUB \"$folder_prefix\" \"*%\"",
+        $lsub_ary = sqimap_run_command ($imap_stream, $lsub_args,
                                         true, $response, $message);
 
+
         /*
          * Section about removing the last element was removed 
          * We don't return "* OK" anymore from sqimap_read_data
@@ -567,7 +574,8 @@ function sqimap_mailbox_list($imap_stream) {
                     $used[$k] = true;
                 }
                 $spec_sub = str_replace(' ', '', $box['formatted']);
-                $spec_sub = str_replace('*', '', $box['formatted']);
+                $spec_sub = str_replace('*', '', $spec_sub);
+                $spec_sub = str_replace('?', '\?', $spec_sub);
 
                /* In case of problems with preg
                   here is a ereg version