diff options
author | thomascube <thomas@roundcube.net> | 2011-08-18 18:34:56 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2011-08-18 18:34:56 +0000 |
commit | b6cd452bd31bfd4b6b94b23fe54b424fdf901e61 (patch) | |
tree | 7b8640c4f06ef5a564a0a25c9f6d7d58d9d9abbc /program/include | |
parent | b1cde954d15abedbb2874f592c59155e049244ef (diff) |
Backport changes from r5084 to r5090 to release branch
Diffstat (limited to 'program/include')
-rw-r--r-- | program/include/main.inc | 26 | ||||
-rw-r--r-- | program/include/rcube_imap.php | 22 |
2 files changed, 32 insertions, 16 deletions
diff --git a/program/include/main.inc b/program/include/main.inc index a3edbf7ca..82d3eb7e9 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -1407,21 +1407,21 @@ function rcmail_render_folder_tree_select(&$arrFolders, &$mbox_name, $maxlength, $out = ''; foreach ($arrFolders as $key => $folder) { - if (!empty($exceptions) && in_array($folder['id'], $exceptions)) { - continue; - } - - if (!$realnames && ($folder_class = rcmail_folder_classname($folder['id']))) - $foldername = rcube_label($folder_class); - else { - $foldername = $folder['name']; + if (empty($exceptions) || !in_array($folder['id'], $exceptions)) { + if (!$realnames && ($folder_class = rcmail_folder_classname($folder['id']))) + $foldername = rcube_label($folder_class); + else { + $foldername = $folder['name']; + + // shorten the folder name to a given length + if ($maxlength && $maxlength>1) + $foldername = abbreviate_string($foldername, $maxlength); + } - // shorten the folder name to a given length - if ($maxlength && $maxlength>1) - $foldername = abbreviate_string($foldername, $maxlength); + $select->add(str_repeat(' ', $nestLevel*4) . $foldername, $folder['id']); } - - $select->add(str_repeat(' ', $nestLevel*4) . $foldername, $folder['id']); + else if ($nestLevel) + continue; if (!empty($folder['folders'])) $out .= rcmail_render_folder_tree_select($folder['folders'], $mbox_name, $maxlength, diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php index e31fb887e..0e28b083a 100644 --- a/program/include/rcube_imap.php +++ b/program/include/rcube_imap.php @@ -3083,20 +3083,36 @@ class rcube_imap $a_folders = $this->conn->listMailboxes($root, $name, NULL, array('SUBSCRIBED')); - // remove non-existent folders - if (is_array($a_folders)) { + // unsubscribe non-existent folders, remove from the list + if (is_array($a_folders) && $name == '*') { foreach ($a_folders as $idx => $folder) { if ($this->conn->data['LIST'] && ($opts = $this->conn->data['LIST'][$folder]) && in_array('\\NonExistent', $opts) ) { + $this->conn->unsubscribe($folder); unset($a_folders[$idx]); - } + } } } } // retrieve list of folders from IMAP server using LSUB else { $a_folders = $this->conn->listSubscribed($root, $name); + + // unsubscribe non-existent folders, remove from the list + if (is_array($a_folders) && $name == '*') { + foreach ($a_folders as $idx => $folder) { + if ($this->conn->data['LIST'] && ($opts = $this->conn->data['LIST'][$folder]) + && in_array('\\Noselect', $opts) + ) { + // Some servers returns \Noselect for existing folders + if (!$this->mailbox_exists($folder)) { + $this->conn->unsubscribe($folder); + unset($a_folders[$idx]); + } + } + } + } } } |