Aleksander Machniak
2014-05-15 47a7833aca96a263068eed53f9471a3699ef257b
CS fixes
4 files modified
69 ■■■■■ changed files
program/js/app.js 4 ●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_imap_search.php 25 ●●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_result_multifolder.php 27 ●●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_storage.php 13 ●●●●● patch | view | raw | blame | history
program/js/app.js
@@ -4225,7 +4225,7 @@
  };
  // build URL params for search
  this.search_params = function(search, filter, smods)
  this.search_params = function(search, filter)
  {
    var n, url = {}, mods_arr = [],
      mods = this.env.search_mods,
@@ -4244,7 +4244,7 @@
    if (search) {
      url._q = search;
      if (!smods && mods && this.message_list)
      if (mods && this.message_list)
        mods = mods[mbox] || mods['*'];
      if (mods) {
program/lib/Roundcube/rcube_imap_search.php
@@ -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;
            }
@@ -129,11 +130,11 @@
    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 +151,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 +228,4 @@
    {
        return $this->result;
    }
}
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);
    }
@@ -74,7 +74,8 @@
        // append UIDs to global index
        $folder = $result->get_parameters('MAILBOX');
        $index = array_map(function($uid) use ($folder) { return $uid . '-' . $folder; }, $result->get());
        $index  = array_map(function($uid) use ($folder) { return $uid . '-' . $folder; }, $result->get());
        $this->index = array_merge($this->index, $index);
    }
@@ -89,7 +90,7 @@
        }
        $this->sorting = $sort_field;
        $this->order = $sort_order;
        $this->order   = $sort_order;
    }
    /**
@@ -150,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);
        }
    }
@@ -171,6 +174,7 @@
        if (!empty($this->folder)) {
            $msgid .= '-' . $this->folder;
        }
        return array_search($msgid, $this->index);
    }
@@ -188,6 +192,7 @@
            if ($set->get_parameters('MAILBOX') == $folder) {
                $set->filter($ids);
            }
            $this->meta['count'] += $set->count();
        }
    }
@@ -267,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,
        );
program/lib/Roundcube/rcube_storage.php
@@ -152,6 +152,19 @@
    /**
     * Get connection/class option
     *
     * @param string $name Option name
     *
     * @param mixed Option value
     */
    public function get_option($name)
    {
        return $this->options[$name];
    }
    /**
     * Activate/deactivate debug mode.
     *
     * @param boolean $dbg True if conversation with the server should be logged