From a4f77800443173a73ff05a172ac6b0dd4d5e9a42 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 05 Mar 2010 07:57:58 -0500
Subject: [PATCH] - Fix check_recent action when skip_deleted=true (#1486535)

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

diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 307914e..66e6fa7 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -515,6 +515,9 @@
       // not very performant but more precise (using UNDELETED)
       $index = $this->_search_index($mailbox, $search_str);
       $count = is_array($index) ? count($index) : 0;
+
+      if ($mode == 'ALL')
+        $_SESSION['maxuid'][$mailbox] = $index ? $this->_id2uid(max($index)) : 0;
       }
     else {
       if ($mode == 'UNSEEN')
@@ -1793,7 +1796,7 @@
     // move messages
     $iil_move = iil_C_Move($this->conn, join(',', $a_uids), $from_mbox, $to_mbox);
     $moved = !($iil_move === false || $iil_move < 0);
-    
+
     // send expunge command in order to have the moved message
     // really deleted from the source mailbox
     if ($moved) {
@@ -1802,8 +1805,8 @@
       $this->_clear_messagecount($to_mbox);
     }
     // moving failed
-    else if (rcmail::get_instance()->config->get('delete_always', false)) {
-      return iil_C_Delete($this->conn, $from_mbox, join(',', $a_uids));
+    else if ($config->get('delete_always', false) && $tbox == $config->get('trash_mbox')) {
+      return $this->delete_message($a_uids, $fbox);
     }
 
     // remove message ids from search set

--
Gitblit v1.9.1