]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - lib/rbot/irc.rb
Lots of fixes all around, in preparation for the new auth coremodule
[user/henk/code/ruby/rbot.git] / lib / rbot / irc.rb
index ffc2be7182681862bf4dacc80e1c220b40cdce7d..74db8e85fd4d1ff750803760c2cce91fa6298b94 100644 (file)
@@ -373,12 +373,12 @@ module Irc
     # globs is not handled yet.\r
     # \r
     def matches?(arg)\r
-      cmp = Netmask(arg)\r
+      cmp = Netmask.new(arg)\r
       raise TypeError, "#{arg} and #{self} have different casemaps" if @casemap != cmp.casemap\r
       raise TypeError, "#{arg} is not a valid Netmask" unless cmp.class <= Netmask\r
       [:nick, :user, :host].each { |component|\r
-        us = self.send(:component)\r
-        them = cmp.send(:component)\r
+        us = self.send(component)\r
+        them = cmp.send(component)\r
         raise NotImplementedError if us.has_irc_glob? && them.has_irc_glob?\r
         return false if us.has_irc_glob? && !them.has_irc_glob?\r
         return false unless us =~ them.to_irc_regexp\r
@@ -389,7 +389,7 @@ module Irc
     # Case equality. Checks if arg matches self\r
     #\r
     def ===(arg)\r
-      Netmask(arg).matches?(self)\r
+      Netmask.new(arg).matches?(self)\r
     end\r
   end\r
 \r
@@ -951,7 +951,7 @@ module Irc
     # a name of\r
     #\r
     def user_or_channel?(name)\r
-      if supports[:chantypes].include?(name[0].chr)\r
+      if supports[:chantypes].include?(name[0])\r
         return Channel\r
       else\r
         return User\r
@@ -961,7 +961,7 @@ module Irc
     # Returns the actual User or Channel object matching _name_\r
     #\r
     def user_or_channel(name)\r
-      if supports[:chantypes].include?(name[0].chr)\r
+      if supports[:chantypes].include?(name[0])\r
         return channel(name)\r
       else\r
         return user(name)\r
@@ -1132,15 +1132,7 @@ module Irc
     # new_user(_str_, +false+)\r
     #\r
     def user(str)\r
-      # This method can get called before server has been initialized (e.g. on\r
-      # Freenode there is a NOTICE from AUTH on connect). In this case we just\r
-      # return the string\r
-      #\r
-      if defined?(@supports)\r
-        new_user(str, false)\r
-      else\r
-        str\r
-      end\r
+      new_user(str, false)\r
     end\r
 \r
     # Remove User _someuser_ from the list of <code>User</code>s.\r