]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
auth botmodule: auth_allow_deny() accepts an optional :auth_path parameter
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 3 Nov 2008 21:38:35 +0000 (22:38 +0100)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 3 Nov 2008 21:38:35 +0000 (22:38 +0100)
lib/rbot/core/auth.rb

index 75c59f27cd55c93e5713c1a8495b44ded3aa1b67..9e9d35758aa20516d05bb0c1e9670a8b0c3c0157 100644 (file)
@@ -242,23 +242,27 @@ class AuthModule < CoreBotModule
       where = m.parse_channel_list(p[:where].to_s).first # should only be one anyway
     end
 
-    # pseudo-message to find the template. The source is ignored, and the
-    # target is set according to where the template should be checked
-    # (public or private)
-    # This might still fail in the case of 'everywhere' for commands there are
-    # really only private
-    case where
-    when :"?"
-      pseudo_target = @bot.myself
-    when :*
-      pseudo_target = m.channel
+    if p.has_key? :auth_path
+      auth_path = p[:auth_path]
     else
-      pseudo_target = m.server.channel(where)
-    end
+      # pseudo-message to find the template. The source is ignored, and the
+      # target is set according to where the template should be checked
+      # (public or private)
+      # This might still fail in the case of 'everywhere' for commands there are
+      # really only private
+      case where
+      when :"?"
+        pseudo_target = @bot.myself
+      when :*
+        pseudo_target = m.channel
+      else
+        pseudo_target = m.server.channel(where)
+      end
 
-    pseudo = PrivMessage.new(bot, m.server, m.source, pseudo_target, p[:stuff].to_s)
+      pseudo = PrivMessage.new(bot, m.server, m.source, pseudo_target, p[:stuff].to_s)
 
-    auth_path = find_auth(pseudo)
+      auth_path = find_auth(pseudo)
+    end
     debug auth_path
 
     if auth_path