User:Where/watch.pl.js


 * 1) !/usr/bin/perl

use Net::IRC; use strict;


 * 1) Note: this code is _meant_ to be quick, dirty, ugly, without error checking, with dead ends, and just bad looking
 * 2) so don't kvetch about it to me

our $irc = new Net::IRC; our $conn = $irc->newconn(Nick => "Where" . int(rand(999)), Server => "browne.wikimedia.org", Port => 6667, Ircname => "W");

$conn->add_handler("public", \&onPublic); $conn->add_handler("376", \&onConnect); $irc->start;

sub onConnect { our $self = shift; $self->join("#en.wikipedia"); }

sub onPublic { our $self = shift; our $event = shift; our ($rawMessage) = $event->args; if ($event->nick eq "rc") { if (0) { if ($rawMessage =~ /Diff:(.*)/) { print "Pre: $1\n"; $1 =~ m#(http://[^\s]+)#; print "La: ". $1 . "\n"; system "firefox '$1' &"; ; }}

$rawMessage =~ m#02(http://en.wikipedia.org[^ ]+)#; our $url = $1; $rawMessage =~ m#5\*.+03(.*)5\*# or die "blah"; our $user = $1; chop $user; chop $user; chop $user; if ($url =~ /[Tt]alk:/) {return;} if ($url =~ /User:/) {return;} if ($url =~ /Sandbox/) {return;} if ($url =~ /Articles for deletion/) {return;} if ($url =~ /Wikipedia:Introduction/) {return;} chop $rawMessage; print "$rawMessage\n"; print "$rawMessage\n"; if ($user =~ m#^[\d\.]+$#) { &act($url); }	  if ($rawMessage =~ /N\x{03}10/) { &act($url); }	} }

sub act { our $diffUrl = shift; system "firefox '$diffUrl'&"; return; }