12 log("debug", "Loaded geoip database successfully"); |
12 log("debug", "Loaded geoip database successfully"); |
13 |
13 |
14 events.add_handler("new-client", function (info) |
14 events.add_handler("new-client", function (info) |
15 local ip = info.conn:ip(); |
15 local ip = info.conn:ip(); |
16 local location = city_db:query_by_addr(ip); |
16 local location = city_db:query_by_addr(ip); |
|
17 log("debug", "GeoIP query for %s", tostring(ip)); |
|
18 local location, err = city_db:query_by_addr(ip); |
17 if location then |
19 if location then |
18 local l = {}; |
20 local l = {}; |
19 if location.city_name then |
21 if location.city_name then |
20 table.insert(l, location.city_name); |
22 table.insert(l, location.city_name); |
21 end |
23 end |