diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-08-18 09:30:28 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-08-18 09:30:28 +0000 |
| commit | 71919f0650771f5fc9ead3277b13fe251194cbff (patch) | |
| tree | eb02d8e5372ba7206b4e888fc12550f9386a3700 /roundcubemail/program | |
| parent | 3f04effa0058c1132fdba316dc577c8e7e7fdc4a (diff) | |
- Unsubscribe from non-existing folders always (on listing), not only in Settings/Folders UI
git-svn-id: https://svn.roundcube.net/trunk@5085 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program')
| -rw-r--r-- | roundcubemail/program/include/rcube_imap.php | 22 | ||||
| -rw-r--r-- | roundcubemail/program/steps/settings/folders.inc | 8 |
2 files changed, 19 insertions, 11 deletions
diff --git a/roundcubemail/program/include/rcube_imap.php b/roundcubemail/program/include/rcube_imap.php index e31fb887e..0e28b083a 100644 --- a/roundcubemail/program/include/rcube_imap.php +++ b/roundcubemail/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]); + } + } + } + } } } diff --git a/roundcubemail/program/steps/settings/folders.inc b/roundcubemail/program/steps/settings/folders.inc index eea58062b..ccf8eebb2 100644 --- a/roundcubemail/program/steps/settings/folders.inc +++ b/roundcubemail/program/steps/settings/folders.inc @@ -278,9 +278,6 @@ function rcube_subscription_form($attrib) $display_folder = str_repeat(' ', $folder['level']) . Q($protected ? rcmail_localize_foldername($folder['id']) : $folder['name']); - if ($sub_key !== false) - unset($a_subscribed[$sub_key]); - if ($folder['virtual']) { $classes[] = 'virtual'; } @@ -329,11 +326,6 @@ function rcube_subscription_form($attrib) Q($display_folder), $protected || $folder['virtual']); } - // Unsubscribe from non-existing folders - foreach ($a_subscribed as $folder) { - $IMAP->unsubscribe($folder); - } - $RCMAIL->plugins->exec_hook('folders_list', array('table' => $table)); $OUTPUT->add_gui_object('subscriptionlist', $attrib['id']); |
