From: Michael M Slusarz Date: Fri, 4 Dec 2009 08:18:36 +0000 (-0700) Subject: Do virtual folder rebuilding in add/remove poll functions X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=c2b87c0912141e8580f69ca10ec3bdd80057e11b;p=horde.git Do virtual folder rebuilding in add/remove poll functions --- diff --git a/imp/folders.php b/imp/folders.php index 9209a061a..65f9b1e78 100644 --- a/imp/folders.php +++ b/imp/folders.php @@ -214,10 +214,14 @@ case 'toggle_subscribed_view': break; case 'poll_folder': + if (!empty($folder_list)) { + $imaptree->addPollList($folder_list); + } + break; + case 'nopoll_folder': if (!empty($folder_list)) { - ($actionID == 'poll_folder') ? $imaptree->addPollList($folder_list) : $imaptree->removePollList($folder_list); - $imp_search->createVINBOXFolder(); + $imaptree->removePollList($folder_list); } break; diff --git a/imp/lib/Imap/Tree.php b/imp/lib/Imap/Tree.php index ceed6b5be..7a6b39d4d 100644 --- a/imp/lib/Imap/Tree.php +++ b/imp/lib/Imap/Tree.php @@ -1201,17 +1201,26 @@ class IMP_Imap_Tree return; } + $changed = false; + $imp_folder = IMP_Folder::singleton(); $this->getPollList(); foreach ($id as $val) { if (!$this->isSubscribed($this->_tree[$val])) { $imp_folder->subscribe(array($val)); } - $this->_poll[$val] = true; $this->_setPolled($this->_tree[$val], true); + if (empty($this->_poll[$val])) { + $this->_poll[$val] = true; + $changed = true; + } + } + + if ($changed) { + $GLOBALS['prefs']->setValue('nav_poll', serialize($this->_poll)); + $GLOBALS['imp_search']->createVINBOXFolder(); + $this->_changed = true; } - $GLOBALS['prefs']->setValue('nav_poll', serialize($this->_poll)); - $this->_changed = true; } /** @@ -1245,6 +1254,7 @@ class IMP_Imap_Tree if ($removed) { $GLOBALS['prefs']->setValue('nav_poll', serialize($this->_poll)); + $GLOBALS['imp_search']->createVINBOXFolder(); $this->_changed = true; } }