diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-07-30 22:39:17 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-07-30 22:45:06 +0200 |
commit | d3883617a4ceaf6fbf88620a00000e4909c78c14 (patch) | |
tree | 7f6bc1db90ed2e711d191a2593b70a4006ee335c | |
parent | 346b8670f3470166f2d33efade6570b7578a9a48 (diff) |
nickrecover plugin: single irc.nick_retry config instead of multiple nickrecover.* entries
-rw-r--r-- | data/rbot/plugins/nickrecover.rb | 18 |
1 files changed, 9 insertions, 9 deletions
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 |