From 7ae46f2b1dd87a0bdc046e1a0d12fbf3ca141c14 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Thu, 09 Oct 2008 05:48:10 -0400
Subject: [PATCH] - fixed iil_C_Sort() to support very long and/or divided responses (#1485283)

---
 CHANGELOG            |    4 ++++
 program/lib/imap.inc |    7 +++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index d43c474..4a0e8a5 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,10 @@
 CHANGELOG RoundCube Webmail
 ---------------------------
 
+2008/10/09 (alec)
+----------
+- fixed iil_C_Sort() to support very long and/or divided responses (#1485283)
+
 2008/10/08 (alec)
 ----------
 - Fix imap searching on ISMail server (#1485466)
diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index 9817368..c78e67a 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -67,6 +67,7 @@
 		- remove 'undisclosed-recipients' string from 'To' header
 		- iil_C_HandlePartBody(): added 6th argument and fixed endless loop
 		- added iil_PutLineC() 
+		- fixed iil_C_Sort() to support very long and/or divided responses
 
 ********************************************************/
 
@@ -912,8 +913,10 @@
 	do {
 		$line = chop(iil_ReadLine($fp, 1024));
 		if (iil_StartsWith($line, '* SORT')) {
-			$data .= ($data?' ':'') . substr($line, 7);
-    		}
+			$data .= ($data ? ' ' : '') . substr($line, 7);
+    		} else if (preg_match('/^[0-9 ]+$/', $line)) {
+			$data .= $line;
+		}
 	} while ($line[0]!='s');
 	
 	if (empty($data)) {

--
Gitblit v1.9.1