Merge branch 'master' of github.com:roundcube/roundcubemail

pull/177/head
Aleksander Machniak 11 years ago
commit ed1222e453

@ -1544,20 +1544,27 @@ class rcube_imap extends rcube_storage
*/ */
public function search_once($folder = null, $str = 'ALL') public function search_once($folder = null, $str = 'ALL')
{ {
if (!$this->check_connection()) {
return new rcube_result_index();
}
if (!$str) { if (!$str) {
$str = 'ALL'; $str = 'ALL';
} }
if (!strlen($folder)) { // multi-folder search
$folder = $this->folder; if (is_array($folder) && count($folder) > 1) {
$searcher = new rcube_imap_search($this->options, $this->conn);
$index = $searcher->exec($folder, $str, $this->default_charset);
} }
else {
if (!$this->check_connection()) { $folder = is_array($folder) ? $folder[0] : $folder;
return new rcube_result_index(); if (!strlen($folder)) {
$folder = $this->folder;
}
$index = $this->conn->search($folder, $str, true);
} }
$index = $this->conn->search($folder, $str, true);
return $index; return $index;
} }
@ -1707,15 +1714,15 @@ class rcube_imap extends rcube_storage
*/ */
public function get_message_headers($uid, $folder = null, $force = false) public function get_message_headers($uid, $folder = null, $force = false)
{ {
if (!strlen($folder)) {
$folder = $this->folder;
}
// decode combined UID-folder identifier // decode combined UID-folder identifier
if (preg_match('/^\d+-.+/', $uid)) { if (preg_match('/^\d+-.+/', $uid)) {
list($uid, $folder) = explode('-', $uid, 2); list($uid, $folder) = explode('-', $uid, 2);
} }
if (!strlen($folder)) {
$folder = $this->folder;
}
// get cached headers // get cached headers
if (!$force && $uid && ($mcache = $this->get_mcache_engine())) { if (!$force && $uid && ($mcache = $this->get_mcache_engine())) {
$headers = $mcache->get_message($folder, $uid); $headers = $mcache->get_message($folder, $uid);
@ -1726,6 +1733,9 @@ class rcube_imap extends rcube_storage
else { else {
$headers = $this->conn->fetchHeader( $headers = $this->conn->fetchHeader(
$folder, $uid, true, true, $this->get_fetch_headers()); $folder, $uid, true, true, $this->get_fetch_headers());
if (is_object($headers))
$headers->folder = $folder;
} }
return $headers; return $headers;

Loading…
Cancel
Save