summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-08-18 09:30:28 +0000
committeralecpl <alec@alec.pl>2011-08-18 09:30:28 +0000
commit189a0ae4dcd965c9ea1ed3d203cfd5dd28922046 (patch)
treeb6778308227d134bea5f034804fc680854e3484e /program/include
parentb501e6795d0f3cb4b648f503e4018e5b2cb2dcba (diff)
- Unsubscribe from non-existing folders always (on listing), not only in Settings/Folders UI
Diffstat (limited to 'program/include')
-rw-r--r--program/include/rcube_imap.php22
1 files changed, 19 insertions, 3 deletions
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]);
+ }
+ }
+ }
+ }
}
}