diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-08-13 06:06:33 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-08-13 06:06:33 +0200 |
commit | b6bd9a24014ac9fbc822e9051f216f0506f24cd5 (patch) | |
tree | 1ed6e0da04957ab71cfbf6a446116f79d2429ffe /lib/rbot/message.rb | |
parent | 940264d1718b5a32d34ac82276a29f0cc1a51941 (diff) |
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.
Diffstat (limited to 'lib/rbot/message.rb')
-rw-r--r-- | lib/rbot/message.rb | 10 |
1 files 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 |