From b595c9fcf6940ae25c1e58ef2b8d340405083906 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Sun, 06 Nov 2005 19:32:57 -0500
Subject: [PATCH] Minor bugfixes

---
 program/include/rcube_imap.inc |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc
index 8253442..44ef248 100644
--- a/program/include/rcube_imap.inc
+++ b/program/include/rcube_imap.inc
@@ -464,6 +464,7 @@
 		
     // sort headers by a specific col
     $a_headers = iil_SortHeaders($a_msg_headers, $sort_field, $sort_order);
+    $headers_count = count($a_headers);
 
 	// free memory
 	unset($a_msg_headers);
@@ -471,6 +472,14 @@
     // write headers list to cache
     if (!$headers_cached)
       $this->update_cache($mailbox.'.msg', $a_headers);
+      
+    // update message count cache
+    $a_mailbox_cache = $this->get_cache('messagecount');
+    if (isset($a_mailbox_cache[$mailbox]['ALL']) && $a_mailbox_cache[$mailbox]['ALL'] != $headers_count)
+      {
+      $a_mailbox_cache[$mailbox]['ALL'] = (int)$headers_count;
+      $this->update_cache('messagecount', $a_mailbox_cache);
+      }
 
 	if (empty($a_headers))
 		return array();

--
Gitblit v1.9.1