1# IPupdate 1.2
2#
3# automatically update your IP on server connections
4#
5# original create by legion (a.lepore@email.it)
6#
7# thanks xergio for IP show php script :>
8#
9# Fixed by Axel Gembe <derago@gmail.com> to use ifconfig.co/ip
10# because the original server did not work anymore.
11
12use strict;
13use Irssi;
14use vars qw($VERSION %IRSSI);
15require LWP::UserAgent;
16use HTTP::Request::Common;
17
18$VERSION = '1.3';
19%IRSSI = (
20		authors         => 'xlony, Axel Gembe',
21		contact         => 'anderfdez@yahoo.es',
22		name            => 'IPupdate',
23		description     => 'Auto "/set dcc_own_ip IP" on connect.',
24		license         => 'GPL',
25		changed         => '2017-11-08',
26);
27
28sub ipset {
29	my $user = LWP::UserAgent->new(timeout => 30);
30	my $get = GET "http://ifconfig.co/ip";
31	my $req = $user->request($get);
32	my $out = $req->content();
33
34	Irssi::print("%9IP update%_:", MSGLEVEL_CRAP);
35	Irssi::command("set dcc_own_ip $out");
36}
37
38Irssi::signal_add('server connected', 'ipset');
39Irssi::command_bind('ipupdate', 'ipset');
40