X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fgeoip.rb;h=96dcf9d23ce2edca1ef62317ad511a1939686d92;hb=6188a50d4ba6171481224bc897b45facd286f037;hp=f5944256c49409ab98da6b7f4b42286667ff77b3;hpb=940264d1718b5a32d34ac82276a29f0cc1a51941;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/geoip.rb b/data/rbot/plugins/geoip.rb index f5944256..96dcf9d2 100755 --- a/data/rbot/plugins/geoip.rb +++ b/data/rbot/plugins/geoip.rb @@ -12,9 +12,9 @@ module GeoIP class InvalidHostError < RuntimeError; end - GEO_IP_PRIMARY = "http://kapsi.fi:40086/lookup.yaml?host=" + GEO_IP_PRIMARY = "http://lakka.kapsi.fi:40086/lookup.yaml?host=" GEO_IP_SECONDARY = "http://www.geoiptool.com/en/?IP=" - HOST_NAME_REGEX = /[a-z0-9\-]+(?:\.[a-z0-9\-]+)*\.[a-z]{2,4}/i + HOST_NAME_REGEX = /^[a-z0-9\-]+(?:\.[a-z0-9\-]+)*\.[a-z]{2,4}/i REGEX = { :country => %r{Country:.*? (.*?)}m, @@ -82,12 +82,13 @@ class GeoIpPlugin < Plugin # need to see if the whois reply was invoked by this plugin return unless @stack.has_nick?(nick) + if m.target + msg = host2output(m.target.host, m.target.nick) + else + msg = "no such user on "+@bot.server.hostname.split(".")[-2] + end @stack[nick].each do |source| - if m.target - @bot.say source, host2output(m.target.host, m.target.nick) - else - @bot.say source, "no such user on "+@bot.server.hostname.split(".")[-2] - end + @bot.say source, msg end @stack.clear(nick) @@ -157,4 +158,4 @@ class GeoIpPlugin < Plugin end plugin = GeoIpPlugin.new -plugin.map "geoip [:input]", :action => 'geoip' \ No newline at end of file +plugin.map "geoip [:input]", :action => 'geoip', :thread => true