summaryrefslogtreecommitdiff
path: root/data/rbot/plugins/nickserv.rb
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-02-18 20:44:40 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-02-18 20:44:40 +0000
commit9b1197d23b9353e27ffae3d687bc5b35ba9e78b5 (patch)
tree6c07c014cccbfbd14c9630acabc53229a385af60 /data/rbot/plugins/nickserv.rb
parentedd1cf77be07ae507014574141e920ad23eb164d (diff)
nickserv plugin: export information on current identification status
Diffstat (limited to 'data/rbot/plugins/nickserv.rb')
-rw-r--r--data/rbot/plugins/nickserv.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/data/rbot/plugins/nickserv.rb b/data/rbot/plugins/nickserv.rb
index 85270933..f23705e3 100644
--- a/data/rbot/plugins/nickserv.rb
+++ b/data/rbot/plugins/nickserv.rb
@@ -15,12 +15,16 @@
# Takes over proper nick if required and nick is registered
# TODO:: allow custom IDENTIFY and GHOST names
+#
+# FIXME:: identified? status returns false after a rescan, even if the bot
+# previously identified successfully
class NickServPlugin < Plugin
BotConfig.register BotConfigStringValue.new('nickserv.name',
:default => "nickserv", :requires_restart => false,
:desc => "Name of the nick server (all lowercase)")
+
BotConfig.register BotConfigStringValue.new('nickserv.ident_request',
:default => "IDENTIFY", :requires_restart => false,
:on_change => Proc.new { |bot, v| bot.plugins.delegate "set_ident_request", v },
@@ -30,9 +34,16 @@ class NickServPlugin < Plugin
:requires_restart => false,
:on_change => Proc.new { |bot, v| bot.plugins.delegate "set_nick_avail", v },
:desc => "String to look for to see if the nick server is informing us that our nick is now available")
+ BotConfig.register BotConfigStringValue.new('nickserv.identified_string',
+ :default => "(Password|Contrase|Mot de passe).+(acce[pt]t|r[ie]cog?n).+(identif|r[ie]cog?n)",
+ :requires_restart => false,
+ :on_change => Proc.new { |bot, v| bot.plugins.delegate "set_identified_string", v },
+ :desc => "String to look for to see if the nick server is informing us that we have identified successfully")
+
BotConfig.register BotConfigBooleanValue.new('nickserv.wants_nick',
:default => false, :requires_restart => false,
:desc => "Set to false if the nick server doesn't expect the nick as a parameter in the identify command")
+
BotConfig.register BotConfigIntegerValue.new('nickserv.wait',
:default => 30, :validate => Proc.new { |v| v > 0 }, :requires_restart => false,
:desc => "Seconds to wait after sending a message to nickserv, e.g. after ghosting")
@@ -64,6 +75,10 @@ class NickServPlugin < Plugin
@nick_avail = Regexp.new(val)
end
+ def set_identified_string(val)
+ @identified_string = Regexp.new(val)
+ end
+
def initialize
super
# this plugin only wants to store strings!
@@ -77,6 +92,8 @@ class NickServPlugin < Plugin
end
set_ident_request(@bot.config['nickserv.ident_request'])
set_nick_avail(@bot.config['nickserv.nick_avail'])
+ set_identified_string(@bot.config['nickserv.identified'])
+ @identified = false
end
# Returns the nickserv name
@@ -152,6 +169,7 @@ class NickServPlugin < Plugin
end
def connect
+ @identified = false
do_identify
end
@@ -172,9 +190,17 @@ class NickServPlugin < Plugin
when @nick_avail
debug "our nick seems to be free now"
@bot.nickchg @bot.config['irc.nick']
+ when @identified_string
+ debug "we identified successfully to nickserv"
+ @identified = true
+ @bot.plugins.delegate('identified')
end
end
+ def identified?
+ return @identified
+ end
+
end
plugin = NickServPlugin.new
plugin.map 'nickserv password [:nick] :passwd', :action => "password"