From 64e3e80743415e5fb121eb5c66416593c38ef288 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Tue, 08 Jun 2010 08:46:05 -0400
Subject: [PATCH] - Fix some IMAP errors handling when opening the message (#1485443)

---
 program/include/rcube_imap_generic.php |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/program/include/rcube_imap_generic.php b/program/include/rcube_imap_generic.php
index d5a5e3d..7669ceb 100644
--- a/program/include/rcube_imap_generic.php
+++ b/program/include/rcube_imap_generic.php
@@ -1777,12 +1777,11 @@
 		    	$mode = 0;
 	    }
 
-   		$reply_key = '* ' . $id;
-    	$result = false;
-
     	// format request
-		$key     = 'ftch0';
-		$request = $key . ($is_uid ? ' UID' : '') . " FETCH $id (BODY.PEEK[$part])";
+   		$reply_key = '* ' . $id;
+		$key       = 'ftch0';
+		$request   = $key . ($is_uid ? ' UID' : '') . " FETCH $id (BODY.PEEK[$part])";
+
     	// send request
 		if (!$this->putLine($request)) {
 		    return false;
@@ -1794,7 +1793,8 @@
        		$a    = explode(' ', $line);
    		} while (!($end = $this->startsWith($line, $key, true)) && $a[2] != 'FETCH');
 
-   		$len = strlen($line);
+   		$len    = strlen($line);
+    	$result = false;
 
 		// handle empty "* X FETCH ()" response
     	if ($line[$len-1] == ')' && $line[$len-2] != '(') {
@@ -1890,7 +1890,7 @@
         			$line = $this->readLine(1024);
 			} while (!$this->startsWith($line, $key, true));
 
-   		if ($result) {
+   		if ($result !== false) {
 	    	if ($file) {
 		    	fwrite($file, $result);
    			} else if ($print) {

--
Gitblit v1.9.1