]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - lib/rbot/message.rb
message.rb: fix message addressing logic
[user/henk/code/ruby/rbot.git] / lib / rbot / message.rb
index 6d14b2137c8007d6fb519c94d28119e204e8428b..f6e38e80a73d8f2359f38508466807b51b30c7b4 100644 (file)
@@ -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