diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-08-10 01:43:32 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-08-10 01:47:13 +0200 |
commit | eebdc6973a6ab1089ed18c0ea02e72cd6e656120 (patch) | |
tree | 714e77316f6015ce19d371534a41819d342acbb1 /lib/rbot/message.rb | |
parent | fa4a71c43227669b42b4b1c0a68be796091f3d1d (diff) |
+ handle WHOIS queries
The bot now exposes a whois(nick) method to make WHOIS queries to the
server. The extended syntax whois(nick, server) is also supported,
allowing another server to be queried (this is useful to retrieve info
which is only available on nick's server, such as idle time and signon
date).
Most if not all RFC-compliant replies are handled, although some of the
data received is currently ignored. Non-RFC extended replies such as
nickserv identification status are not hanlded yet, since they are
highly server-specific, both in numeric reply choice (e.g. 307 vs 320)
and in reply message syntax and meaning.
A new WhoisMessage is also introduced, for plugin delegation. The source
is the originating server, the target is the user for which information
was requested. A #whois() method is provided holding all retrieved
information.
Diffstat (limited to 'lib/rbot/message.rb')
-rw-r--r-- | lib/rbot/message.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/rbot/message.rb b/lib/rbot/message.rb index 5d6ea60f..6d14b213 100644 --- a/lib/rbot/message.rb +++ b/lib/rbot/message.rb @@ -553,6 +553,21 @@ module Irc end end + # class to manage WHOIS replies + class WhoisMessage < BasicUserMessage + attr_reader :whois + def initialize(bot, server, source, target, whois) + super(bot, server, source, target, "") + @address = (target == @bot.myself) + @whois = whois + end + + def inspect + fields = ' whois=' << whois.inspect + super(fields) + end + end + # class to manage NAME replies class NamesMessage < BasicUserMessage attr_accessor :users |