diff options
author | thomascube <thomas@roundcube.net> | 2009-04-19 17:44:29 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2009-04-19 17:44:29 +0000 |
commit | cc97ea0559af1a92a54dbcdf738ee4d95e67d3ff (patch) | |
tree | f9e18128e5a90abb06f079b09f8cd9ed92044faf /program/include/rcube_imap.php | |
parent | fb253ee9a89e2da779d11058f1f0c63c314b2840 (diff) |
Merged branch devel-api (from r2208 to r2387) back into trunk (omitting some sample plugins)
Diffstat (limited to 'program/include/rcube_imap.php')
-rw-r--r-- | program/include/rcube_imap.php | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php index da7c5bf88..e2b6c0d9a 100644 --- a/program/include/rcube_imap.php +++ b/program/include/rcube_imap.php @@ -55,6 +55,7 @@ class rcube_imap var $default_charset = 'ISO-8859-1'; var $default_folders = array('INBOX'); var $default_folders_lc = array('inbox'); + var $fetch_add_headers = ''; var $cache = array(); var $cache_keys = array(); var $cache_changes = array(); @@ -428,8 +429,16 @@ class rcube_imap if (is_array($a_mboxes)) return $a_mboxes; - // retrieve list of folders from IMAP server - $a_folders = iil_C_ListSubscribed($this->conn, $this->_mod_mailbox($root), $filter); + // Give plugins a chance to provide a list of mailboxes + $data = rcmail::get_instance()->plugins->exec_hook('list_mailboxes',array('root'=>$root,'filter'=>$filter)); + if (isset($data['folders'])) { + $a_folders = $data['folders']; + } + else{ + // retrieve list of folders from IMAP server + $a_folders = iil_C_ListSubscribed($this->conn, $this->_mod_mailbox($root), $filter); + } + if (!is_array($a_folders) || !sizeof($a_folders)) $a_folders = array(); @@ -775,7 +784,7 @@ class rcube_imap $cache_index = $this->get_message_cache_index($cache_key); // fetch reuested headers from server - $a_header_index = iil_C_FetchHeaders($this->conn, $mailbox, $msgs); + $a_header_index = iil_C_FetchHeaders($this->conn, $mailbox, $msgs, false, $this->fetch_add_headers); $deleted_count = 0; if (!empty($a_header_index)) @@ -829,14 +838,14 @@ class rcube_imap if ($this->sort_field && $this->search_sort_field != $this->sort_field) $this->search('', $this->search_string, $this->search_charset, $this->sort_field); - if ($this->sort_order == 'DESC') + if ($this->sort_order == 'DESC') $this->cache[$key] = array_reverse($this->search_set); - else - $this->cache[$key] = $this->search_set; + else + $this->cache[$key] = $this->search_set; } else { - $a_index = iil_C_FetchHeaderIndex($this->conn, $mailbox, join(',', $this->search_set), $this->sort_field); + $a_index = iil_C_FetchHeaderIndex($this->conn, $mailbox, join(',', $this->search_set), $this->sort_field, false); if ($this->sort_order=="ASC") asort($a_index); @@ -923,7 +932,7 @@ class rcube_imap // fetch complete headers and add to cache - $headers = iil_C_FetchHeader($this->conn, $mailbox, $id); + $headers = iil_C_FetchHeader($this->conn, $mailbox, $id, false, $this->fetch_add_headers); $this->add_message_cache($cache_key, $headers->id, $headers); } @@ -1062,7 +1071,7 @@ class rcube_imap if ($uid && ($headers = &$this->get_cached_message($mailbox.'.msg', $uid))) return $headers; - $headers = iil_C_FetchHeader($this->conn, $mailbox, $id, $is_uid, $bodystr); + $headers = iil_C_FetchHeader($this->conn, $mailbox, $id, $is_uid, $bodystr, $this->fetch_add_headers); // write headers cache if ($headers) @@ -2227,7 +2236,7 @@ class rcube_imap if ($cache_count==$msg_count) { // get highest index - $header = iil_C_FetchHeader($this->conn, $mailbox, "$msg_count"); + $header = iil_C_FetchHeader($this->conn, $mailbox, "$msg_count", false, $this->fetch_add_headers); $cache_uid = array_pop($cache_index); // uids of highest message matches -> cache seems OK @@ -2277,7 +2286,7 @@ class rcube_imap // featch headers if unserialize failed if (empty($this->cache[$cache_key][$uid])) - $this->cache[$cache_key][$uid] = iil_C_FetchHeader($this->conn, preg_replace('/.msg$/', '', $key), $uid, true); + $this->cache[$cache_key][$uid] = iil_C_FetchHeader($this->conn, preg_replace('/.msg$/', '', $key), $uid, true, $this->fetch_add_headers); } } |