roundcubemail/program/lib/Roundcube/rcube_imap_generic.php
public function thread($mailbox, $algorithm = 'REFERENCES', $criteria = '', $return_uid = false, $encoding = 'US-ASCII')
    {
        $old_sel = $this->selected;

        if (!$this->select($mailbox)) {
            return new rcube_result_thread($mailbox);
        }

        // return empty result when folder is empty and we're just after SELECT
        if ($old_sel != $mailbox && !$this->data['EXISTS']) {
            return new rcube_result_thread($mailbox, '* THREAD');
        }

        $encoding  = $encoding ? trim($encoding) : 'US-ASCII';
        $algorithm = $algorithm ? trim($algorithm) : 'REFERENCES';
        $criteria  = $criteria ? 'ALL '.trim($criteria) : 'ALL';

        list($code, $response) = $this->execute($return_uid ? 'UID THREAD' : 'THREAD',
            array($algorithm, $encoding, $criteria));

        if ($code != self::ERROR_OK) {
            $response = null;
        }

        return new rcube_result_thread($mailbox, $response);
    }
public function thread($mailbox, $algorithm = 'REFERENCES', $criteria = '', $return_uid = false, $encoding = 'US-ASCII')
    {
        $old_sel = $this->selected;

        if (!$this->select($mailbox)) {
            return new rcube_result_thread($mailbox);
        }

        // return empty result when folder is empty and we're just after SELECT
        if ($old_sel != $mailbox && !$this->data['EXISTS']) {
            return new rcube_result_thread($mailbox, '* THREAD');
        }

        $encoding  = $encoding ? trim($encoding) : 'US-ASCII';
        $algorithm = $algorithm ? trim($algorithm) : 'REFERENCES';
        $criteria  = $criteria ? 'ALL '.trim($criteria) : 'ALL';

        list($code, $response) = $this->execute($return_uid ? 'UID THREAD' : 'THREAD',
            array($algorithm, $encoding, $criteria));

        if ($code != self::ERROR_OK) {
            $response = null;
        }

        return new rcube_result_thread($mailbox, $response);
    }
public function thread ( $ mailbox , $ algorithm = 'REFERENCES' , $ criteria = '' , $ return_uid = false , $ encoding = 'US-ASCII' ) { $ old_sel = $ this -> selected ; if ( ! $ this -> select ( $ mailbox ) ) { return new rcube_result_thread ( $ mailbox ) ; } // return empty result when folder is empty and we're just after SELECT if ( $ old_sel != $ mailbox && ! $ this -> data [ 'EXISTS' ] ) { return new rcube_result_thread ( $ mailbox , '* THREAD' ) ; } $ encoding = $ encoding ? trim ( $ encoding ) : 'US-ASCII' ; $ algorithm = $ algorithm ? trim ( $ algorithm ) : 'REFERENCES' ; $ criteria = $ criteria ? 'ALL ' . trim ( $ criteria ) : 'ALL' ; list ( $ code , $ response ) = $ this -> execute ( $ return_uid ? 'UID THREAD' : 'THREAD' , array ( $ algorithm , $ encoding , $ criteria ) ) ; if ( $ code != self :: ERROR_OK ) { $ response = null ; } return new rcube_result_thread ( $ mailbox , $ response ) ; }
Executes THREAD command

@param string $mailbox    Mailbox name
@param string $algorithm  Threading algorithm (ORDEREDSUBJECT, REFERENCES, REFS)
@param string $criteria   Searching criteria
@param bool   $return_uid Enables UIDs in result instead of sequence numbers
@param string $encoding   Character set

@return rcube_result_thread Thread data
Executes THREAD command