function disconnect($quick = false)
    {
        if ($this->_updatestate() != SMARTIRC_STATE_CONNECTED) {
            return false;
        }

        if (!$quick) {
            $this->send('QUIT', SMARTIRC_CRITICAL);
            usleep($this->_disconnecttime*1000);
        }

        fclose($this->_socket);

        $this->_updatestate();
        $this->log(SMARTIRC_DEBUG_CONNECTION, 'DEBUG_CONNECTION: disconnected',
            __FILE__, __LINE__
        );

        if ($this->_channelsyncing) {
            // let's clean our channel array
            $this->_channels = array();
            $this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: '
                .'cleaned channel array', __FILE__, __LINE__
            );
        }

        if ($this->_usersyncing) {
            // let's clean our user array
            $this->_users = array();
            $this->log(SMARTIRC_DEBUG_USERSYNCING, 'DEBUG_USERSYNCING: cleaned '
                .'user array', __FILE__, __LINE__
            );
        }

        if ($this->_logdestination == SMARTIRC_FILE) {
            fclose($this->_logfilefp);
            $this->_logfilefp = null;
        } else if ($this->_logdestination == SMARTIRC_SYSLOG) {
            closelog();
        }

        return $this;
    }
function disconnect($quick = false)
    {
        if ($this->_updatestate() != SMARTIRC_STATE_CONNECTED) {
            return false;
        }

        if (!$quick) {
            $this->send('QUIT', SMARTIRC_CRITICAL);
            usleep($this->_disconnecttime*1000);
        }

        fclose($this->_socket);

        $this->_updatestate();
        $this->log(SMARTIRC_DEBUG_CONNECTION, 'DEBUG_CONNECTION: disconnected',
            __FILE__, __LINE__
        );

        if ($this->_channelsyncing) {
            // let's clean our channel array
            $this->_channels = array();
            $this->log(SMARTIRC_DEBUG_CHANNELSYNCING, 'DEBUG_CHANNELSYNCING: '
                .'cleaned channel array', __FILE__, __LINE__
            );
        }

        if ($this->_usersyncing) {
            // let's clean our user array
            $this->_users = array();
            $this->log(SMARTIRC_DEBUG_USERSYNCING, 'DEBUG_USERSYNCING: cleaned '
                .'user array', __FILE__, __LINE__
            );
        }

        if ($this->_logdestination == SMARTIRC_FILE) {
            fclose($this->_logfilefp);
            $this->_logfilefp = null;
        } else if ($this->_logdestination == SMARTIRC_SYSLOG) {
            closelog();
        }

        return $this;
    }
function disconnect ( $ quick = false ) { if ( $ this -> _updatestate ( ) != SMARTIRC_STATE_CONNECTED ) { return false ; } if ( ! $ quick ) { $ this -> send ( 'QUIT' , SMARTIRC_CRITICAL ) ; usleep ( $ this -> _disconnecttime * 1000 ) ; } fclose ( $ this -> _socket ) ; $ this -> _updatestate ( ) ; $ this -> log ( SMARTIRC_DEBUG_CONNECTION , 'DEBUG_CONNECTION: disconnected' , __FILE__ , __LINE__ ) ; if ( $ this -> _channelsyncing ) { // let's clean our channel array $ this -> _channels = array ( ) ; $ this -> log ( SMARTIRC_DEBUG_CHANNELSYNCING , 'DEBUG_CHANNELSYNCING: ' . 'cleaned channel array' , __FILE__ , __LINE__ ) ; } if ( $ this -> _usersyncing ) { // let's clean our user array $ this -> _users = array ( ) ; $ this -> log ( SMARTIRC_DEBUG_USERSYNCING , 'DEBUG_USERSYNCING: cleaned ' . 'user array' , __FILE__ , __LINE__ ) ; } if ( $ this -> _logdestination == SMARTIRC_FILE ) { fclose ( $ this -> _logfilefp ) ; $ this -> _logfilefp = null ; } else if ( $ this -> _logdestination == SMARTIRC_SYSLOG ) { closelog ( ) ; } return $ this ; }
Disconnects from the IRC server nicely with a QUIT or just destroys the socket.

Disconnects from the IRC server in the given quickness mode.
$quick:
- true, just close the socket
- false, send QUIT and wait {@link $_disconnectime $_disconnectime} before
closing the socket

@api
@param boolean $quick default: false
@return boolean|Net_SmartIRC
Disconnects from the IRC server nicely with a QUIT or just destroys the socket .