summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak (Kolab Systems) <machniak@kolabsys.com>2011-08-18 09:37:28 (GMT)
committerAleksander Machniak (Kolab Systems) <machniak@kolabsys.com>2011-08-18 09:37:28 (GMT)
commit406bc9c012c462e43e5074423e1a571fe6ac7470 (patch)
tree27e778f187677bbedd6d726e883530ea9f8a25e5
parent4d22d4d71e3937c4d3415ba4d84863f7c88a09d9 (diff)
downloadroundcubemail-plugins-kolab-406bc9c012c462e43e5074423e1a571fe6ac7470.tar.gz
Unsubscribe from non-existent folders as core does (#247)
-rw-r--r--plugins/kolab_folders/kolab_folders.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/plugins/kolab_folders/kolab_folders.php b/plugins/kolab_folders/kolab_folders.php
index d360970..de63a20 100644
--- a/plugins/kolab_folders/kolab_folders.php
+++ b/plugins/kolab_folders/kolab_folders.php
@@ -386,19 +386,35 @@ class kolab_folders extends rcube_plugin
NULL, array('SUBSCRIBED'));
// remove non-existent folders
- if (is_array($a_folders)) {
+ if (is_array($a_folders) && $name = '*') {
foreach ($a_folders as $idx => $folder) {
if ($imap->conn->data['LIST'] && ($opts = $imap->conn->data['LIST'][$folder])
&& in_array('\\NonExistent', $opts)
) {
+ $imap->conn->unsubscribe($folder);
unset($a_folders[$idx]);
- }
+ }
}
}
}
// retrieve list of folders from IMAP server using LSUB
else {
$a_folders = $imap->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 ($imap->conn->data['LIST'] && ($opts = $imap->conn->data['LIST'][$folder])
+ && in_array('\\Noselect', $opts)
+ ) {
+ // Some servers returns \Noselect for existing folders
+ if (!$imap->mailbox_exists($folder)) {
+ $imap->conn->unsubscribe($folder);
+ unset($a_folders[$idx]);
+ }
+ }
+ }
+ }
}
return $a_folders;