From 77b5d7ee304a688a2eb115ce04b460b43c0dd700 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 22 May 2016 08:43:54 -0400
Subject: [PATCH] Fix priority icon(s) position

---
 program/lib/Roundcube/rcube_result_index.php |   56 +++++++++++---------------------------------------------
 1 files changed, 11 insertions(+), 45 deletions(-)

diff --git a/program/lib/Roundcube/rcube_result_index.php b/program/lib/Roundcube/rcube_result_index.php
index 4d1ae13..6320bac 100644
--- a/program/lib/Roundcube/rcube_result_index.php
+++ b/program/lib/Roundcube/rcube_result_index.php
@@ -1,9 +1,7 @@
 <?php
 
-/*
+/**
  +-----------------------------------------------------------------------+
- | program/include/rcube_result_index.php                                |
- |                                                                       |
  | This file is part of the Roundcube Webmail client                     |
  | Copyright (C) 2005-2011, The Roundcube Dev Team                       |
  | Copyright (C) 2011, Kolab Systems AG                                  |
@@ -14,13 +12,11 @@
  |                                                                       |
  | PURPOSE:                                                              |
  |   SORT/SEARCH/ESEARCH response handler                                |
- |                                                                       |
  +-----------------------------------------------------------------------+
  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
  | Author: Aleksander Machniak <alec@alec.pl>                            |
  +-----------------------------------------------------------------------+
 */
-
 
 /**
  * Class for accessing IMAP's SORT/SEARCH/ESEARCH result
@@ -30,11 +26,13 @@
  */
 class rcube_result_index
 {
+    public $incomplete = false;
+
     protected $raw_data;
     protected $mailbox;
-    protected $meta = array();
+    protected $meta   = array();
     protected $params = array();
-    protected $order = 'ASC';
+    protected $order  = 'ASC';
 
     const SEPARATOR_ELEMENT = ' ';
 
@@ -42,12 +40,12 @@
     /**
      * Object constructor.
      */
-    public function __construct($mailbox = null, $data = null)
+    public function __construct($mailbox = null, $data = null, $order = null)
     {
         $this->mailbox = $mailbox;
+        $this->order   = $order == 'DESC' ? 'DESC' : 'ASC';
         $this->init($data);
     }
-
 
     /**
      * Initializes object with SORT command response
@@ -129,7 +127,6 @@
         $this->raw_data = $data;
     }
 
-
     /**
      * Checks the result from IMAP command
      *
@@ -137,9 +134,8 @@
      */
     public function is_error()
     {
-        return $this->raw_data === null ? true : false;
+        return $this->raw_data === null;
     }
-
 
     /**
      * Checks if the result is empty
@@ -148,9 +144,8 @@
      */
     public function is_empty()
     {
-        return empty($this->raw_data) ? true : false;
+        return empty($this->raw_data);
     }
-
 
     /**
      * Returns number of elements in the result
@@ -173,7 +168,6 @@
         return $this->meta['count'];
     }
 
-
     /**
      * Returns number of elements in the result.
      * Alias for count() for compatibility with rcube_result_thread
@@ -184,7 +178,6 @@
     {
         return $this->count();
     }
-
 
     /**
      * Returns maximal message identifier in the result
@@ -200,7 +193,6 @@
         return $this->meta['max'];
     }
 
-
     /**
      * Returns minimal message identifier in the result
      *
@@ -215,13 +207,11 @@
         return $this->meta['min'];
     }
 
-
     /**
      * Slices data set.
      *
      * @param $offset Offset (as for PHP's array_slice())
      * @param $length Number of elements (as for PHP's array_slice())
-     *
      */
     public function slice($offset, $length)
     {
@@ -233,29 +223,12 @@
         $this->raw_data      = implode(self::SEPARATOR_ELEMENT, $data);
     }
 
-
     /**
-     * Filters data set. Removes elements listed in $ids list.
+     * Filters data set. Removes elements not listed in $ids list.
      *
      * @param array $ids List of IDs to remove.
      */
     public function filter($ids = array())
-    {
-        $data = $this->get();
-        $data = array_diff($data, $ids);
-
-        $this->meta          = array();
-        $this->meta['count'] = count($data);
-        $this->raw_data      = implode(self::SEPARATOR_ELEMENT, $data);
-    }
-
-
-    /**
-     * Filters data set. Removes elements not listed in $ids list.
-     *
-     * @param array $ids List of IDs to keep.
-     */
-    public function intersect($ids = array())
     {
         $data = $this->get();
         $data = array_intersect($data, $ids);
@@ -264,7 +237,6 @@
         $this->meta['count'] = count($data);
         $this->raw_data      = implode(self::SEPARATOR_ELEMENT, $data);
     }
-
 
     /**
      * Reverts order of elements in the result
@@ -277,14 +249,12 @@
             return;
         }
 
-        // @TODO: maybe do this in chunks
         $data = $this->get();
         $data = array_reverse($data);
         $this->raw_data = implode(self::SEPARATOR_ELEMENT, $data);
 
         $this->meta['pos'] = array();
     }
-
 
     /**
      * Check if the given message ID exists in the object
@@ -325,7 +295,6 @@
         return false;
     }
 
-
     /**
      * Return all messages in the result.
      *
@@ -336,9 +305,9 @@
         if (empty($this->raw_data)) {
             return array();
         }
+
         return explode(self::SEPARATOR_ELEMENT, $this->raw_data);
     }
-
 
     /**
      * Return all messages in the result.
@@ -353,7 +322,6 @@
 
         return rcube_imap_generic::compressMessageSet($this->get());
     }
-
 
     /**
      * Return result element at specified index
@@ -414,7 +382,6 @@
         return $data[$index];
     }
 
-
     /**
      * Returns response parameters, e.g. ESEARCH's MIN/MAX/COUNT/ALL/MODSEQ
      * or internal data e.g. MAILBOX, ORDER
@@ -435,7 +402,6 @@
 
         return $params;
     }
-
 
     /**
      * Returns length of internal data representation

--
Gitblit v1.9.1