summaryrefslogtreecommitdiff
path: root/program/include/main.inc
diff options
context:
space:
mode:
Diffstat (limited to 'program/include/main.inc')
-rw-r--r--program/include/main.inc36
1 files changed, 25 insertions, 11 deletions
diff --git a/program/include/main.inc b/program/include/main.inc
index 1947e3573..baaca654d 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -1228,17 +1228,20 @@ function rcmail_mailbox_select($p = array())
else
$list = $RCMAIL->imap->list_mailboxes();
- foreach ($list as $folder)
+ $delimiter = $RCMAIL->imap->get_hierarchy_delimiter();
+
+ foreach ($list as $folder) {
if (empty($p['exceptions']) || !in_array($folder, $p['exceptions']))
- rcmail_build_folder_tree($a_mailboxes, $folder, $RCMAIL->imap->get_hierarchy_delimiter());
+ rcmail_build_folder_tree($a_mailboxes, $folder, $delimiter);
+ }
$select = new html_select($p);
-
+
if ($p['noselection'])
$select->add($p['noselection'], '');
-
+
rcmail_render_folder_tree_select($a_mailboxes, $mbox, $p['maxlength'], $select, $p['realnames']);
-
+
return $select;
}
@@ -1252,6 +1255,17 @@ function rcmail_build_folder_tree(&$arrFolders, $folder, $delm='/', $path='')
{
global $RCMAIL;
+ // Handle namespace prefix
+ $prefix = '';
+ if (!$path) {
+ $n_folder = $folder;
+ $folder = $RCMAIL->imap->mod_mailbox($folder);
+
+ if ($n_folder != $folder) {
+ $prefix = substr($n_folder, 0, -strlen($folder));
+ }
+ }
+
$pos = strpos($folder, $delm);
if ($pos !== false) {
@@ -1272,14 +1286,14 @@ function rcmail_build_folder_tree(&$arrFolders, $folder, $delm='/', $path='')
$virtual = false;
}
- $path .= $currentFolder;
-
- // Check \Noselect option (if options are in cache)
- if (!$virtual && ($opts = $RCMAIL->imap->mailbox_options($path))) {
- $virtual = in_array('\\Noselect', $opts);
- }
+ $path .= $prefix.$currentFolder;
if (!isset($arrFolders[$currentFolder])) {
+ // Check \Noselect option (if options are in cache)
+ if (!$virtual && ($opts = $RCMAIL->imap->mailbox_options($path))) {
+ $virtual = in_array('\\Noselect', $opts);
+ }
+
$arrFolders[$currentFolder] = array(
'id' => $path,
'name' => rcube_charset_convert($currentFolder, 'UTF7-IMAP'),