Horde_Imap_Client_Socket::_loginTasks PHP Method

_loginTasks() protected method

Perform login tasks.
protected _loginTasks ( boolean $firstlogin = true, array $resp = [] ) : boolean
$firstlogin boolean Is this the first login?
$resp array The data response from the login command. May include: - capability_set: (boolean) True if CAPABILITY was set after login. - proxyreuse: (boolean) True if re-used connection via imapproxy.
return boolean True if global login tasks should be performed.
    protected function _loginTasks($firstlogin = true, array $resp = array())
    {
        /* If reusing an imapproxy connection, no need to do any of these
         * login tasks again. */
        if (!$firstlogin && !empty($resp['proxyreuse'])) {
            if (isset($this->_init['enabled'])) {
                foreach ($this->_init['enabled'] as $val) {
                    $this->_capability()->enable($val);
                }
            }
            // If we have not yet set the language, set it now.
            if (!isset($this->_init['lang'])) {
                $this->_temp['lang_queue'] = true;
                $this->setLanguage();
                unset($this->_temp['lang_queue']);
            }
            return false;
        }
        /* If we logged in for first time, and server did not return
         * capability information, we need to mark for retrieval. */
        if ($firstlogin && empty($resp['capability_set'])) {
            $this->_setInit('capability');
        }
        $this->_temp['lang_queue'] = true;
        $this->setLanguage();
        unset($this->_temp['lang_queue']);
        /* Only active QRESYNC/CONDSTORE if caching is enabled. */
        $enable = array();
        if ($this->_initCache()) {
            if ($this->_capability('QRESYNC')) {
                $enable[] = 'QRESYNC';
            } elseif ($this->_capability('CONDSTORE')) {
                $enable[] = 'CONDSTORE';
            }
        }
        /* Use UTF8=ACCEPT, if available. */
        if ($this->_capability('UTF8', 'ACCEPT')) {
            $enable[] = 'UTF8=ACCEPT';
        }
        $this->_enable($enable);
        return true;
    }