]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/iplookup.rb
geoip plugin: had to change host name of the new lookup server
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / iplookup.rb
index 715595e25ee07686fac757281f69002967b4c197..c983b300395dd86edfd4db2835dcba4292e8af6a 100644 (file)
@@ -188,8 +188,10 @@ class IPLookupPlugin < Plugin
   end
 
   def iplookup(m, params)
-    reply = ""
-    if params[:domain]
+    debug params
+    if params[:domain].match(/^#{Regexp::Irc::HOSTADDR}$/)
+      ip = params[:domain]
+    else
       begin
         ip = Resolv.getaddress(params[:domain])
         reply += "#{params[:domain]} | "
@@ -197,8 +199,6 @@ class IPLookupPlugin < Plugin
         m.reply "#{e.message}"
         return
       end
-    else
-      ip = params[:ip]
     end
 
     reply += ArinWhois.lookup_info(ip)
@@ -206,6 +206,7 @@ class IPLookupPlugin < Plugin
   end
 
   def userip(m, params)
+    m.reply "not implemented yet"
     #users = @channels[m.channel].users
     #m.reply "users = #{users.inspect}"
     #m.reply @bot.sendq("WHO #{params[:user]}")
@@ -214,9 +215,8 @@ class IPLookupPlugin < Plugin
 end
 
 plugin = IPLookupPlugin.new
-plugin.map 'iplookup :ip', :action => 'iplookup', :requirements => {:ip => /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/}
-plugin.map 'iplookup :domain', :action => 'iplookup', :requirements => {:domain => /^[a-z0-9\.\-]{4,255}$/i}
-plugin.map 'userip :user', :action => 'userip', :requirements => {:user => /\w+/}
+plugin.map 'iplookup :domain', :action => 'iplookup', :thread => true
+plugin.map 'userip :user', :action => 'userip', :requirements => {:user => /\w+/}, :thread => true
 
 
 if __FILE__ == $0