diff options
author | alecpl <alec@alec.pl> | 2010-06-04 09:58:37 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2010-06-04 09:58:37 +0000 |
commit | 309f49f09bc8b663a3ddf834ca0e79f909a0928c (patch) | |
tree | d7f123008e3555cab63bf61b3d8d8c67dc10406c /program/include/rcube_imap_generic.php | |
parent | ffd3e2906854ff985974be070b224beb38f4fae9 (diff) |
- performance improvement: skip SEARCH command when mailbox is empty and SEARCH is called just after SELECT
Diffstat (limited to 'program/include/rcube_imap_generic.php')
-rw-r--r-- | program/include/rcube_imap_generic.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/program/include/rcube_imap_generic.php b/program/include/rcube_imap_generic.php index 461beece6..ab37902ae 100644 --- a/program/include/rcube_imap_generic.php +++ b/program/include/rcube_imap_generic.php @@ -1584,10 +1584,17 @@ class rcube_imap_generic function search($folder, $criteria, $return_uid=false) { + $old_sel = $this->selected; + if (!$this->select($folder)) { return false; } + // return empty result when folder is empty and we're just after SELECT + if ($old_sel != $folder && !$this->exists) { + return array(); + } + $data = ''; $query = 'srch1 ' . ($return_uid ? 'UID ' : '') . 'SEARCH ' . chop($criteria); |