From cc95700b58f31f04470db8271a09d6e52ba9a63d Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Sun, 05 Feb 2006 10:38:51 -0500
Subject: [PATCH] Added message cache garbage collector

---
 program/include/rcube_imap.inc |   30 ++++++++++++++++++++++++++++--
 1 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc
index 7f91d3a..cb6b409 100644
--- a/program/include/rcube_imap.inc
+++ b/program/include/rcube_imap.inc
@@ -986,8 +986,18 @@
     
     if ($msg_count>0)
       {
-      $this->clear_message_cache($mailbox.'.msg');
-      return iil_C_ClearFolder($this->conn, $mailbox);
+      $cleared = iil_C_ClearFolder($this->conn, $mailbox);
+      
+      // make sure the message count cache is cleared as well
+      if ($cleared)
+        {
+        $this->clear_message_cache($mailbox.'.msg');      
+        $a_mailbox_cache = $this->get_cache('messagecount');
+        unset($a_mailbox_cache[$mailbox]);
+        $this->update_cache('messagecount', $a_mailbox_cache);
+        }
+        
+      return $cleared;
       }
     else
       return 0;
@@ -1047,6 +1057,22 @@
     }
 
 
+  /**
+   * Get quota
+   * added by Nuny
+   */
+  function get_quota()
+    {
+    if ($this->get_capability('QUOTA'))
+      {
+      $result = iil_C_GetQuota($this->conn);
+      return sprintf("%.2fMB / %.2fMB (%.0f%%)", $result["used"] / 1000.0, $result["total"] / 1000.0, $result["percent"]);
+      }
+    else
+      return 'unknown';
+    }
+
+
   // subscribe to a specific mailbox(es)
   function subscribe($mbox, $mode='subscribe')
     {

--
Gitblit v1.9.1