From a3644638aaf0418598196a870204e0b632a4c8ad Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Fri, 17 Apr 2015 06:28:40 -0400
Subject: [PATCH] Allow preference sections to define CSS class names

---
 program/steps/mail/move_del.inc |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc
index 9c1acd5..4c57d6f 100644
--- a/program/steps/mail/move_del.inc
+++ b/program/steps/mail/move_del.inc
@@ -27,6 +27,7 @@
 $threading = (bool) $RCMAIL->storage->get_threading();
 $old_count = $RCMAIL->storage->count(NULL, $threading ? 'THREADS' : 'ALL');
 $old_pages = ceil($old_count / $RCMAIL->storage->get_pagesize());
+$sources   = array();
 
 $trash  = $RCMAIL->config->get('trash_mbox');
 
@@ -36,12 +37,13 @@
     $trash  = $RCMAIL->config->get('trash_mbox');
 
     $success = true;
-    foreach (rcmail::get_uids() as $mbox => $uids) {
-        if ($mbox == $target) {
+    foreach (rcmail::get_uids(null, null, $multifolder) as $mbox => $uids) {
+        if ($mbox === $target) {
             $count += count($uids);
         }
         else if ($RCMAIL->storage->move_message($uids, $target, $mbox)) {
             $count += count($uids);
+            $sources[] = $mbox;
         }
         else {
             $success = false;
@@ -69,10 +71,11 @@
     }
 }
 // delete messages 
-else if ($RCMAIL->action=='delete' && !empty($_POST['_uid'])) {
-    foreach (rcmail::get_uids() as $mbox => $uids) {
-        $del += (int)$RCMAIL->storage->delete_message($uids, $mbox);
-        $count += count($uids);
+else if ($RCMAIL->action == 'delete' && !empty($_POST['_uid'])) {
+    foreach (rcmail::get_uids(null, null, $multifolder) as $mbox => $uids) {
+        $del      += (int)$RCMAIL->storage->delete_message($uids, $mbox);
+        $count    += count($uids);
+        $sources[] = $mbox;
     }
 
     if (!$del) {
@@ -146,7 +149,7 @@
     rcmail_send_unread_count($target, true);
   }
 
-  $OUTPUT->command('set_quota', $RCMAIL->quota_content());
+  $OUTPUT->command('set_quota', $RCMAIL->quota_content(null, $multifolder ? $sources[0] : 'INBOX'));
   $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count), $mbox);
 
   if ($threading) {
@@ -166,7 +169,7 @@
       $OUTPUT->command('set_trash_count', $exists);
   }
   else if ($target !== null && $target === $trash) {
-      $OUTPUT->command('set_trash_count', $RCMAIL->storage->count($trash, 'EXISTS'));
+      $OUTPUT->command('set_trash_count', $RCMAIL->storage->count($trash, 'EXISTS', true));
   }
 }
 

--
Gitblit v1.9.1