    # File lib/rbot/ircbot.rb, line 1088
      def disconnect(message=nil)
        message = @lang.get("quit") if (!message || message.empty?)
        if @socket.connected?
          begin
            debug "Clearing socket"
            @socket.clearq
            debug "Sending quit message"
            @socket.emergency_puts "QUIT :#{message}"
            debug "Logging quits"
            delegate_sent('QUIT', myself, message)
            debug "Flushing socket"
            @socket.flush
          rescue SocketError => e
            error "error while disconnecting socket: #{e.pretty_inspect}"
          end
          debug "Shutting down socket"
          @socket.shutdown
        end
        stop_server_pings
        @client.reset
      end