File: ipupdate.pl

package info (click to toggle)
irssi-scripts 20131030
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,532 kB
  • ctags: 2,548
  • sloc: perl: 60,241; sh: 146; makefile: 6
file content (37 lines) | stat: -rw-r--r-- 1,013 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# IPupdate 1.2
# 
# automatically update your IP on server connections
# 
# original create by legion (a.lepore@email.it)
#
# thanks xergio for IP show php script :>

use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
require LWP::UserAgent;
use HTTP::Request::Common;

$VERSION = '1.2';
%IRSSI = (
		authors         => 'xlony',
		contact         => 'anderfdez@yahoo.es',
		name            => 'IPupdate',
		description     => 'Auto "/set dcc_own_ip IP" on connect.',
		license         => 'GPL',
		changed         => 'Tue Jan  3 18:33:56 CET 2006',
);

sub ipset {
	my $user = LWP::UserAgent->new(timeout => 30);
	my $get = GET "http://stuff.xergio.net/ip.php";
	my $req = $user->request($get);
	my $out = $req->content();
	$out =~ s/.*IP real: ([0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?).*/$1/s;

	Irssi::print("%9IP update%_:", MSGLEVEL_CRAP);
	Irssi::command("set dcc_own_ip $out");
}

Irssi::signal_add('server connected', 'ipset');
Irssi::command_bind('ipupdate', 'ipset');