From 46f7b7096450939fe03c95aa81ce06ae4bfca89d Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 28 Mar 2016 06:51:43 -0400
Subject: [PATCH] Enable reply/reply-all/forward buttons also in preview frame of message/rfc822

---
 program/lib/Roundcube/rcube_imap_search.php |   29 ++++++++++++-----------------
 1 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/program/lib/Roundcube/rcube_imap_search.php b/program/lib/Roundcube/rcube_imap_search.php
index 0c44daf..86b10c9 100644
--- a/program/lib/Roundcube/rcube_imap_search.php
+++ b/program/lib/Roundcube/rcube_imap_search.php
@@ -1,6 +1,6 @@
 <?php
 
-/*
+/**
  +-----------------------------------------------------------------------+
  | This file is part of the Roundcube Webmail client                     |
  |                                                                       |
@@ -29,7 +29,7 @@
 {
     public $options = array();
 
-    protected $jobs = array();
+    protected $jobs      = array();
     protected $timelimit = 0;
     protected $results;
     protected $conn;
@@ -40,7 +40,7 @@
     public function __construct($options, $conn)
     {
         $this->options = $options;
-        $this->conn = $conn;
+        $this->conn    = $conn;
     }
 
     /**
@@ -54,7 +54,7 @@
      */
     public function exec($folders, $str, $charset = null, $sort_field = null, $threading=null)
     {
-        $start = floor(microtime(true));
+        $start   = floor(microtime(true));
         $results = new rcube_result_multifolder($folders);
 
         // start a search job for every folder to search in
@@ -65,7 +65,8 @@
                 $results->add($result);
             }
             else {
-                $job = new rcube_imap_search_job($folder, $str, $charset, $sort_field, $threading);
+                $search = is_array($str) && $str[$folder] ? $str[$folder] : $str;
+                $job = new rcube_imap_search_job($folder, $search, $charset, $sort_field, $threading);
                 $job->worker = $this;
                 $this->jobs[] = $job;
             }
@@ -123,17 +124,15 @@
     private $charset;
     private $sort_field;
     private $threading;
-    private $searchset;
     private $result;
-    private $pagesize = 100;
 
     public function __construct($folder, $str, $charset = null, $sort_field = null, $threading=false)
     {
-        $this->folder = $folder;
-        $this->search = $str;
-        $this->charset = $charset;
+        $this->folder     = $folder;
+        $this->search     = $str;
+        $this->charset    = $charset;
         $this->sort_field = $sort_field;
-        $this->threading = $threading;
+        $this->threading  = $threading;
 
         $this->result = new rcube_result_index($folder);
         $this->result->incomplete = true;
@@ -150,9 +149,8 @@
     protected function search_index()
     {
         $criteria = $this->search;
-        $charset = $this->charset;
-
-        $imap = $this->worker->get_imap();
+        $charset  = $this->charset;
+        $imap     = $this->worker->get_imap();
 
         if (!$imap->connected()) {
             trigger_error("No IMAP connection for $this->folder", E_USER_WARNING);
@@ -228,7 +226,4 @@
     {
         return $this->result;
     }
-
 }
-
-

--
Gitblit v1.9.1