Forgot that $lsub_ibx[0] would be unset if LSUB didn't return INBOX, so
authorjangliss <jangliss@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 18 Jun 2003 21:58:03 +0000 (21:58 +0000)
committerjangliss <jangliss@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 18 Jun 2003 21:58:03 +0000 (21:58 +0000)
it'd never run the LIST code.  This meant in the case where they weren't
subbed to their INBOX, it'd never appear.

Thanks shaug for helping spot that.

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

functions/imap_mailbox.php

index 80ab398f2e8b25c6afc984bba79c426508c8d597..73852cd9a5b8475d0dacf8aa451647d9ac03d282 100755 (executable)
@@ -731,15 +731,14 @@ function sqimap_mailbox_tree($imap_stream) {
 
         if ($has_inbox == false) {
             $lsub_ibx = sqimap_run_command( $imap_stream, "LSUB \"\" \"INBOX\"", true, $response, $message );
-            if (isset($lsub_ibx[0])) {
-                if (preg_match("/^\*\s+LSUB\s+(.*)\"?INBOX\"?[^(\/\.)].*$/",$lsub_ibx[0])) {
+            if (isset($lsub_ibx[0]) && (preg_match("/^\*\s+LSUB\s+(.*)\"?INBOX\"?[^(\/\.)].*$/",$lsub_ibx[0]))) {
+                $lsub_ary[] = $lsub_ibx[0];
+            } else {
+                $lsub_ibx = sqimap_run_command( $imap_stream, "LIST \"\" \"INBOX\"", true, $response, $message );
+                if (preg_match("/^\*\s+LIST\s+(.*)\"?INBOX\"?[^(\/\.)].*$/",$lsub_ibx[0])) {
+                    sqimap_run_command( $imap_stream, "SUBSCRIBE \"INBOX\"", true, $response, $message );
+                    $lsub_ibx[0] = str_replace("LIST","LSUB",$lsub_ibx[0]);
                     $lsub_ary[] = $lsub_ibx[0];
-                } else {
-                    $lsub_ibx = sqimap_run_command( $imap_stream, "LIST \"\" \"INBOX\"", true, $response, $message );
-                    if (preg_match("/^\*\s+LIST(.*)\"?INBOX\"?[^(\/\.)].*$/",$lsub_ibx[0])) {
-                        $lsub_ibx[0] = str_replace("LIST","LSUB",$lsub_ibx[0]);
-                        $lsub_ary[] = $lsub_ibx[0];
-                    }
                 }
             }
         }