From 4a63f1efaff83dd03e663ed1a432a15dc0100be3 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Mon, 07 Sep 2009 03:53:01 -0400
Subject: [PATCH] - Fix roundcube hangs on empty inbox with bincimapd (#1486093)

---
 program/lib/imap.inc |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index 02c9bd9..c640c56 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -1510,11 +1510,11 @@
 				preg_match('/ BODY\[HEADER.FIELDS \(.*?\)\]\s*(.*)$/s', $line, $m);
 				$reslines = explode("\n", trim($m[1], '"'));
 				// re-parse (see below)
-				foreach ($reslines as $line) {
-					if (ord($line[0])<=32) {
-						$lines[$ln] .= (empty($lines[$ln])?'':"\n").trim($line);
+				foreach ($reslines as $resln) {
+					if (ord($resln[0])<=32) {
+						$l[$ln] .= (empty($lines[$ln])?'':"\n").trim($resln);
 					} else {
-						$lines[++$ln] = trim($line);
+						$lines[++$ln] = trim($resln);
 					}
 				}
 			}
@@ -1668,7 +1668,7 @@
 				}
 			}
 		}
-	} while (strcmp($a[0], $key) != 0);
+	} while (!iil_StartsWith($line, $key, true));
 
 	return $result;
 }

--
Gitblit v1.9.1