From 3bfab3b99c5098e802b10a1d442c330af3524249 Mon Sep 17 00:00:00 2001
From: till <till@php.net>
Date: Mon, 26 May 2008 06:11:19 -0400
Subject: [PATCH] fix to #1485083

---
 program/lib/imap.inc |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index e97f818..8ea4fbd 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -1907,7 +1907,9 @@
     
 	if (iil_C_Select($conn, $mailbox)) {
 		$c = 0;
-		fputs($fp, "flg STORE $messages " . $mod . "FLAGS (" . $flag . ")\r\n");
+                $_line = "flg STORE $messages " . $mod . "FLAGS (" . $flag . ")\r\n";
+                trigger_error($_line, E_USER_WARNING);
+		fputs($fp, $_line);
 		do {
 			$line=chop(iil_ReadLine($fp, 100));
 			if ($line[0] == '*') {
@@ -2046,16 +2048,21 @@
 }
 
 function iil_C_Move(&$conn, $messages, $from, $to) {
-	$fp = $conn->fp;
-	
-	if (!$from || !$to) {
-	    return -1;
-	}
-    
-	$r = iil_C_Copy($conn, $messages, $from,$to);
-	if ($r==0) {
-		return iil_C_Delete($conn, $from, $messages);
-	}
+    global $CONFIG;
+
+    $fp = $conn->fp;
+
+    if (!$from || !$to) {
+        return -1;
+    }
+    $r = iil_C_Copy($conn, $messages, $from,$to);
+    if ($r==0) {
+        return iil_C_Delete($conn, $from, $messages);
+    }
+    // Copy failed
+    if (isset($CONFIG['delete_always']) && $CONFIG['delete_always'] === true) {
+        return iil_C_Delete($conn, $from, $messages);
+    }
     return $r;
 }
 

--
Gitblit v1.9.1