summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
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