]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
Improve NOTICE and PRIVMSG robustness when target is not a simple channel or user
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 20 Aug 2006 21:53:02 +0000 (21:53 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 20 Aug 2006 21:53:02 +0000 (21:53 +0000)
ChangeLog
lib/rbot/rfc2812.rb

index bcfd7a45ec2e44a817c1cc3d53ff7fbbae807032..2006c95813f3a4f12a89813e78a2c851ba597c1a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@
 
        * Topic plugin: fix a bug that prevented it from loading
        correctly.
+       * New IRC Framework: make sure that NOTICEs and PRIVMSGs do not
+       raise an exception when the target is in one of the special forms
+       #<mask> or $<mask>. Needs some work, though, since this case should be
+       handled specifically.
 
 2006-08-17  Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
 
index e56c76bc6b0d80da54ad53f335c5b704c89ac27b..26549539ef5dd3eee903edda46ad3ebdebe6a8ff 100644 (file)
@@ -1095,7 +1095,15 @@ module Irc
         # parse it yourself, or you can bind to 'MSG', 'PUBLIC',
         # etc and get it all nicely split up for you.
 
-        data[:target] = @server.user_or_channel(argv[0])
+        begin
+          data[:target] = @server.user_or_channel(argv[0])
+        rescue
+          # The previous may fail e.g. when the target is a server or something
+          # like that (e.g. $<mask>). In any of these cases, we just use the
+          # String as a target
+          # FIXME we probably want to explicitly check for the #<mask> $<mask>
+          data[:target] = argv[0]
+        end
         data[:message] = argv[1]
         handle(:privmsg, data)
 
@@ -1106,7 +1114,15 @@ module Irc
           handle(:msg, data)
         end
       when 'NOTICE'
-        data[:target] = @server.user_or_channel(argv[0])
+        begin
+          data[:target] = @server.user_or_channel(argv[0])
+        rescue
+          # The previous may fail e.g. when the target is a server or something
+          # like that (e.g. $<mask>). In any of these cases, we just use the
+          # String as a target
+          # FIXME we probably want to explicitly check for the #<mask> $<mask>
+          data[:target] = argv[0]
+        end
         data[:message] = argv[1]
         case data[:source]
         when User