]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/quakeauth.rb
plugin(script): remove deprecated $SAFE
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / quakeauth.rb
index 10257adf099e78d067b45ef3cfab66510f65267f..531f14305bd32cc90211b10295039efab5598866 100644 (file)
@@ -10,7 +10,7 @@
 # Automatically auths with Q on QuakeNet servers
 
 class QPlugin < Plugin
-  
+
   def help(plugin, topic="")
     case topic
     when ""
@@ -23,7 +23,7 @@ class QPlugin < Plugin
       return "qauth register <email>: register with Q, an email on how to proceed will be sent to the email address you provide"
     end
   end
-  
+
   def initialize
     super
     # this plugin only wants to store strings!
@@ -35,6 +35,7 @@ class QPlugin < Plugin
         val
       end
     end
+    @source = nil
   end
 
   def set(m, params)
@@ -42,13 +43,13 @@ class QPlugin < Plugin
     @registry['quakenet.auth'] = params[:password]
     m.okay
   end
-  
+
   def connect
-    identify(nil, nil)
+    identify(nil, {}) if on_quakenet?
   end
 
   def identify(m, params)
-    @source = m.replyto
+    @source = m.replyto if m
     @registry['quakenet.auth'] = params[:password] if params[:password]
 
     if @registry.has_key?('quakenet.user') && @registry.has_key?('quakenet.auth')
@@ -78,6 +79,7 @@ class QPlugin < Plugin
         @bot.say @source, "username or password incorrect" if @source
       when /you are now logged in/i
         @bot.say @source, "authed successfully" if @source
+        @bot.plugins.delegate('identified')
       when /auth is not available/
         @bot.say @source, "already authed" if @source
       end