diff options
author | alecpl <alec@alec.pl> | 2011-07-26 13:22:11 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2011-07-26 13:22:11 +0000 |
commit | 210438a6be905b25991a88c28fcbfbfa09ad0034 (patch) | |
tree | bcfdc39bd19fa68e6b699b59020405af5db9f2bd /program/steps/settings | |
parent | 79dd1692e3f109062e51cb5bb14ae67709276bf2 (diff) |
- Unsubscribe from non-existing folders automaticly on folders listing
Diffstat (limited to 'program/steps/settings')
-rw-r--r-- | program/steps/settings/folders.inc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc index 982b21a12..6a773df84 100644 --- a/program/steps/settings/folders.inc +++ b/program/steps/settings/folders.inc @@ -267,7 +267,8 @@ function rcube_subscription_form($attrib) // create list of available folders foreach ($list_folders as $i => $folder) { $idx = $i + 1; - $subscribed = in_array($folder['id'], $a_subscribed); + $sub_key = array_search($folder['id'], $a_subscribed); + $subscribed = $sub_key !== false; $protected = ($CONFIG['protect_default_folders'] == true && in_array($folder['id'], $CONFIG['default_imap_folders'])); $noselect = false; $classes = array($i%2 ? 'even' : 'odd'); @@ -277,6 +278,9 @@ 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'; } @@ -325,6 +329,11 @@ 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']); |