From eebdc6973a6ab1089ed18c0ea02e72cd6e656120 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 10 Aug 2008 01:43:32 +0200 Subject: + 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. --- lib/rbot/message.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/rbot/message.rb') 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 -- cgit v1.2.3