summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2009-01-28 21:39:18 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2009-01-28 21:39:18 +0100
commitb9fd5f1df8db0a7e8654add8e7e1afb9099a022a (patch)
treee58f3bcab34df7539ca892379280f6c7332276c3
parent575c4c14d527e4dc06e015ffce7aafd6307a7692 (diff)
ircbot: optimize ignore loops
Break early from ignore checks, and skip them altogether when the message is ignored already.
-rw-r--r--lib/rbot/ircbot.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb
index d5d3828b..1c03d93c 100644
--- a/lib/rbot/ircbot.rb
+++ b/lib/rbot/ircbot.rb
@@ -645,13 +645,15 @@ class Bot
@config['irc.ignore_channels'].each { |channel|
if m.target.downcase == channel.downcase
m.ignored = true
+ break
end
}
@config['irc.ignore_users'].each { |mask|
if m.source.matches?(server.new_netmask(mask))
m.ignored = true
+ break
end
- }
+ } unless m.ignored
@plugins.irc_delegate('privmsg', m)
}