From 28674a848ab4974eccf952dfe2271a80e4d536c4 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 17 Jun 2009 14:01:07 -0400
Subject: [PATCH] - fix bug in delete_mailbox when deleting many folders

---
 program/include/rcube_imap.php |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index e7f72ee..7905894 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -1963,7 +1963,7 @@
   /**
    * Remove mailboxes from server
    *
-   * @param string Mailbox name
+   * @param string Mailbox name(s) string/array
    * @return boolean True on success
    */
   function delete_mailbox($mbox_name)
@@ -1987,9 +1987,11 @@
 
         // send delete command to server
         $result = iil_C_DeleteFolder($this->conn, $mailbox);
-        if ($result>=0)
+        if ($result >= 0) {
           $deleted = TRUE;
-
+          $this->clear_message_cache($mailbox.'.msg');
+	  }
+	  
         foreach ($all_mboxes as $c_mbox)
           {
           $regex = preg_quote($mailbox . $this->delimiter, '/');
@@ -1998,18 +2000,17 @@
             {
             iil_C_UnSubscribe($this->conn, $c_mbox);
             $result = iil_C_DeleteFolder($this->conn, $c_mbox);
-            if ($result>=0)
+            if ($result >= 0) {
               $deleted = TRUE;
-            }
+    	      $this->clear_message_cache($c_mbox.'.msg');
+              }
+	    }
           }
         }
 
     // clear mailboxlist cache
     if ($deleted)
-      {
-      $this->clear_message_cache($mailbox.'.msg');
       $this->clear_cache('mailboxes');
-      }
 
     return $deleted;
     }

--
Gitblit v1.9.1