summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Gahan <chris@ill-logic.com>2006-03-25 12:29:35 +0000
committerChris Gahan <chris@ill-logic.com>2006-03-25 12:29:35 +0000
commitb04c756e064cafc1ed06225a17a44d19f349f06b (patch)
treee3f8411f0aba8ded08a921518f9d2e7b235eec66
parent65a331089b9e179fd87beb579442b1733dfbec8e (diff)
A few more cosmetic tweaks for IPLookup.
-rw-r--r--data/rbot/plugins/iplookup.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/data/rbot/plugins/iplookup.rb b/data/rbot/plugins/iplookup.rb
index 65018bb9..9da167b0 100644
--- a/data/rbot/plugins/iplookup.rb
+++ b/data/rbot/plugins/iplookup.rb
@@ -41,11 +41,11 @@ module ArinWhois
end
def location
- "#{self['City']}, #{self['StateProv']}, #{self['Country']}"
+ [ self['City'], self['StateProv'], self['Country'] ].compact.join(', ')
end
def address
- "#{self['Address']}, #{location} #{self['PostalCode']}"
+ [ self['Address'], location, self['PostalCode'] ].compact.join(', ')
end
end
@@ -104,8 +104,8 @@ module ArinWhois
result = Chunk.new
chunk[0].scan(/([A-Za-z]+?):(.*)/).each do |tuple|
- #puts tuple.inspect
- result[tuple[0]] = tuple[1].strip
+ tuple[1].strip!
+ result[tuple[0]] = tuple[1].empty? ? nil : tuple[1]
end
result
@@ -192,9 +192,10 @@ class IPLookupPlugin < Plugin
if params[:domain]
begin
ip = Resolv.getaddress(params[:domain])
- reply += "(#{params[:domain]} = #{ip}) "
+ reply += "#{params[:domain]} | "
rescue => e
m.reply "#{e.message}"
+ return
end
else
ip = params[:ip]
@@ -220,7 +221,7 @@ plugin.map 'userip :user', :action => 'userip', :requirements => {:user => /\w+/
if __FILE__ == $0
include ArinWhois
- data = open('whoiscgm.txt').read
+ data = open('whoistest.txt').read
c = ArinWhoisParser.new data
puts c.get_parsed_data.inspect
end \ No newline at end of file