From 55d90b2f621a9c144b54b07b4e1dafd0fdad0e85 Mon Sep 17 00:00:00 2001
From: Bostjan Skufca <bostjan@a2o.si>
Date: Sun, 10 Apr 2016 04:50:53 -0400
Subject: [PATCH] mailbox/listing: Make server response for large mailbox listing faster when using threaded view

---
 program/lib/Roundcube/rcube_result_thread.php |   18 +++---------------
 1 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/program/lib/Roundcube/rcube_result_thread.php b/program/lib/Roundcube/rcube_result_thread.php
index 1687616..7123f47 100644
--- a/program/lib/Roundcube/rcube_result_thread.php
+++ b/program/lib/Roundcube/rcube_result_thread.php
@@ -252,22 +252,10 @@
             return;
         }
 
+        $raw_data_reverse = implode(self::SEPARATOR_ELEMENT, array_reverse(explode(self::SEPARATOR_ELEMENT, $this->raw_data)));
+        $this->raw_data = $raw_data_reverse;
+
         $this->meta['pos'] = array();
-        $datalen = strlen($this->raw_data);
-        $result  = '';
-        $start   = 0;
-
-        while (($pos = @strpos($this->raw_data, self::SEPARATOR_ELEMENT, $start))
-            || ($start < $datalen && ($pos = $datalen))
-        ) {
-            $len   = $pos - $start;
-            $elem  = substr($this->raw_data, $start, $len);
-            $start = $pos + 1;
-
-            $result = $elem . self::SEPARATOR_ELEMENT . $result;
-        }
-
-        $this->raw_data = rtrim($result, self::SEPARATOR_ELEMENT);
     }
 
 

--
Gitblit v1.9.1