diff options
author | Thomas Bruederli <thomas@roundcube.net> | 2014-01-16 09:04:34 +0100 |
---|---|---|
committer | Thomas Bruederli <thomas@roundcube.net> | 2014-01-16 09:04:34 +0100 |
commit | 5740b10bf8cdb82f795d88e1f020440c8dae4acb (patch) | |
tree | c22be085ae5ee2ebdcb50a0c4232998b5b5216f6 /program/lib/Roundcube/rcube_result_thread.php | |
parent | 3786a48aeb27b0ee54694103e0c19808a62ff5e0 (diff) | |
parent | 531c4d896c6fda2e979e219633078c95b95d83c0 (diff) |
Merge branch 'master' of github.com:roundcube/roundcubemail
Diffstat (limited to 'program/lib/Roundcube/rcube_result_thread.php')
-rw-r--r-- | program/lib/Roundcube/rcube_result_thread.php | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/program/lib/Roundcube/rcube_result_thread.php b/program/lib/Roundcube/rcube_result_thread.php index 7657550be..c7f21db53 100644 --- a/program/lib/Roundcube/rcube_result_thread.php +++ b/program/lib/Roundcube/rcube_result_thread.php @@ -606,33 +606,39 @@ class rcube_result_thread // arrays handling is much more expensive // For the following structure: THREAD (2)(3 6 (4 23)(44 7 96)) // -- 2 - // // -- 3 // \-- 6 // |-- 4 // | \-- 23 // | // \-- 44 - // \-- 7 - // \-- 96 + // \-- 7 + // \-- 96 // // The output will be: 2,3^1:6^2:4^3:23^2:44^3:7^4:96 if ($str[$begin] != '(') { - $stop = $begin + strspn($str, '1234567890', $begin, $end - $begin); - $msg = substr($str, $begin, $stop - $begin); - if (!$msg) { + // find next bracket + $stop = $begin + strcspn($str, '()', $begin, $end - $begin); + $messages = explode(' ', trim(substr($str, $begin, $stop - $begin))); + + if (empty($messages)) { return $node; } - $this->meta['messages']++; - - $node .= ($depth ? self::SEPARATOR_ITEM.$depth.self::SEPARATOR_LEVEL : '').$msg; + foreach ($messages as $msg) { + if ($msg) { + $node .= ($depth ? self::SEPARATOR_ITEM.$depth.self::SEPARATOR_LEVEL : '').$msg; + $this->meta['messages']++; + $depth++; + } + } - if ($stop + 1 < $end) { - $node .= $this->parse_thread($str, $stop + 1, $end, $depth + 1); + if ($stop < $end) { + $node .= $this->parse_thread($str, $stop, $end, $depth); } - } else { + } + else { $off = $begin; while ($off < $end) { $start = $off; @@ -649,7 +655,8 @@ class rcube_result_thread if ($p1 !== false && $p1 < $p) { $off = $p1 + 1; $n++; - } else { + } + else { $off = $p + 1; $n--; } |