From 803b1b7e340b741e02a1dc72da824384db353751 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 08 Apr 2009 02:21:43 -0400
Subject: [PATCH] - Fix opening attachment marks message as read (#1485803)

---
 CHANGELOG            |    1 +
 program/lib/imap.inc |    6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index e3742c2..23606e0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG RoundCube Webmail
 ===========================
 
+- Fix opening attachment marks message as read (#1485803)
 - Fix 'temp_dir' does not support relative path under Windows (#1484529)
 - Fix "Initialize Database" button missing from installer (#1485802)
 - Fix compose window doesn't fit 1024x768 window (#1485396)
diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index 67a2b7b..394a190 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -2433,7 +2433,7 @@
 
 	// format request
 	foreach($parts as $part)
-		$peeks[] = "BODY[$part.MIME]";
+		$peeks[] = "BODY.PEEK[$part.MIME]";
 	
 	$request = "$key FETCH $id (" . implode(' ', $peeks) . ')';
 
@@ -2446,9 +2446,9 @@
         	$line = iil_ReadLine($fp, 1000);
         	$line = iil_MultLine($fp, $line);
 
-		if (preg_match('/BODY\[([0-9\.]+)\.MIME\]/', $line, $matches)) {
+		if (preg_match('/BODY\.PEEK\[([0-9\.]+)\.MIME\]/', $line, $matches)) {
 			$idx = $matches[1];
-			$result[$idx] = preg_replace('/^(\* '.$id.' FETCH \()?\s*BODY\['.$idx.'\.MIME\]\s+/', '', $line);
+			$result[$idx] = preg_replace('/^(\* '.$id.' FETCH \()?\s*BODY\.PEEK\['.$idx.'\.MIME\]\s+/', '', $line);
 			$result[$idx] = trim($result[$idx], '"');
 	    		$result[$idx] = rtrim($result[$idx], "\t\r\n\0\x0B");
     		}

--
Gitblit v1.9.1