diff options
| author | sparc <sparc@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2005-10-14 10:21:46 +0000 |
|---|---|---|
| committer | sparc <sparc@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2005-10-14 10:21:46 +0000 |
| commit | 3f6b7b24d6561c7a9db5e2af340eb501c05c12f8 (patch) | |
| tree | 7a1ac9dfbb003db2abd0082a1949a51fa6249804 /roundcubemail/program/include | |
| parent | 3d6c6a92e1e9d5ec822332c29bf926e1e95621b5 (diff) | |
minor improvment on reading headers
git-svn-id: https://svn.roundcube.net/trunk@33 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include')
| -rw-r--r-- | roundcubemail/program/include/rcube_imap.inc | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/roundcubemail/program/include/rcube_imap.inc b/roundcubemail/program/include/rcube_imap.inc index e927dc799..8bbd9a2c5 100644 --- a/roundcubemail/program/include/rcube_imap.inc +++ b/roundcubemail/program/include/rcube_imap.inc @@ -297,11 +297,9 @@ class rcube_imap function _list_headers($mailbox='', $page=NULL, $sort_field='date', $sort_order='DESC') { $max = $this->_messagecount($mailbox /*, 'ALL', TRUE*/); - $a_out = array(); if (!strlen($mailbox)) - return $a_out; - + return array(); // get cached headers $a_msg_headers = $this->get_cache($mailbox.'.msg'); @@ -314,7 +312,8 @@ class rcube_imap $a_header_index = iil_C_FetchHeaders($this->conn, $mailbox, "1:$max"); $a_msg_headers = array(); foreach ($a_header_index as $i => $headers) - $a_msg_headers[$headers->uid] = $headers; + if (!$headers->deleted) + $a_msg_headers[$headers->uid] = $headers; // print "/**** fetch headers ****/\n"; } @@ -323,22 +322,19 @@ class rcube_imap // sort headers by a specific col $a_headers = iil_SortHeaders($a_msg_headers, $sort_field, $sort_order); - + // free memory + unset($a_msg_headers); + // write headers list to cache if (!$headers_cached) - $this->update_cache($mailbox.'.msg', $a_msg_headers); - - if (is_array($a_headers)) - foreach ($a_headers as $header) - if (!$header->deleted) - $a_out[] = $header; + $this->update_cache($mailbox.'.msg', $a_headers); // return complete list of messages if (strtolower($page)=='all') - return $a_out; - + return $a_headers; + $start_msg = ($this->list_page-1) * $this->page_size; - return array_slice($a_out, $start_msg, $this->page_size); + return array_slice($a_headers, $start_msg, $this->page_size); } |
