#!/usr/bin/perl -w
use Geo::IP;
use strict;
Xchat::register( "Whois Addon", "0.5", "A Geop and ip resolver for ircop's for the whois command", "" );
Xchat::hook_server('378', \&parse_line);
my $servertabname = "Station51";
sub parse_line {
my ($line);
$line = shift (@_);
Xchat::print("test1",,$servertabname);
if ($line =~ m/:.+\@.+\s([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/){
Xchat::print("test2",,$servertabname);
my $ip = $1 ;
Xchat::print("Is From ".countryname($ip)."",,$servertabname);
}
Xchat::print("test3",,$servertabname);
}
sub countryname{
my ($ip) =@_ ;
my $gi = Geo::IP->open("/home/m/Desktop/Test Stuff/GeoIP.dat", GEOIP_STANDARD);
return $gi->country_name_by_addr($ip);
}
####
random.ircserv.net 378 ircop Blueink :is connecting from *@78.273.80.23 78.273.80.23
####
test1
test3