    # File lib/rbot/ircbot.rb, line 843
      def connect
        begin
          quit if $interrupted > 0
          @socket.connect
        rescue => e
          raise e.class, "failed to connect to IRC server at #{@socket.server_uri}: " + e
        end
        quit if $interrupted > 0

        realname = @config['irc.name'].clone || 'Ruby bot'
        realname << ' ' + COPYRIGHT_NOTICE if @config['irc.name_copyright']

        @socket.emergency_puts "PASS " + @config['server.password'] if @config['server.password']
        @socket.emergency_puts "NICK #{@config['irc.nick']}\nUSER #{@config['irc.user']} 4 #{@socket.server_uri.host} :#{realname}"
        quit if $interrupted > 0
        myself.nick = @config['irc.nick']
        myself.user = @config['irc.user']
      end