alecpl
2010-06-04 ccf250ec1d0a979e878769cb87d939c970fc863a
- performance improvement: we can skip THREAD when folder is empty


1 files modified
7 ■■■■■ changed files
program/include/rcube_imap_generic.php 7 ●●●●● patch | view | raw | blame | history
program/include/rcube_imap_generic.php
@@ -1552,10 +1552,17 @@
    function thread($folder, $algorithm='REFERENCES', $criteria='', $encoding='US-ASCII')
    {
        $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(array(), array(), array());
        }
        $encoding  = $encoding ? trim($encoding) : 'US-ASCII';
        $algorithm = $algorithm ? trim($algorithm) : 'REFERENCES';
        $criteria  = $criteria ? 'ALL '.trim($criteria) : 'ALL';