summaryrefslogtreecommitdiff
path: root/lib/rbot/ircbot.rb
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2006-07-22 23:16:40 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2006-07-22 23:16:40 +0000
commit519d8144025dc734c11aac05a8b5e61c488dfb8a (patch)
treebf88fd0c16f60c09544f32bb6012932fb77cbb4e /lib/rbot/ircbot.rb
parenta2c9a18474c4cb50d45aebb58c2d47bd98a886e7 (diff)
Implement support for the CAPAB IDENTIFY-MSG capability available on some server, therefore providing messages with the identified? method that tells if the sourcenick has identified with services or not
Diffstat (limited to 'lib/rbot/ircbot.rb')
-rw-r--r--lib/rbot/ircbot.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb
index f1aa7e50..966e5a84 100644
--- a/lib/rbot/ircbot.rb
+++ b/lib/rbot/ircbot.rb
@@ -83,6 +83,9 @@ class IrcBot
# bot's Language data
attr_reader :lang
+ # capabilities info for the server
+ attr_reader :capabilities
+
# channel info for channels the bot is in
attr_reader :channels
@@ -250,6 +253,19 @@ class IrcBot
@nick = @config['irc.nick']
@client = IrcClient.new
+ @client[:isupport] = proc { |data|
+ if data[:capab]
+ sendq "CAPAB IDENTIFY-MSG"
+ end
+ }
+ @client[:datastr] = proc { |data|
+ debug data.inspect
+ if data[:text] == "IDENTIFY-MSG"
+ @capabilities["identify-msg".to_sym] = true
+ else
+ debug "Not handling RPL_DATASTR #{data[:servermessage]}"
+ end
+ }
@client[:privmsg] = proc { |data|
message = PrivMessage.new(self, data[:source], data[:target], data[:message])
onprivmsg(message)
@@ -430,6 +446,7 @@ class IrcBot
end
@socket.emergency_puts "PASS " + @config['server.password'] if @config['server.password']
@socket.emergency_puts "NICK #{@nick}\nUSER #{@config['irc.user']} 4 #{@config['server.name']} :Ruby bot. (c) Tom Gilbert"
+ @capabilities = Hash.new
start_server_pings
end