Leser: 18
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
use Irssi; use Irssi::Irc; use strict; use vars qw($VERSION %IRSSI); $VERSION="0.3"; %IRSSI = ( authors=> '...', name=> '...', description=> 'Auto download script', license=> 'GPL', ); # Auto download script for SCC # [...] my $url = "http://someurl.tld/download.php?id="; my $botnick = "dl-bot"; my $bottarget = "username"; my $botadd = "1337\@bot.someurl.tld"; sub event_privmsg { my ($server, $data, $nick, $address) = @_; my ($target, $text) = split(/ :/, $data, 2); $text =~ s/\x03\d?\d?(,\d?\d?)?|\x02|\x1f|\x16|\x06|\x07//g; # download matching if (($address =~ /$botadd/) && ($nick =~ /$botnick/) && ($text =~ m/\^C9,1[a-zA-Z0-9\-_ ]+ \^C11\- \^C9,1Uploaded: || (.*) \^C11\- \^C0http:\/\/someurl.tld\/download.php?id=(.*) \^C11\-OR\-\^C0 http:\/\/someurl.tld\/download.php?action=download&id=[0-9]+/)) { my $sstring = $text; $sstring =~ m/^\^C9,1.+ \^C11\- \^C9,1Uploaded: \|\| (.+) \^C11\- \^C0?7(.+) \^C11\[\^C9,1\-(.+)\-\^C11\] \- \^C11\(\^C9,1(.+)\) \^C11\- \^C0http:\/\/someurl\.tld\/download\.php\?id=(.+) \^C11\-OR\-\^C0 http:\/\/someurl\.tld\/download\.php\?action=download&id=(.+)$/i; my $scat = $1; my $stitle = $2; my $syear = $3; my $sinfo = $4; my $sid = $5; my $sid2 = $6; system qq{echo "sanitized string: $sstring" >> ~/pl_debug.log 2>&1}; Irssi::print("TEST: $scat, $stitle"); # system qq{wget -O "$somedir/$srel.zip" "$url" > /dev/null 2>&1}; } system qq{echo "$server: [$data] :: $nick / $address" >> ~/pl_debug.log 2>&1}; } Irssi::signal_add("event privmsg", "event_privmsg")
1 2 3 4 5 6 7 8 9 10 11 12
my $sstring = $text; $sstring =~ m/^\^C9,1.+ \^C11\- \^C9,1Uploaded: \|\| (.+) \^C11\- \^C0?7(.+) \^C11\[\^C9,1\-(.+)\-\^C11\] \- \^C11\(\^C9,1(.+)\) \^C11\- \^C0http:\/\/someurl\.tld\/download\.php\?id=(.+) \^C11\-OR\-\^C0 http:\/\/someurl\.tld\/download\.php\?action=download&id=(.+)$/i; my $scat = $1; my $stitle = $2; my $syear = $3; my $sinfo = $4; my $sid = $5; my $sid2 = $6; system qq{echo "sanitized string: $sstring" >> ~/pl_debug.log 2>&1}; Irssi::print("TEST: $scat, $stitle");