Changeset b6bd9a24014ac9fbc822e9051f216f0506f24cd5

Show
Ignore:
Timestamp:
08/13/08 08:06:33 (3 months ago)
Author:
Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
git-committer:
Giuseppe Bilotta <giuseppe.bilotta@gmail.com> 1218600393 +0200
git-parent:

[940264d1718b5a32d34ac82276a29f0cc1a51941]

git-author:
Giuseppe Bilotta <giuseppe.bilotta@gmail.com> 1218600393 +0200
Message:

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.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lib/rbot/message.rb

    reebdc69 rb6bd9a2  
    196196      @message = BasicUserMessage.strip_initial_formatting(@message) 
    197197 
    198       if target && target == @bot.myself 
    199         @address = true 
    200       end 
     198      @address = true if source == @bot.myself 
    201199 
    202200    end 
     
    324322      @action = false 
    325323 
    326       if target == @bot.myself 
     324      if @address = (target == @bot.myself) 
    327325        @private = true 
    328         @address = true 
    329326        @channel = nil 
    330327        @replyto = source 
     
    544541    def initialize(bot, server, source, target, message="") 
    545542      super(bot, server, source, target, message) 
    546       @address = (source == @bot.myself) 
    547543      @modes = [] 
    548544    end 
     
    559555    def initialize(bot, server, source, target, whois) 
    560556      super(bot, server, source, target, "") 
    561       @address = (target == @bot.myself) 
    562557      @whois = whois 
    563558    end 
     
    630625      @channel = channel 
    631626      # in this case sourcenick is the nick that could be the bot 
    632       @address = (source == @bot.myself) 
    633627    end 
    634628  end