From 3f4521bcf4b538b6ac54817cfad22b51e347546d Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Wed, 17 Jun 2015 03:03:03 -0400 Subject: [PATCH] Fix so plain text signature field uses monospace font (#1490435) --- program/lib/Roundcube/rcube_result_multifolder.php | 56 ++++++++++++++++++++++++++++++++------------------------ 1 files changed, 32 insertions(+), 24 deletions(-) diff --git a/program/lib/Roundcube/rcube_result_multifolder.php b/program/lib/Roundcube/rcube_result_multifolder.php index e5abead..786ee85 100644 --- a/program/lib/Roundcube/rcube_result_multifolder.php +++ b/program/lib/Roundcube/rcube_result_multifolder.php @@ -26,16 +26,16 @@ */ class rcube_result_multifolder { - public $multi = true; - public $sets = array(); + public $multi = true; + public $sets = array(); public $incomplete = false; public $folder; - protected $meta = array(); - protected $index = array(); + protected $meta = array(); + protected $index = array(); protected $folders = array(); + protected $order = 'ASC'; protected $sorting; - protected $order = 'ASC'; /** @@ -44,7 +44,7 @@ public function __construct($folders = array()) { $this->folders = $folders; - $this->meta = array('count' => 0); + $this->meta = array('count' => 0); } @@ -57,17 +57,26 @@ { $this->sets[] = $result; - if ($count = $result->count()) { - $this->meta['count'] += $count; - - // append UIDs to global index - $folder = $result->get_parameters('MAILBOX'); - $index = array_map(function($uid) use ($folder) { return $uid . '-' . $folder; }, $result->get()); - $this->index = array_merge($this->index, $index); + if ($result->count()) { + $this->append_result($result); } else if ($result->incomplete) { $this->incomplete = true; } + } + + /** + * Append message UIDs from the given result to our index + */ + protected function append_result($result) + { + $this->meta['count'] += $result->count(); + + // append UIDs to global index + $folder = $result->get_parameters('MAILBOX'); + $index = array_map(function($uid) use ($folder) { return $uid . '-' . $folder; }, $result->get()); + + $this->index = array_merge($this->index, $index); } /** @@ -81,7 +90,7 @@ } $this->sorting = $sort_field; - $this->order = $sort_order; + $this->order = $sort_order; } /** @@ -142,8 +151,10 @@ if ($this->order != $set->get_parameters('ORDER')) { $set->revert(); } + $folder = $set->get_parameters('MAILBOX'); - $index = array_map(function($uid) use ($folder) { return $uid . '-' . $folder; }, $set->get()); + $index = array_map(function($uid) use ($folder) { return $uid . '-' . $folder; }, $set->get()); + $this->index = array_merge($this->index, $index); } } @@ -163,6 +174,7 @@ if (!empty($this->folder)) { $msgid .= '-' . $this->folder; } + return array_search($msgid, $this->index); } @@ -180,6 +192,7 @@ if ($set->get_parameters('MAILBOX') == $folder) { $set->filter($ids); } + $this->meta['count'] += $set->count(); } } @@ -259,8 +272,8 @@ public function get_parameters($param=null) { $params = array( - 'SORT' => $this->sorting, - 'ORDER' => $this->order, + 'SORT' => $this->sorting, + 'ORDER' => $this->order, 'MAILBOX' => $this->folders, ); @@ -312,13 +325,8 @@ $this->meta = array('count' => 0); foreach ($this->sets as $result) { - if ($count = $result->count()) { - $this->meta['count'] += $count; - - // append UIDs to global index - $folder = $result->get_parameters('MAILBOX'); - $index = array_map(function($uid) use ($folder) { return $uid . '-' . $folder; }, $result->get()); - $this->index = array_merge($this->index, $index); + if ($result->count()) { + $this->append_result($result); } else if ($result->incomplete) { $this->incomplete = true; -- Gitblit v1.9.1