diff options
Diffstat (limited to 'lib/rbot')
-rw-r--r-- | lib/rbot/irc.rb | 1 | ||||
-rw-r--r-- | lib/rbot/ircbot.rb | 12 | ||||
-rw-r--r-- | lib/rbot/rfc2812.rb | 10 |
3 files changed, 16 insertions, 7 deletions
diff --git a/lib/rbot/irc.rb b/lib/rbot/irc.rb index 3febc82a..a0ffbd91 100644 --- a/lib/rbot/irc.rb +++ b/lib/rbot/irc.rb @@ -1370,6 +1370,7 @@ module Irc def clear
reset_lists
reset_capabilities
+ @hostname = @version = @usermodes = @chanmodes = nil
end
# This method is used to parse a 004 RPL_MY_INFO line
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index c87b909b..a95301dd 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -513,11 +513,19 @@ class IrcBot } } @client[:nicktaken] = proc { |data| - nickchg "#{data[:nick]}_" + new = "#{data[:nick]}_" + nickchg new + # If we're setting our nick at connection because our choice was taken, + # we have to fix our nick manually, because there will be no NICK message + # yo inform us that our nick has been changed. + if data[:target] == '*' + debug "setting my connection nick to #{new}" + nick = new + end @plugins.delegate "nicktaken", data[:nick] } @client[:badnick] = proc {|data| - warning "bad nick (#{data[:nick]})" + arning "bad nick (#{data[:nick]})" } @client[:ping] = proc {|data| sendq "PONG #{data[:pingid]}" diff --git a/lib/rbot/rfc2812.rb b/lib/rbot/rfc2812.rb index 1888f75f..cc7fd7e7 100644 --- a/lib/rbot/rfc2812.rb +++ b/lib/rbot/rfc2812.rb @@ -917,12 +917,12 @@ module Irc params.scan(/(?!:)(\S+)|:(.*)/) { argv << ($1 || $2) } if params if command =~ /^(\d+)$/ # Numeric replies - data[:nick] = argv[0] + 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[:nick])) + not_us = !([@client.nick, '*'].include?(data[:target])) if not_us - warning "Server reply #{serverstring.inspect} directed at #{data[:nick]} instead of client (#{@client.nick})" + warning "Server reply #{serverstring.inspect} directed at #{data[:target]} instead of client (#{@client.nick})" end num=command.to_i @@ -932,13 +932,13 @@ module Irc # <nick>!<user>@<host>" if not_us warning "Server thinks client (#{@client.inspect}) has a different nick" - @client.nick = data[:nick] + @client.nick = data[:target] end if argv[1] =~ /(\S+)(?:!(\S+?))?@(\S+)/ nick = $1 user = $2 host = $2 - warning "Welcome message nick mismatch (#{nick} vs #{data[:nick]})" if nick != data[:nick] + warning "Welcome message nick mismatch (#{nick} vs #{data[:target]})" if nick != data[:target] @client.user = user if user @client.host = host if host end |