]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
Adapt opme plugin to new auth framework
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sat, 9 Sep 2006 05:58:08 +0000 (05:58 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sat, 9 Sep 2006 05:58:08 +0000 (05:58 +0000)
ChangeLog
data/rbot/plugins/opme.rb

index 941bb6e3db6a42a6318d1c1ce201ef0096e8584e..76b43e66fd133a3b43e3c116be3405ea5b9f997d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-09-09  Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
+
+       * New Auth Framework: rbot was opping anyone who asked for it (opme
+       plugin). Fixed, and cleaned up.
+
 2006-09-01  Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
 
        * New Auth Framework: document and fine tune permissions view the auth
index 3df3d0d111b885c1fded47ce0964d6e9749ea020..54f61b91ae248459ff118a263e8941d3dadbaf26 100644 (file)
@@ -1,19 +1,25 @@
 class OpMePlugin < Plugin
 
   def help(plugin, topic="")
-    return "opme <channel> => grant user ops in <channel>"
+    return "opme [<channel>] => grant user ops in <channel> (or in the current channel if no channel is specified)"
   end
 
-  def privmsg(m)
-    if(m.params)
-      channel = m.params
-    else
-      channel = m.channel
+  def opme(m, params)
+    channel = params[:chan]
+    unless channel
+      if m.private?
+        m.reply "you should tell me where you want me to op you"
+        return
+      else
+        channel = m.channel.to_s
+      end
     end
     target = m.sourcenick
-    m.okay
+    m.okay unless channel == m.channel.to_s
     @bot.sendq("MODE #{channel} +o #{target}")
   end
 end
+
 plugin = OpMePlugin.new
-plugin.register("opme")
+plugin.map("opme [:chan]")
+plugin.default_auth("*",false)