From: stekkel Date: Thu, 26 Feb 2004 18:01:59 +0000 (+0000) Subject: Fixed the issue where inbox showed up in the lsub response with a \NoSelect X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=31a5064d113ed89bf0d593d350b4736fb1d120a7;p=squirrelmail.git Fixed the issue where inbox showed up in the lsub response with a \NoSelect flag. If we detect inbox with \NoSelect we unset the result for inbox and do a list request for inbox. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@6668 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index 54577b8e..a5a6277c 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -814,13 +814,29 @@ function sqimap_mailbox_tree($imap_stream) { for ($i = 0, $cnt = count($lsub_ary); $i < $cnt; $i++) { if (preg_match("/^\*\s+LSUB.*\s\"?INBOX\"?[^(\/\.)].*$/i",$lsub_ary[$i])) { $lsub_ary[$i] = strtoupper($lsub_ary[$i]); - $has_inbox = true; + // in case of an unsubscribed inbox an imap server can + // return the inbox in the lsub results with a \NoSelect + // flag. + if (!preg_match("/\*\s+LSUB\s+\(.*\\\\NoSelect.*\).*/i",$lsub_ary[$i])) { + $has_inbox = true; + } else { + // remove the result and request it again with a list + // response at a later stage. + unset($lsub_ary[$i]); + } break; } } if ($has_inbox == false) { - $lsub_ary[] = '* LSUB () NIL INBOX'; + // do a list request for inbox because we should always show + // inbox even if the user isn't subscribed to it. + $inbox_ary = sqimap_run_command ($imap_stream, 'LIST "" INBOX', + true, $response, $message); + $inbox_ary = compact_mailboxes_response($inbox_ary); + if (count($inbox_ary)) { + $lsub_ary[] = $inbox_ary[0]; + } } /*