From 7b7f1309e8c3dbc3bb4408d56489ae5fba77d57a Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 18 Feb 2007 21:03:26 +0000 Subject: Initial steps towards a namespace rationalization --- lib/rbot/core/remote.rb | 4 ++-- lib/rbot/ircbot.rb | 10 +++++----- lib/rbot/rfc2812.rb | 26 +++++++++++++------------- 3 files changed, 20 insertions(+), 20 deletions(-) (limited to 'lib/rbot') diff --git a/lib/rbot/core/remote.rb b/lib/rbot/core/remote.rb index 35827d89..7ced878f 100644 --- a/lib/rbot/core/remote.rb +++ b/lib/rbot/core/remote.rb @@ -192,9 +192,9 @@ module ::Irc end - class IrcBot + class Bot - # The Irc::IrcBot::RemoteObject class represents and object that will take care + # The Irc::Bot::RemoteObject class represents and object that will take care # of interfacing with remote clients # # Example client session: diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index bd19e637..bc6cf760 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -88,8 +88,8 @@ module Irc # Main bot class, which manages the various components, receives messages, # handles them or passes them to plugins, and contains core functionality. -class IrcBot - # the bot's IrcAuth data +class Bot + # the bot's Auth data attr_reader :auth # the bot's BotConfig data @@ -134,7 +134,7 @@ class IrcBot # bot User in the client/server connection # TODO multiserver def myself - @client.client + @client.user end # bot User in the client/server connection @@ -142,7 +142,7 @@ class IrcBot myself.nick end - # create a new IrcBot with botclass +botclass+ + # create a new Bot with botclass +botclass+ def initialize(botclass, params = {}) # BotConfig for the core bot # TODO should we split socket stuff into ircsocket, etc? @@ -437,7 +437,7 @@ class IrcBot @socket = IrcSocket.new(@config['server.name'], @config['server.port'], @config['server.bindhost'], @config['server.sendq_delay'], @config['server.sendq_burst'], :ssl => @config['server.ssl']) - @client = IrcClient.new + @client = Client.new # Channels where we are quiet # Array of channels names where the bot should be quiet diff --git a/lib/rbot/rfc2812.rb b/lib/rbot/rfc2812.rb index 4a095dc8..1a5adb84 100644 --- a/lib/rbot/rfc2812.rb +++ b/lib/rbot/rfc2812.rb @@ -812,16 +812,16 @@ module Irc RPL_DATASTR=290 # implements RFC 2812 and prior IRC RFCs. - # clients register handler proc{}s for different server events and IrcClient + # clients register handler proc{}s for different server events and Client # handles dispatch - class IrcClient + class Client - attr_reader :server, :client + attr_reader :server, :user - # create a new IrcClient instance + # create a new Client instance def initialize @server = Server.new # The Server - @client = @server.user("") # The User representing the client on this Server + @user = @server.user("") # The User representing the client on this Server @handlers = Hash.new @@ -921,9 +921,9 @@ module Irc data[:target] = argv[0] # A numeric reply /should/ be directed at the client, except when we're connecting with a used nick, in which case # it's directed at '*' - not_us = !([@client.nick, '*'].include?(data[:target])) + not_us = !([@user.nick, '*'].include?(data[:target])) if not_us - warning "Server reply #{serverstring.inspect} directed at #{data[:target]} instead of client (#{@client.nick})" + warning "Server reply #{serverstring.inspect} directed at #{data[:target]} instead of client (#{@user.nick})" end num=command.to_i @@ -932,16 +932,16 @@ module Irc # "Welcome to the Internet Relay Network # !@" if not_us - warning "Server thinks client (#{@client.inspect}) has a different nick" - @client.nick = data[:target] + warning "Server thinks client (#{@user.inspect}) has a different nick" + @user.nick = data[:target] end if argv[1] =~ /(\S+)(?:!(\S+?))?@(\S+)/ nick = $1 user = $2 host = $2 warning "Welcome message nick mismatch (#{nick} vs #{data[:target]})" if nick != data[:target] - @client.user = user if user - @client.host = host if host + @user.user = user if user + @user.host = host if host end handle(:welcome, data) when RPL_YOURHOST @@ -1162,7 +1162,7 @@ module Irc data[:message] = argv[2] @server.delete_user_from_channel(data[:target], data[:channel]) - if data[:target] == @client + if data[:target] == @user @server.delete_channel(data[:channel]) end @@ -1172,7 +1172,7 @@ module Irc data[:message] = argv[1] @server.delete_user_from_channel(data[:source], data[:channel]) - if data[:source] == @client + if data[:source] == @user @server.delete_channel(data[:channel]) end -- cgit v1.2.3