Horde_Imap_Client_Socket::_parseEsearch PHP Method

_parseEsearch() protected method

Parse an ESEARCH response (RFC 4466 [2.6.2]) Format: (TAG "a567") UID COUNT 5 ALL 4:19,21,28
protected _parseEsearch ( Horde_Imap_Client_Interaction_Pipeline $pipeline, Horde_Imap_Client_Tokenize $data )
$pipeline Horde_Imap_Client_Interaction_Pipeline Pipeline object.
$data Horde_Imap_Client_Tokenize The server response.
    protected function _parseEsearch(Horde_Imap_Client_Interaction_Pipeline $pipeline, Horde_Imap_Client_Tokenize $data)
    {
        // Ignore search correlator information
        if ($data->next() === true) {
            $data->flushIterator(false);
        }
        // Ignore UID tag
        $current = $data->next();
        if (Horde_String::upper($current) === 'UID') {
            $current = $data->next();
        }
        do {
            $val = $data->next();
            $tag = Horde_String::upper($current);
            switch ($tag) {
                case 'ALL':
                    $this->_parseSearch($pipeline, $val);
                    break;
                case 'COUNT':
                case 'MAX':
                case 'MIN':
                case 'MODSEQ':
                case 'RELEVANCY':
                    $pipeline->data['esearchresp'][Horde_String::lower($tag)] = $val;
                    break;
                case 'PARTIAL':
                    // RFC 5267 [4.4]
                    $partial = $val->flushIterator();
                    $this->_parseSearch($pipeline, end($partial));
                    break;
            }
        } while (($current = $data->next()) !== false);
    }