]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/wserver.rb
Fri Jul 29 13:07:56 BST 2005 Tom Gilbert <tom@linuxbrit.co.uk>
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / wserver.rb
index e1fe10bd341f1eafc675659c566612c3d4db8793..fb4738c173a13bcd6e662227478e5c6c97071d34 100644 (file)
@@ -6,14 +6,10 @@ class WserverPlugin < Plugin
   def help(plugin, topic="")
     "wserver <uri> => try and determine what webserver <uri> is using"
   end
-  def privmsg(m)
-    unless(m.params && m.params =~ /^\S+$/)
-      m.reply "incorrect usage: " + help(m.plugins)
-      return
-    end
 
+  def wserver(m, params)
     redirect_count = 0
-    hostname = m.params.dup
+    hostname = params[:host].dup
     hostname = "http://#{hostname}" unless hostname =~ /:\/\//
     begin
       if(redirect_count > 3)
@@ -24,7 +20,7 @@ class WserverPlugin < Plugin
       begin
         uri = URI.parse(hostname)
       rescue URI::InvalidURIError => err
-        m.reply "#{m.params} is not a valid URI"
+        m.reply "#{hostname} is not a valid URI"
         return
       end
       
@@ -72,4 +68,4 @@ class WserverPlugin < Plugin
   end
 end
 plugin = WserverPlugin.new
-plugin.register("wserver")
+plugin.map 'wserver :host'