浏览代码

don't show country code if already in dns name

Paul Klumpp 11 年之前
父节点
当前提交
632853865f
共有 2 个文件被更改,包括 4 次插入4 次删除
  1. 0 1
      Gemfile
  2. 4 3
      em_server.rb

+ 0 - 1
Gemfile

@@ -2,5 +2,4 @@ source 'https://rubygems.org'
 
 gem 'stomp'
 gem 'eventmachine'
-gem 'em-resolv-replace'
 

+ 4 - 3
em_server.rb

@@ -844,11 +844,12 @@ module CentralProtocolHandler
 
             if iphost =~ /^\d+\.\d+\.\d+\.\d+/
 
+              targetname = $gs.get_cool_dns(iphost, ipport)
+
               # find country code
-              c = GeoIP.new('GeoIP.dat').country(iphost)[3].to_s.downcase
-              rest.prepend " #{c}" unless c.nil? || c.empty?
+              cc = GeoIP.new('GeoIP.dat').country(iphost)[3].to_s.downcase
 
-              targetname = $gs.get_cool_dns(iphost, ipport)
+              rest.prepend " #{cc}" unless cc.nil? || cc.empty? || targetname =~ /#{cc}$/
 
             end # if ip is x.x.x.x