This is a Plugin for the XChat IRC client written in Python. It enables a new command /geoip
that prints the user's location. It also hooks to the join
event so whenever a user joins a channel, the location of that user is determined and printed. If the user can not be located, a message telling so will be printed.
The MaxMind GeoIP package and database must be installed on the computer. In addition, the City(Lite) database must be installed. This database can be downloaded here for free. The paid / pro version of the City database works as well, of course.
IPv6 addresses are not understood. However, the script could be easily adapted to lookup IPv6 addresses as well. The MaxMind IPv6 database is relatively small as of today (Jan 2016) and therefore implementing this at this point in time is not very useful.
The script should be copied into the ~/.xchat2
directory. To load the script, use
/py load geoip-lookup.py
To reload / or unload replace load
with reload
or unload
, respectively.
Use /geoip <username>
in the server context as you'd use /whois
. In fact, using /whois
produces also a location line when the plugin is loaded. In a channel window, the /geoip <username>
prints the same same line as if the user just joined. The latter use is useful for users that are already in the channel and where a lookup is desired.