Permalink
Browse files

ircconnection: receive_line: move ignore checks into new private func…

…tion
  • Loading branch information...
kabaka committed Dec 14, 2015
1 parent fcad2a9 commit eb48bab8b749675f55969c6aa346b8e15f702184
Showing with 13 additions and 8 deletions.
  1. +13 −8 lib/ircconnection.rb
@@ -223,17 +223,12 @@ def receive_data data
def receive_line line
msg = Message.new self, line.clone
Bot::Ignores.each do |ignore|
break unless msg.origin
if msg.origin.wildcard_match ignore
$log.debug("IRCConnection.receive_line #{@name}") { "Ignoring message from #{msg.origin}" }
return
end
if ignore_msg? msg
$log.debug("IRCConnection.receive_line #{@name}") { "Ignoring message from #{msg.origin}" }
return
end
begin
Events.dispatch :raw, msg
Events.dispatch msg.type, msg
@@ -550,6 +545,16 @@ def to_s
"#{@name} (#{@channels.length} channels)"
end
private
def ignore_msg? msg
return false unless msg.origin
Bot::Ignores.any? do |ignore|
msg.origin.wildcard_match ignore
end
end
end
end

0 comments on commit eb48bab

Please sign in to comment.