diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2009-07-11 13:28:56 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2009-07-11 13:28:56 +0000 |
| commit | 1adf1349a98d868afcb66116b873db44c743fcc8 (patch) | |
| tree | 578b4feacdafef0f778365a69e649ddc65b1305b /roundcubemail/program/include | |
| parent | 2de276c7dd6c0b9d16bbb4525d7b7180facb1af1 (diff) | |
- speed up adding of messages to the list after message move/delete
git-svn-id: https://svn.roundcube.net/trunk@2734 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include')
| -rw-r--r-- | roundcubemail/program/include/rcube_imap.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/roundcubemail/program/include/rcube_imap.php b/roundcubemail/program/include/rcube_imap.php index 9b8d7d056..5bd3542d1 100644 --- a/roundcubemail/program/include/rcube_imap.php +++ b/roundcubemail/program/include/rcube_imap.php @@ -537,13 +537,14 @@ class rcube_imap * @param int Current page to list * @param string Header field to sort by * @param string Sort order [ASC|DESC] + * @param boolean Number of slice items to extract from result array * @return array Indexed array with message header objects * @access public */ - function list_headers($mbox_name='', $page=NULL, $sort_field=NULL, $sort_order=NULL) + function list_headers($mbox_name='', $page=NULL, $sort_field=NULL, $sort_order=NULL, $slice=0) { $mailbox = $mbox_name ? $this->mod_mailbox($mbox_name) : $this->mailbox; - return $this->_list_headers($mailbox, $page, $sort_field, $sort_order); + return $this->_list_headers($mailbox, $page, $sort_field, $sort_order, false, $slice); } @@ -553,7 +554,7 @@ class rcube_imap * @access private * @see rcube_imap::list_headers */ - private function _list_headers($mailbox='', $page=NULL, $sort_field=NULL, $sort_order=NULL, $recursive=FALSE) + private function _list_headers($mailbox='', $page=NULL, $sort_field=NULL, $sort_order=NULL, $recursive=FALSE, $slice=0) { if (!strlen($mailbox)) return array(); @@ -591,6 +592,9 @@ class rcube_imap $max = max($msg_index); $msg_index = array_slice($msg_index, $begin, $end-$begin); + if ($slice) + $msg_index = array_slice($msg_index, ($this->sort_order == 'DESC' ? 0 : -$slice), $slice); + // fetch reqested headers from server $this->_fetch_headers($mailbox, join(',', $msg_index), $a_msg_headers, $cache_key); } @@ -607,6 +611,9 @@ class rcube_imap list($begin, $end) = $this->_get_message_range(count($msg_index), $page); $msg_index = array_slice($msg_index, $begin, $end-$begin); + if ($slice) + $msg_index = array_slice($msg_index, ($this->sort_order == 'DESC' ? 0 : -$slice), $slice); + // fetch reqested headers from server $this->_fetch_headers($mailbox, join(",", $msg_index), $a_msg_headers, $cache_key); } |
