UW sends \NoSelect in LIST and not in LSUB, which is perfectly fine by
authorjangliss <jangliss@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 21 Jun 2003 18:16:28 +0000 (18:16 +0000)
committerjangliss <jangliss@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 21 Jun 2003 18:16:28 +0000 (18:16 +0000)
RFCs, but we didn't do that.  For UW IMAP, force a LIST command on each
mailbox, this should also fix the \NoSelect on INBOX if it occurs.

Also updated the check for \NoSelect to include the LIST option as well as
LSUB.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5102 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/imap_mailbox.php

index 67bf3e4741b675d08f286e079338966a4c520412..5f42748fc14fa5781f6ffb3a9b75b61a06a96081 100755 (executable)
@@ -84,7 +84,7 @@ function find_mailbox_name ($mailbox) {
 }
 
 function check_is_noselect ($lsub_line) {
-    return preg_match("/^\* LSUB \([^\)]*\\Noselect[^\)]*\)/i", $lsub_line);
+    return preg_match("/^\* (LSUB|LIST) \([^\)]*\\Noselect[^\)]*\)/i", $lsub_line);
 }
 
 /**
@@ -707,7 +707,8 @@ function sqimap_mailbox_tree($imap_stream) {
     if (!isset($boxesnew)) {
 
         global $data_dir, $username, $list_special_folders_first,
-               $folder_prefix, $delimiter, $trash_folder, $move_to_trash;
+               $folder_prefix, $delimiter, $trash_folder, $move_to_trash,
+               $imap_server_type;
 
 
         $inbox_in_list = false;
@@ -763,6 +764,14 @@ function sqimap_mailbox_tree($imap_stream) {
             }
 
             $mbx = find_mailbox_name($lsub_ary[$i]);
+
+            // Force a list for UW as it returns \NoSelect in LIST and not LSUB //
+            if ($imap_server_type == "uw") {                
+                $tmp_str = sqimap_run_command( $imap_stream , "LIST \"\" \"$mbx\"" , true, $response, $message );
+                if (isset($tmp_str[0])) {
+                    $lsub_ary[$i] = $tmp_str[0];
+                }
+            }
             $noselect = check_is_noselect($lsub_ary[$i]);
             if (substr($mbx, -1) == $delimiter) {
                 $mbx = substr($mbx, 0, strlen($mbx) - 1);