Corrected display (on Courier at least) of mailboxes with INBOX
authorebullient <ebullient@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 15 Jun 2003 00:40:58 +0000 (00:40 +0000)
committerebullient <ebullient@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 15 Jun 2003 00:40:58 +0000 (00:40 +0000)
prefix. INBOX was being added to the tree twice (was already the
root), and then because it was root, the link (with proper nesting)
wasn't being displayed.

Also corrected setting 'noselect' for INBOX (now tree root) -
was being errantly set as 'flag' which was causing errors about
not havign noselect set...

Also removed the places where it was checking whether or not
noselect was set for a mailbox - given the structure, noselect should
always be set - and we should get an error if it isn't (for boxlist
formed from LSUB).

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

functions/imap_mailbox.php
src/left_main.php

index a968dc19a7624bb65c6ec51236a3325323a5d0c3..6da2548a7d9151dead9d0d198b6cb6e29c623c18 100755 (executable)
@@ -736,13 +736,6 @@ function sqimap_mailbox_tree($imap_stream) {
                 $lsub_ary[$i] = $regs[1] . '"' . addslashes(trim($lsub_ary[$i])) . '"' . $regs[2];
             }
 
-            /*
-            if (preg_match("/^\*\s+LSUB\s+\((.*)\)\s+\"(.*)\"\s+\"?(.+(?=\")|.+).*$/",$lsub_ary[$i],$regs)) {
-                $flag = $regs[1];
-                $mbx = trim($regs[3]);
-                $sorted_lsub_ary[] = array ('mbx' => $mbx, 'flag' => $flag); 
-            }
-            */
             $mbx = find_mailbox_name($lsub_ary[$i]);
             $noselect = check_is_noselect($lsub_ary[$i]);
             if (substr($mbx, -1) == $delimiter) {
@@ -778,28 +771,18 @@ function sqimap_mailbox_tree($imap_stream) {
                 $mbx = substr($mbx, 0, strlen($mbx) - 1);
             }
             if ($mbx == 'INBOX') {
-                $sorted_lsub_ary[] = array ('mbx' => $mbx, 'flag' => ''); 
+                $sorted_lsub_ary[] = array ('mbx' => $mbx, 'noselect' => '0'); 
                 sqimap_subscribe($imap_stream, 'INBOX');
                 $cnt++;
             }
-
-            /*
-            if (preg_match("/^\*\s+LIST\s+\((.*)\)\s+\"(.*)\"\s+\"?(.+(?=\")|.+).*$/",$inbox_ary[0],$regs)) {
-                $flag = $regs[1];
-                $mbx = trim($regs[3]);
-                if (substr($mbx, -1) == $delimiter) {
-                    $mbx = substr($mbx, 0, strlen($mbx) - 1);
-                }
-                $sorted_lsub_ary[] = array ('mbx' => $mbx, 'flag' => $flag); 
-            }
-            */
         }
+
         for ($i = 0 ; $i < $cnt; $i++) {
             $mbx = $sorted_lsub_ary[$i]['mbx'];
             if (($unseen_notify == 2 && $mbx == 'INBOX') ||
                 ($unseen_notify == 3) ||
                 ($move_to_trash && ($mbx == $trash_folder))) {
-                if(isset($sorted_lsub_ary[$i]['noselect']) && $sorted_lsub_ary[$i]['noselect']) {
+                if( $sorted_lsub_ary[$i]['noselect'] ) {
                     $sorted_lsub_ary[$i]['unseen'] = 0;
                 } else {
                     $sorted_lsub_ary[$i]['unseen'] = 
@@ -855,6 +838,11 @@ function sqimap_fill_mailbox_tree($mbx_ary, $mbxs=false) {
             $mailbox = $mbx_ary[$i]['mbx'];
             switch ($mailbox) {
                 case 'INBOX':
+                    // $mailboxes IS the INBOX, change $mbx to refer to $mailboxes
+                    // for unread count, attribute setting, etc.
+                    unset($mbx);
+                    $mbx =& $mailboxes;
+
                     $mbx->is_inbox = true;
                     $mbx->is_special = true;
                     break;
@@ -888,10 +876,12 @@ function sqimap_fill_mailbox_tree($mbx_ary, $mbxs=false) {
                 $mbx->mailboxname_sub = $mbx_ary[$i]['mbx'];
             }
             $mbx->mailboxname_full = $mbx_ary[$i]['mbx'];
-            $mailboxes->addMbx($mbx, $delimiter, $start, $list_special_folders_first);
+
+            // Don't add INBOX to itself
+            if ( $mailbox != 'INBOX' )
+                $mailboxes->addMbx($mbx, $delimiter, $start, $list_special_folders_first);
         }
     }
-
     return $mailboxes;
 }
 
index 042abd0f03160def403030e0755562d92cd763a5..aaa90f1cc571a92ca61f83d2cad1fb697550498a 100644 (file)
@@ -341,7 +341,6 @@ function listBoxes ($boxes, $j=0 ) {
             $pre.= $leader . '&nbsp;&nbsp;&nbsp;';
         }
 
-
         /* If there are unseen message, bold the line. */
 
         if (($move_to_trash) && ($mailbox == $trash_folder)) {
@@ -398,10 +397,10 @@ function listBoxes ($boxes, $j=0 ) {
             $fontend = "</font>";
         }
         $end .= '</nobr>';
-        if (!$boxes->is_root) {
-            echo "" . $pre .$font. $boxes->mailboxname_sub .$fontend . $end. '<br />' . "\n";
-            $j++;
-        }
+        
+        echo "" . $pre .$font. $boxes->mailboxname_sub .$fontend . $end. '<br />' . "\n";
+        $j++;
+        
         if (!$collapse || $boxes->is_root) {
             for ($i = 0; $i <count($boxes->mbxs); $i++) {
                 listBoxes($boxes->mbxs[$i],$j);
@@ -587,7 +586,7 @@ if (isset($left_refresh) && ($left_refresh != '') &&
  **/
 
 $advanced_tree = false; /* set this to true if you want to see a nicer mailboxtree */
-$oldway = false; /* default SM behaviour */
+$oldway = false;        /* default SM behaviour */
 
 if ($advanced_tree) {
 $xtra .= <<<ECHO