]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
ircbot: optimize ignore loops
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Wed, 28 Jan 2009 20:39:18 +0000 (21:39 +0100)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Wed, 28 Jan 2009 20:39:18 +0000 (21:39 +0100)
Break early from ignore checks, and skip them altogether when the
message is ignored already.

lib/rbot/ircbot.rb

index d5d3828be2cdb208beea16014d748d9ba219c491..1c03d93cee02be93f28c224ab4cae9bc02438c61 100644 (file)
@@ -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)
     }