summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-08-13 06:38:43 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-08-13 06:38:43 +0200
commit87c4514e5fbe9eeea139a4bb7250755570f9adcb (patch)
tree0779a44c32739dc5fdbc33b7e4109c0a2d50165a /data
parentb6bd9a24014ac9fbc822e9051f216f0506f24cd5 (diff)
nickrecover plugin: work more than once per session
Diffstat (limited to 'data')
-rw-r--r--data/rbot/plugins/nickrecover.rb18
1 files changed, 13 insertions, 5 deletions
diff --git a/data/rbot/plugins/nickrecover.rb b/data/rbot/plugins/nickrecover.rb
index 02def493..ed3c8708 100644
--- a/data/rbot/plugins/nickrecover.rb
+++ b/data/rbot/plugins/nickrecover.rb
@@ -52,17 +52,25 @@ class NickRecoverPlugin < Plugin
end
def stop_recovery
- @bot.timer.remove(@recovery) if @recovery
+ begin
+ @bot.timer.remove(@recovery) if @recovery
+ ensure
+ @recovery = nil
+ end
end
def start_recovery(time=self.poll_time)
if @recovery
- @bot.timer.reschedule(@recovery, poll_time)
- else
- @recovery = @bot.timer.add(time) do
- has_nick? ? stop_recovery : recover
+ begin
+ @bot.timer.reschedule(@recovery, poll_time)
+ return
+ rescue
+ @recovery=nil
end
end
+ @recovery = @bot.timer.add(time) do
+ has_nick? ? stop_recovery : recover
+ end
end
def initialize