diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2012-03-02 13:43:45 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2012-03-02 13:43:45 +0000 |
| commit | 26f583cf5bc998f17e7e8091184fda833a569f0c (patch) | |
| tree | 3e7265a1600b1d6385346e6ed3c03a9c72d06a41 /roundcubemail/program/include/rcube_imap.php | |
| parent | 72a2a653b7c68f01afd5be7b6e6a13d8fc5a6662 (diff) | |
- Fix automatic unsubscribe of non-existent folders (with small perf fix)
git-svn-id: https://svn.roundcube.net/trunk@5946 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_imap.php')
| -rw-r--r-- | roundcubemail/program/include/rcube_imap.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/roundcubemail/program/include/rcube_imap.php b/roundcubemail/program/include/rcube_imap.php index ec9db571c..81ad1859a 100644 --- a/roundcubemail/program/include/rcube_imap.php +++ b/roundcubemail/program/include/rcube_imap.php @@ -2527,9 +2527,10 @@ class rcube_imap extends rcube_storage NULL, array('SUBSCRIBED')); // unsubscribe non-existent folders, remove from the list - if (is_array($a_folders) && $name == '*') { + // we can do this only when LIST response is available + if (is_array($a_folders) && $name == '*' && !empty($this->conn->data['LIST'])) { foreach ($a_folders as $idx => $folder) { - if ($this->conn->data['LIST'] && ($opts = $this->conn->data['LIST'][$folder]) + if (($opts = $this->conn->data['LIST'][$folder]) && in_array('\\NonExistent', $opts) ) { $this->conn->unsubscribe($folder); @@ -2542,11 +2543,12 @@ class rcube_imap extends rcube_storage else { $a_folders = $this->conn->listSubscribed($root, $name); - // unsubscribe non-existent folders, remove from the list - if (is_array($a_folders) && $name == '*') { + // unsubscribe non-existent folders, remove them from the list, + // we can do this only when LIST response is available + if (is_array($a_folders) && $name == '*' && !empty($this->conn->data['LIST'])) { foreach ($a_folders as $idx => $folder) { - if ($this->conn->data['LIST'] && ($opts = $this->conn->data['LIST'][$folder]) - && in_array('\\Noselect', $opts) + if (!isset($this->conn->data['LIST'][$folder]) + || in_array('\\Noselect', $this->conn->data['LIST'][$folder]) ) { // Some servers returns \Noselect for existing folders if (!$this->folder_exists($folder)) { |
