]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
message: new 'ignored' property
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 7 Apr 2008 12:14:25 +0000 (14:14 +0200)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 7 Apr 2008 12:14:25 +0000 (14:14 +0200)
lib/rbot/ircbot.rb
lib/rbot/message.rb

index f1a5679252cbc295b8cb6845b3cf16639d98e5b8..9afdc46cf17a581be9a70b1dfd5aaacfa744b765 100644 (file)
@@ -566,19 +566,15 @@ class Bot
       # debug "Message target is #{data[:target].inspect}"
       # debug "Bot is #{myself.inspect}"
 
-      ignored = false
       @config['irc.ignore_users'].each { |mask|
         if m.source.matches?(server.new_netmask(mask))
-          ignored = true
-          break
+          m.ignored = true
         end
       }
 
       irclogprivmsg(m)
 
-      unless ignored
-        @plugins.irc_delegate('privmsg', m)
-      end
+      @plugins.irc_delegate('privmsg', m) unless m.ignored?
     }
     @client[:notice] = proc { |data|
       message = NoticeMessage.new(self, server, data[:source], data[:target], data[:message])
index aa825e135ba31585348c2825d6fa19e94f4d1538..bd3f85f1db315bd6e88a66601c4adb7a3698c26a 100644 (file)
@@ -128,6 +128,10 @@ module Irc
     # has the message been replied to/handled by a plugin?
     attr_accessor :replied
 
+    # should the message be ignored?
+    attr_accessor :ignored
+    alias :ignored? :ignored
+
     # instantiate a new Message
     # bot::      associated bot class
     # server::   Server where the message took place
@@ -145,6 +149,7 @@ module Irc
       @message = BasicUserMessage.stripcolour message
       @replied = false
       @server = server
+      @ignored = false
 
       @identified = false
       if @msg_wants_id && @server.capabilities[:"identify-msg"]