From 2855518f1d189a715cf79b1e2c944e9b5dcd539f Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Mon, 27 Oct 2008 06:41:40 -0400
Subject: [PATCH] - Fix unread message unintentionally marked as read if read_when_deleted=true (#1485409)

---
 CHANGELOG                       |    5 +++++
 program/steps/mail/move_del.inc |    9 +++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index e08ace0..6c1d90e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,11 @@
 CHANGELOG RoundCube Webmail
 ---------------------------
 
+2008/10/27 (alec)
+----------
+- Fix unread message unintentionally marked as read if read_when_deleted=true (#1485409)
+- Remove port number from SERVER_NAME in smtp_helo_host (#1485518)
+
 2008/10/25 (alec)
 ----------
 - Don't send disposition notification receipts for messages marked as 'read' (#1485523)
diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc
index c8db35b..7dd4489 100644
--- a/program/steps/mail/move_del.inc
+++ b/program/steps/mail/move_del.inc
@@ -28,6 +28,11 @@
     $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST))));
     $target = get_input_value('_target_mbox', RCUBE_INPUT_POST);
     $mbox = get_input_value('_mbox', RCUBE_INPUT_POST);
+
+    // flag messages as read before moving them
+    if ($CONFIG['read_when_deleted'])
+	$IMAP->set_flag($uids, 'SEEN');
+
     $moved = $IMAP->move_message($uids, $target, $mbox);
   
     if (!$moved) {
@@ -37,10 +42,6 @@
         $OUTPUT->send();
         exit;
     }
-
-    // flag old messages as read because rcube_imap will not send expunge command after moving
-    if ($CONFIG['read_when_deleted'])
-        $IMAP->set_flag($uids, 'SEEN');
 
     if (!$CONFIG['flag_for_deletion'])
         $addrows = true;

--
Gitblit v1.9.1