From b6bd9a24014ac9fbc822e9051f216f0506f24cd5 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Wed, 13 Aug 2008 06:06:33 +0200 Subject: [PATCH] message.rb: fix message addressing logic IRC messages which are not PRIVMSG or NOTICE (i.e. not UserMessage) are 'addressed' to the bot when they originate from it. Rather than putting this logic in each one of them (and forgetting about it for some, e.g. NICK messages), put it in BasicUserMessage. Compensate by always setting @address in UserMessage to test against target instead. --- lib/rbot/message.rb | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/rbot/message.rb b/lib/rbot/message.rb index 6d14b213..f6e38e80 100644 --- a/lib/rbot/message.rb +++ b/lib/rbot/message.rb @@ -195,9 +195,7 @@ module Irc @plainmessage = BasicUserMessage.strip_formatting(@message) @message = BasicUserMessage.strip_initial_formatting(@message) - if target && target == @bot.myself - @address = true - end + @address = true if source == @bot.myself end @@ -323,9 +321,8 @@ module Irc @ctcp = false @action = false - if target == @bot.myself + if @address = (target == @bot.myself) @private = true - @address = true @channel = nil @replyto = source else @@ -543,7 +540,6 @@ module Irc attr_accessor :modes def initialize(bot, server, source, target, message="") super(bot, server, source, target, message) - @address = (source == @bot.myself) @modes = [] end @@ -558,7 +554,6 @@ module Irc attr_reader :whois def initialize(bot, server, source, target, whois) super(bot, server, source, target, "") - @address = (target == @bot.myself) @whois = whois end @@ -629,7 +624,6 @@ module Irc super(bot, server, source, channel, message) @channel = channel # in this case sourcenick is the nick that could be the bot - @address = (source == @bot.myself) end end -- 2.39.5