-void geoip_setupuser(nick *np) {
- int country = GeoIP_id_by_ipnum(gi, np->ipaddress);
+static void geoip_setupuser(nick *np) {
+ if (!irc_in_addr_is_ipv4(&np->p_ipaddr))
+ return; /* geoip only supports ipv4 */
+
+ unsigned int ip = irc_in_addr_v4_to_int(&np->p_ipaddr);
+ int country = GeoIP_id_by_ipnum(gi, ip);