From 9e63cd5f24defa521724dfe3dcbbaa4385761836 Mon Sep 17 00:00:00 2001
From: Thomas <tb@woodcrest.local>
Date: Wed, 09 Oct 2013 11:12:30 -0400
Subject: [PATCH] Support globally unique message UIDs with IMAP folder name appended

---
 program/steps/mail/mark.inc |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/program/steps/mail/mark.inc b/program/steps/mail/mark.inc
index dfc892e..fad11d0 100644
--- a/program/steps/mail/mark.inc
+++ b/program/steps/mail/mark.inc
@@ -32,7 +32,7 @@
 
 $threading = (bool) $RCMAIL->storage->get_threading();
 
-if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_value('_flag', RCUBE_INPUT_POST)))
+if (($_uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_value('_flag', RCUBE_INPUT_POST)))
 {
   $flag = $a_flags_map[$flag] ? $a_flags_map[$flag] : strtoupper($flag);
 
@@ -40,10 +40,12 @@
     // count messages before changing anything
     $old_count = $RCMAIL->storage->count(NULL, $threading ? 'THREADS' : 'ALL');
     $old_pages = ceil($old_count / $RCMAIL->storage->get_pagesize());
-    $count = sizeof(explode(',', $uids));
   }
 
-  $marked = $RCMAIL->storage->set_flag($uids, $flag);
+  foreach (rcmail_get_uids() as $mbox => $uids) {
+    $marked += (int)$RCMAIL->storage->set_flag($uids, $flag, $mbox);
+    $count += count($uids);
+  }
 
   if (!$marked) {
     // send error message
@@ -117,7 +119,7 @@
       }
 
       // add new rows from next page (if any)
-      if ($count && $uids != '*' && ($jump_back || $nextpage_count > 0)) {
+      if ($old_count && $_uids != '*' && ($jump_back || $nextpage_count > 0)) {
         $a_headers = $RCMAIL->storage->list_messages($mbox, NULL,
           rcmail_sort_column(), rcmail_sort_order(), $jump_back ? NULL : $count);
 

--
Gitblit v1.9.1