Index: /trunk/roundcubemail/CHANGELOG
===================================================================
--- /trunk/roundcubemail/CHANGELOG	(revision 2016)
+++ /trunk/roundcubemail/CHANGELOG	(revision 2017)
@@ -1,4 +1,9 @@
 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)
Index: /trunk/roundcubemail/program/steps/mail/move_del.inc
===================================================================
--- /trunk/roundcubemail/program/steps/mail/move_del.inc	(revision 2016)
+++ /trunk/roundcubemail/program/steps/mail/move_del.inc	(revision 2017)
@@ -29,4 +29,9 @@
     $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);
   
@@ -38,8 +43,4 @@
         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'])
