summaryrefslogtreecommitdiff
path: root/program/include/main.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-05-05 12:46:54 +0000
committeralecpl <alec@alec.pl>2011-05-05 12:46:54 +0000
commitd08333ea578e3b6c6ab42bed05f808a2b7b93cf1 (patch)
tree58aa053d41963c5f452b614497d06aaf73c5a76a /program/include/main.inc
parent4764079c6af092a6dfa18306601e1b33482fb756 (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)
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'),