- $dm_count--;
-
- for ($j = 0; $j < $dm_count - (countCharInString($folder_prefix, $dm)); $j++)
- $boxes[$g]["formatted"] = $boxes[$g]["formatted"] . " ";
- $boxes[$g]["formatted"] .= readShortMailboxName($mailbox, $dm);
+ $dm_count--; // If name ends in delimiter - decrement count by one
+
+ // Format folder name, but only if it's a INBOX.* or have
+ // a parent.
+ $boxesbyname[$mailbox] = $g;
+ $parentfolder = readMailboxParent($mailbox, $dm);
+ if((eregi("^inbox".quotemeta($dm), $mailbox)) ||
+ (ereg("^".$folder_prefix, $mailbox)) ||
+ ( isset($boxesbyname[$parentfolder]) && (strlen($parentfolder) > 0) ) ) {
+ $indent = $dm_count - (countCharInString($folder_prefix, $dm));
+ if ($indent)
+ $boxes[$g]["formatted"] = str_repeat(" ", $indent);
+ else
+ $boxes[$g]["formatted"] = '';
+ $boxes[$g]["formatted"] .= readShortMailboxName($mailbox, $dm);
+ } else {
+ $boxes[$g]["formatted"] = $mailbox;
+ }