summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-04-07 14:14:25 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-04-07 14:14:25 +0200
commit6defc06a719501298575e239e4094d07814136b6 (patch)
treec47c865883ca1e7fd835c1fc1ca9f3cf272f13dd
parentb8802b0ff7eb9695ddf3372c80698405c24ffe97 (diff)
message: new 'ignored' property
-rw-r--r--lib/rbot/ircbot.rb8
-rw-r--r--lib/rbot/message.rb5
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb
index f1a56792..9afdc46c 100644
--- a/lib/rbot/ircbot.rb
+++ b/lib/rbot/ircbot.rb
@@ -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])
diff --git a/lib/rbot/message.rb b/lib/rbot/message.rb
index aa825e13..bd3f85f1 100644
--- a/lib/rbot/message.rb
+++ b/lib/rbot/message.rb
@@ -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"]