From 7e1542241608ab7f4b5329703507c578d81bf813 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Thu, 27 Aug 2009 05:22:34 -0400
Subject: [PATCH] - Fix Date sorting problem with Courier IMAP server (#1486065)

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

diff --git a/CHANGELOG b/CHANGELOG
index 9759bf7..26b946a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG RoundCube Webmail
 ===========================
 
+- Fix date sorting problem with Courier IMAP server (#1486065)
 - Unselect pressed buttons on mouse up (#1485987)
 - Don't set php_value error_log in .htaccess but mention in INSTALL (#1485924)
 - Fix too small status/flag/attachment columns in Safari 4 (#1486063)
diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index f067675..ce778b2 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -988,7 +988,7 @@
 			}
 
 			if ($mode == 1) {
-				if (preg_match('/BODY\[HEADER\.FIELDS \((DATE|FROM|REPLY-TO|SENDER|TO|SUBJECT)\)\] (.*)/', $line, $matches)) {
+				if (preg_match('/BODY\[HEADER\.FIELDS \("?(DATE|FROM|REPLY-TO|SENDER|TO|SUBJECT)"?\)\] (.*)/', $line, $matches)) {
 					$value = preg_replace(array('/^"*[a-z]+:/i', '/\s+$/sm'), array('', ''), $matches[2]);
 					$value = trim($value);
 					if ($index_field == 'DATE') {

--
Gitblit v1.9.1