From d3883617a4ceaf6fbf88620a00000e4909c78c14 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Wed, 30 Jul 2008 22:39:17 +0200 Subject: nickrecover plugin: single irc.nick_retry config instead of multiple nickrecover.* entries --- data/rbot/plugins/nickrecover.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'data') diff --git a/data/rbot/plugins/nickrecover.rb b/data/rbot/plugins/nickrecover.rb index 24b41a04..b6d8e61e 100644 --- a/data/rbot/plugins/nickrecover.rb +++ b/data/rbot/plugins/nickrecover.rb @@ -12,23 +12,23 @@ class NickRecoverPlugin < Plugin - Config.register Config::BooleanValue.new('nickrecover.enabled', - :default => true, :requires_restart => false, - :desc => _("Should the bot try to recover its nick?")) - - Config.register Config::IntegerValue.new('nickrecover.poll_time', - :default => 60, :valiedate => Proc.new { |v| v > 0 }, + Config.register Config::IntegerValue.new('irc.nick_retry', + :default => 60, :valiedate => Proc.new { |v| v >= 0 }, :on_change => Proc.new do |bot, v| - bot.plugin['nickrecover'].start_recovery(v) + if v > 0 + bot.plugin['nickrecover'].start_recovery(v) + else + bot.plugin['nickrecover'].stop_recovery + end end, :requires_restart => false, :desc => _("Time in seconds to wait between attempts to recover the nick")) def enabled? - @bot.config['nickrecover.enabled'] + @bot.config['irc.nick_retry'] > 0 end def poll_time - @bot.config['nickrecover.poll_time'] + @bot.config['irc.nick_retry'] end def wanted_nick -- cgit v1.2.3