From 1fc6efae4658fe3aa6227f8dd9d9550c65447d4e Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Sun, 12 Sep 2010 22:14:00 -0600 Subject: [PATCH] Move update poll preference code to a single location --- imp/lib/Imap/Tree.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/imp/lib/Imap/Tree.php b/imp/lib/Imap/Tree.php index 2d6da34c2..28f6419cc 100644 --- a/imp/lib/Imap/Tree.php +++ b/imp/lib/Imap/Tree.php @@ -1029,9 +1029,7 @@ class IMP_Imap_Tree implements ArrayAccess, Iterator, Serializable } if ($changed) { - $GLOBALS['prefs']->setValue('nav_poll', serialize($this->_cache['poll'])); - $GLOBALS['injector']->getInstance('IMP_Search')->createVINBOXFolder(); - $this->changed = true; + $this->_updatePollList(); } } @@ -1065,13 +1063,21 @@ class IMP_Imap_Tree implements ArrayAccess, Iterator, Serializable } if ($removed) { - $GLOBALS['prefs']->setValue('nav_poll', serialize($this->_cache['poll'])); - $GLOBALS['injector']->getInstance('IMP_Search')->createVINBOXFolder(); - $this->changed = true; + $this->_updatePollList(); } } /** + * Update the nav_poll preference. + */ + protected function _updatePollList() + { + $GLOBALS['prefs']->setValue('nav_poll', serialize($this->_cache['poll'])); + $GLOBALS['injector']->getInstance('IMP_Search')->createVInbox(); + $this->changed = true; + } + + /** * Does the user want to poll this mailbox for new/unseen messages? * * @param array $elt A tree element. -- 2.11.0