]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
* fix handling of IDENTIFY_MSG
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 29 Jun 2008 18:19:41 +0000 (20:19 +0200)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 29 Jun 2008 18:19:41 +0000 (20:19 +0200)
When a server has IDENTIFY-MSG, we would expect identification in any
PRIVMSG or NOTICE, even on those generated from the bot. This caused
lots of spurious warnings, and would lead to mislogging when a
bot-generated message started with + or -.

Fix this by only handling IDENTIFY-MSG on server-generated messages.

lib/rbot/ircbot.rb
lib/rbot/message.rb

index 403f496d4a2fcc54e52696cc2df4a24e146cd573..91c383a5f253a67d335826ceeb74d930adee9563 100644 (file)
@@ -615,7 +615,7 @@ class Bot
     }
 
     @client[:privmsg] = proc { |data|
-      m = PrivMessage.new(self, server, data[:source], data[:target], data[:message])
+      m = PrivMessage.new(self, server, data[:source], data[:target], data[:message], :handle_id => true)
       # debug "Message source is #{data[:source].inspect}"
       # debug "Message target is #{data[:target].inspect}"
       # debug "Bot is #{myself.inspect}"
@@ -629,7 +629,7 @@ class Bot
       @plugins.irc_delegate('privmsg', m)
     }
     @client[:notice] = proc { |data|
-      message = NoticeMessage.new(self, server, data[:source], data[:target], data[:message])
+      message = NoticeMessage.new(self, server, data[:source], data[:target], data[:message], :handle_id => true)
       # pass it off to plugins that want to hear everything
       @plugins.irc_delegate "notice", message
     }
index 901626ec7e6eaf232858c6a3cdbe2a02692dbb87..6354ea11ffcdeb80e7d4ea9e61764e8c50713a6f 100644 (file)
@@ -467,17 +467,17 @@ module Irc
 
   # class to manage IRC PRIVMSGs
   class PrivMessage < UserMessage
-    def initialize(bot, server, source, target, message)
-      @msg_wants_id = true
-      super
+    def initialize(bot, server, source, target, message, opts={})
+      @msg_wants_id = opts[:handle_id]
+      super(bot, server, source, target, message)
     end
   end
 
   # class to manage IRC NOTICEs
   class NoticeMessage < UserMessage
-    def initialize(bot, server, source, target, message)
-      @msg_wants_id = true
-      super
+    def initialize(bot, server, source, target, message, opts={})
+      @msg_wants_id = opts[:handle_id]
+      super(bot, server, source, target, message)
     end
   end