summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2008-12-12 11:57:20 +0000
committeralecpl <alec@alec.pl>2008-12-12 11:57:20 +0000
commit2b5c123aadfa50f09a60b3d05c240932f9e5907a (patch)
tree9ba3f77c4bd9c9fa2a55f04ff823ffd34ac4d9d2 /program/include
parentf50cc72cbbe443dff8a5daa34ece6cafe8757089 (diff)
#1485622: fix rcube_imap::message_index() to return always messages IDs
Diffstat (limited to 'program/include')
-rw-r--r--program/include/rcube_imap.php21
1 files changed, 15 insertions, 6 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index c9cca72ee..e16651af9 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -107,7 +107,17 @@ class rcube_imap
$ICL_PORT = $port;
$IMAP_USE_INTERNAL_DATE = false;
- $this->conn = iil_Connect($host, $user, $pass, array('imap' => $auth_type ? $auth_type : 'check'));
+ // set connection options
+ $options['imap'] = $auth_type ? $auth_type : 'check';
+
+ // Setting root and delimiter before iil_Connect can save time detecting them
+ // using NAMESPACE and LIST
+ if (is_string($imap_root = rcmail::get_instance()->config->get('imap_root')))
+ $options['rootdir'] = $imap_root;
+ if($imap_delimiter = rcmail::get_instance()->config->get('imap_delimiter'))
+ $options['delimiter'] = $imap_delimiter;
+
+ $this->conn = iil_Connect($host, $user, $pass, $options);
$this->host = $host;
$this->user = $user;
$this->pass = $pass;
@@ -811,7 +821,7 @@ class rcube_imap
// we have a saved search result. get index from there
if (!isset($this->cache[$key]) && $this->search_string && $mailbox == $this->mailbox)
{
- $this->cache[$key] = $a_msg_headers = array();
+ $this->cache[$key] = array();
if ($this->get_capability('sort'))
{
@@ -832,7 +842,7 @@ class rcube_imap
else if ($this->sort_order=="DESC")
arsort($a_index);
- $this->cache[$key] = $a_index;
+ $this->cache[$key] = array_keys($a_index);
}
}
@@ -848,10 +858,9 @@ class rcube_imap
if ($cache_status>0)
{
$a_index = $this->get_message_cache_index($cache_key, TRUE, $this->sort_field, $this->sort_order);
- return array_values($a_index);
+ return array_keys($a_index);
}
-
// fetch complete message index
$msg_count = $this->_messagecount($mailbox);
if ($this->get_capability('sort') && ($a_index = iil_C_Sort($this->conn, $mailbox, $this->sort_field, '')))
@@ -870,7 +879,7 @@ class rcube_imap
else if ($this->sort_order=="DESC")
arsort($a_index);
- $this->cache[$key] = $a_index;
+ $this->cache[$key] = array_keys($a_index);
}
return $this->cache[$key];