summaryrefslogtreecommitdiffstats
path: root/scripts/ipupdate.pl
diff options
context:
space:
mode:
authorAlexander Færøy2014-05-31 13:10:46 +0200
committerAlexander Færøy2014-05-31 13:10:46 +0200
commit2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1 (patch)
tree1c5e6d817c88e67b46e216a50e0aef5428bf63df /scripts/ipupdate.pl
parent2d080422d79d1fd49d6c5528593ccaaff9bfc583 (diff)
downloadscripts.irssi.org-2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1.tar.bz2
Import scripts from scripts.irssi.org
Diffstat (limited to 'scripts/ipupdate.pl')
-rw-r--r--scripts/ipupdate.pl37
1 files changed, 37 insertions, 0 deletions
diff --git a/scripts/ipupdate.pl b/scripts/ipupdate.pl
new file mode 100644
index 0000000..42fa31b
--- /dev/null
+++ b/scripts/ipupdate.pl
@@ -0,0 +1,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');