- $line = "";
- $mailbox = $boxes[$i]["formatted"];
-
- if (in_array('noselect', $boxes[$i]['flags'])) {
- $line .= "<FONT COLOR=\"$color[10]\">";
- $line .= replace_spaces($mailbox);
- $line .= '</FONT>';
- } else {
- if (! isset($boxes[$i]['unseen']))
- $boxes[$i]['unseen'] = '';
- $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $boxes[$i]["unseen"]);
+ if (! isset($boxes[$i]['folded']) || ! $boxes[$i]['folded'])
+ {
+ $line = "";
+ $mailbox = $boxes[$i]["formatted"];
+
+ if (isset($collapse_folders) && $collapse_folders && isset($IAmAParent[$boxes[$i]['unformatted']])) {
+ $boxes[$i]['parent'] = $IAmAParent[$boxes[$i]['unformatted']];
+ }
+
+ if (in_array('noselect', $boxes[$i]['flags'])) {
+ $line .= "<FONT COLOR=\"$color[10]\">";
+ if (ereg("^( *)([^ ]*)$", $mailbox, $regs)) {
+ $line .= str_replace(' ', ' ', $regs[1]);
+ if (isset($boxes[$i]['parent']))
+ $line .= FoldLink($boxes[$i]['unformatted'],
+ $boxes[$i]['parent']);
+ elseif ($collapse_folders)
+ $line .= '<tt> </tt> ';
+ $line .= str_replace(' ', ' ', $regs[2]);
+ }
+ $line .= '</FONT>';
+ } else {
+ $line .= formatMailboxName($imapConnection, $boxes[$i], $delimeter);
+ }
+ echo "$line<BR>\n";