diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-08-29 10:46:14 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-08-29 10:46:14 +0000 |
commit | 9f3561b05bef1ba04f9cc49ea4fb89a49b6291a4 (patch) | |
tree | bd7054418b7b0b1bf44bc91feded676d0a65722e | |
parent | 4a86158144a13bc901222442ccd2db9c2bbd6bb0 (diff) |
timers: get rid of useless data passing to timer actions.
The timer blocks are closures, so they inherit the variables in the scope they were created. Passing those same variables to the block as data is useless.
-rw-r--r-- | data/rbot/plugins/autorejoin.rb | 2 | ||||
-rw-r--r-- | data/rbot/plugins/markov.rb | 2 | ||||
-rw-r--r-- | data/rbot/plugins/rss.rb | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/data/rbot/plugins/autorejoin.rb b/data/rbot/plugins/autorejoin.rb index a8d65958..fde8827c 100644 --- a/data/rbot/plugins/autorejoin.rb +++ b/data/rbot/plugins/autorejoin.rb @@ -11,7 +11,7 @@ class AutoRejoinPlugin < Plugin if m.address? r = rand(10) if r > 0 - @bot.timer.add_once(r, m) {|m| + @bot.timer.add_once(r) { @bot.join m.channel @bot.say(m.channel, @bot.lang.get("insult") % m.sourcenick) if @bot.config['rejoin.insult'] } diff --git a/data/rbot/plugins/markov.rb b/data/rbot/plugins/markov.rb index de33136e..14cd0f99 100644 --- a/data/rbot/plugins/markov.rb +++ b/data/rbot/plugins/markov.rb @@ -133,7 +133,7 @@ class MarkovPlugin < Plugin line = generate_string(word1, word2) return unless line return if line == message - @bot.timer.add_once(delay, m) {|m| + @bot.timer.add_once(delay) { m.reply line } end diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb index c34e5926..ce52420a 100644 --- a/data/rbot/plugins/rss.rb +++ b/data/rbot/plugins/rss.rb @@ -679,7 +679,7 @@ class RSSFeedsPlugin < Plugin status = Hash.new
status[:failures] = 0
status[:first_run] = true
- @watch[feed.handle] = @bot.timer.add(0, status) {
+ @watch[feed.handle] = @bot.timer.add(0) {
debug "watcher for #{feed} started"
failures = status[:failures]
first_run = status.delete(:first_run)
|