From eaa1856a943143e79040a27c2938bf753d1f2cff Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Fri, 29 May 2009 14:05:26 -0600 Subject: [PATCH] Bug #8305: Fix flagging in Virtual Inbox --- imp/lib/Mailbox.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/imp/lib/Mailbox.php b/imp/lib/Mailbox.php index 29232529f..014ad5341 100644 --- a/imp/lib/Mailbox.php +++ b/imp/lib/Mailbox.php @@ -98,11 +98,30 @@ class IMP_Mailbox $this->_searchmbox = $GLOBALS['imp_search']->isSearchMbox($mailbox); if (!is_null($index)) { + /* Try to rebuild sorted information from the session cache. */ + if (isset($_SESSION['imp']['cache']['imp_mailbox'][$mailbox])) { + $tmp = unserialize($_SESSION['imp']['cache']['imp_mailbox'][$mailbox]); + $this->_sorted = $tmp['s']; + $this->_sortedInfo = $tmp['i']; + } $this->setIndex($index); } } /** + * Cache mailbox information if viewing in standard (IMP) message mode. + * Needed to keep navigation consistent when moving through the message + * list, and to ensure messages aren't marked as missing in search + * mailboxes (e.g. if search is dependent on unseen flag). + */ + public function __destruct() + { + if (!is_null($this->_arrayIndex)) { + $_SESSION['imp']['cache']['imp_mailbox'][$this->_mailbox] = serialize(array('i' => $this->_sortedInfo, 's' => $this->_sorted)); + } + } + + /** * The mailbox this object works with. * * @return string A mailbox name. -- 2.11.0