From 041c93ce0bc00cb6417ce2e4bdce2ed84d37f50a Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 22 May 2012 06:31:37 -0400
Subject: [PATCH] Removed $Id$

---
 program/include/rcube_result_index.php |   42 ++++++++++++++++++++++--------------------
 1 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/program/include/rcube_result_index.php b/program/include/rcube_result_index.php
index 38a7528..cc1615d 100644
--- a/program/include/rcube_result_index.php
+++ b/program/include/rcube_result_index.php
@@ -7,7 +7,10 @@
  | This file is part of the Roundcube Webmail client                     |
  | Copyright (C) 2005-2011, The Roundcube Dev Team                       |
  | Copyright (C) 2011, Kolab Systems AG                                  |
- | Licensed under the GNU GPL                                            |
+ |                                                                       |
+ | Licensed under the GNU General Public License version 3 or            |
+ | any later version with exceptions for skins & plugins.                |
+ | See the README file for a full license statement.                     |
  |                                                                       |
  | PURPOSE:                                                              |
  |   SORT/SEARCH/ESEARCH response handler                                |
@@ -16,9 +19,6 @@
  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
  | Author: Aleksander Machniak <alec@alec.pl>                            |
  +-----------------------------------------------------------------------+
-
- $Id$
-
 */
 
 
@@ -27,11 +27,11 @@
  */
 class rcube_result_index
 {
-    private $raw_data;
-    private $mailbox;
-    private $meta = array();
-    private $params = array();
-    private $order = 'ASC';
+    protected $raw_data;
+    protected $mailbox;
+    protected $meta = array();
+    protected $params = array();
+    protected $order = 'ASC';
 
     const SEPARATOR_ELEMENT = ' ';
 
@@ -86,18 +86,18 @@
                         $param = strtoupper($m[1]);
                         $value = $m[2];
 
-                        $this->params[strtoupper($m[1])] = $value;
+                        $this->params[$param] = $value;
                         $data_item = substr($data_item, strlen($m[0]));
 
                         if (in_array($param, array('COUNT', 'MIN', 'MAX'))) {
-                            $this->meta[strtolower($param)] = (int) $m[2];
+                            $this->meta[strtolower($param)] = (int) $value;
                         }
                     }
 
 // @TODO: Implement compression using compressMessageSet() in __sleep() and __wakeup() ?
 // @TODO: work with compressed result?!
                     if (isset($this->params['ALL'])) {
-                        $data[$idx] = implode(self::SEPARATOR_ELEMENT,
+                        $data_item = implode(self::SEPARATOR_ELEMENT,
                             rcube_imap_generic::uncompressMessageSet($this->params['ALL']));
                     }
                 }
@@ -107,6 +107,8 @@
 
             unset($data[$i]);
         }
+
+        $data = array_filter($data);
 
         if (empty($data)) {
             return;
@@ -126,7 +128,7 @@
      *
      * @return bool True if the result is an error, False otherwise
      */
-    public function isError()
+    public function is_error()
     {
         return $this->raw_data === null ? true : false;
     }
@@ -137,7 +139,7 @@
      *
      * @return bool True if the result is empty, False otherwise
      */
-    public function isEmpty()
+    public function is_empty()
     {
         return empty($this->raw_data) ? true : false;
     }
@@ -171,7 +173,7 @@
      *
      * @return int Number of elements
      */
-    public function countMessages()
+    public function count_messages()
     {
         return $this->count();
     }
@@ -305,7 +307,7 @@
                 if ($m[0][1]) {
                     $idx = 1 + substr_count($this->raw_data, self::SEPARATOR_ELEMENT, 0, $m[0][1]);
                 }
-                // cache position of this element, so we can use it in getElement()
+                // cache position of this element, so we can use it in get_element()
                 $this->meta['pos'][$idx] = (int)$m[0][1];
 
                 return $idx;
@@ -336,7 +338,7 @@
      *
      * @return array List of message IDs
      */
-    public function getCompressed()
+    public function get_compressed()
     {
         if (empty($this->raw_data)) {
             return '';
@@ -353,7 +355,7 @@
      *
      * @return int Element value
      */
-    public function getElement($index)
+    public function get_element($index)
     {
         $count = $this->count();
 
@@ -414,7 +416,7 @@
      *
      * @return array|string Response parameters or parameter value
      */
-    public function getParameters($param=null)
+    public function get_parameters($param=null)
     {
         $params = $this->params;
         $params['MAILBOX'] = $this->mailbox;
@@ -433,7 +435,7 @@
      *
      * @return int Data length
      */
-    private function length()
+    protected function length()
     {
         if (!isset($this->meta['length'])) {
             $this->meta['length'] = strlen($this->raw_data);

--
Gitblit v1.9.1