diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-05-05 12:46:54 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-05-05 12:46:54 +0000 |
| commit | 512c19b2da21a7560fb924b67f47888506295b9d (patch) | |
| tree | 491c878e59528a130c8c0266a2bca4b165ef2022 /roundcubemail/program/include/main.inc | |
| parent | 865e3f5f3c4aa8b78451deb7fc27b16e3e47a438 (diff) | |
- Fix problems with subfolders of INBOX folder on some IMAP servers (#1487725)
- Fix handling of folders that doesn't belong to any namespace (#1487637)
git-svn-id: https://svn.roundcube.net/trunk@4733 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/main.inc')
| -rw-r--r-- | roundcubemail/program/include/main.inc | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/roundcubemail/program/include/main.inc b/roundcubemail/program/include/main.inc index 1947e3573..baaca654d 100644 --- a/roundcubemail/program/include/main.inc +++ b/roundcubemail/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'), |
