From b6cd452bd31bfd4b6b94b23fe54b424fdf901e61 Mon Sep 17 00:00:00 2001 From: thomascube <thomas@roundcube.net> Date: Thu, 18 Aug 2011 14:34:56 -0400 Subject: [PATCH] Backport changes from r5084 to r5090 to release branch --- program/include/rcube_imap.php | 22 +++++++++++++++++++--- 1 files changed, 19 insertions(+), 3 deletions(-) diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php index e31fb88..0e28b08 100644 --- a/program/include/rcube_imap.php +++ b/program/include/rcube_imap.php @@ -3083,20 +3083,36 @@ $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]); + } + } + } + } } } -- Gitblit v1.9.1