- $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 ($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("^([\\s]*)([^\\s]*)$", $mailbox, $regs))
+ {
+ $line .= str_replace(' ', ' ', $regs[1]);
+ if ($boxes[$i]['parent'])
+ $line .= FoldLink($boxes[$i]['unformatted'],
+ $boxes[$i]['parent']);
+ $line .= str_replace(' ', ' ', $regs[2]);
+ }
+ $line .= '</FONT>';
+ } else {
+ $line .= formatMailboxName($imapConnection, $boxes[$i], $delimeter);
+ }
+ echo "$line<BR>\n";