]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/nslookup.rb
plugins/keywords: add method that was missing from commit 7cac523563de6473d2f93fd2d05 ...
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / nslookup.rb
index 160fee85f7aa133ce1d0673505e14ce8dccde2bb..0f901017c29b8c021288953811375f1c3e21543c 100644 (file)
@@ -12,32 +12,28 @@ class DnsPlugin < Plugin
   end
   
   def name_to_ip(m, params)
-    Thread.new do
-      begin
-        a = getaddresses(params[:host])
-        if a.length > 0
-          m.reply m.params + ": " + a.join(", ")
-        else
-          m.reply "#{params[:host]}: not found"
-        end
-      rescue StandardError => err
+    begin
+      a = getaddresses(params[:host])
+      if a.length > 0
+        m.reply m.params + ": " + a.join(", ")
+      else
         m.reply "#{params[:host]}: not found"
       end
+    rescue StandardError => err
+      m.reply "#{params[:host]}: not found"
     end
   end
   
   def ip_to_name(m, params)
-    Thread.new do
-       begin
-         a = gethostname(params[:ip])
-         m.reply m.params + ": " + a if a
-       rescue StandardError => err
-         m.reply "#{params[:ip]}: not found (does not reverse resolve)"
-       end
-     end
+    begin
+      a = gethostname(params[:ip])
+      m.reply m.params + ": " + a if a
+    rescue StandardError => err
+      m.reply "#{params[:ip]}: not found (does not reverse resolve)"
+    end
   end
 end
 plugin = DnsPlugin.new
-plugin.map 'dns :ip', :action => 'ip_to_name', 
+plugin.map 'dns :ip', :action => 'ip_to_name', :thread => true,
                       :requirements => {:ip => /^\d+\.\d+\.\d+\.\d+$/}
-plugin.map 'dns :host', :action => 'name_to_ip'
+plugin.map 'dns :host', :action => 'name_to_ip', :thread => true