From e5e2190e4e7a831df432fe370b7dd0715029a0b9 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 11 Nov 2012 06:27:25 -0500
Subject: [PATCH] Fix bug where leading blanks were stripped from quoted lines (#1488795)

---
 CHANGELOG                   |    1 +
 program/steps/mail/func.inc |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 5bfe9b3..beced8e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Fix bug where leading blanks were stripped from quoted lines (#1488795)
 - Upgraded to jQuery 1.8.2 and jQuery UI 1.9.1
 - Add config option to automatically generate LDAP attributes for new entries
 - Better client-side timezone detection using the jsTimezoneDetect library (#1488725)
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index f128a38..a1dfa28 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -801,8 +801,8 @@
 
   // find/mark quoted lines...
   for ($n=0, $cnt=count($body); $n < $cnt; $n++) {
-    if ($body[$n][0] == '>' && preg_match('/^(>+\s*)+/', $body[$n], $regs)) {
-      $q = strlen(preg_replace('/\s/', '', $regs[0]));
+    if ($body[$n][0] == '>' && preg_match('/^(>+ {0,1})+/', $body[$n], $regs)) {
+      $q        = substr_count($regs[0], '>');
       $body[$n] = substr($body[$n], strlen($regs[0]));
 
       if ($q > $quote_level) {

--
Gitblit v1.9.1