User:Where/rcff

All scripts on this page need perl and Net::IRC.

My vandal-fighting tool

All scripts on this page need perl and Net::IRC.

I use this script for vandal-fighting. Beware that it is difficult to use and only works under Linux. I have only tested it under KDE with the focus protection level (set in the control center) set to "extreme". The script pops up a firefox window every time an anon-IP edits (except for talk pages) or somebody creates a new page.

#!/usr/bin/perl

use Net::IRC;
use strict;

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' &";
             <STDIN>;
          }}

          $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 =~ /Sandbox/) {return;}
          if ($url =~ /Articles for deletion/) {return;}
          if ($url =~ /Wikipedia:Introduction/) {return;}
          chop $rawMessage;
          if ($user =~ m#^[\d\.]+$#) {
                &act($url);
          }
          if ($rawMessage =~ /N\x{03}10/) {
             print "New\n";
             &act($url);
          }
       }
}

sub act {
   our $ffWindows = `xwininfo -root -children|grep firefox-bin|wc -l`;
   chomp $ffWindows;
   if ($ffWindows < 81) { #the first FF window is 11; each next one adds 7; this means 116 is for 15 windows
      our $diffUrl = shift;
      system "firefox '$diffUrl'&";
   }
      return;
}

AIV notify script

This script pops up a firefox window whenever somebody modifies WP:AIV (unless the edit summary makes it clear that an admin is editing it).

#!/usr/bin/perl

#Filename: aiv.pl
#You need perl and Net::IRC to run this
#People unfortunate enough to be using Windows can use ActivePerl: http://activeperl.com/Products/ActivePerl/ (be sure to then install Net::IRC)
#People fortunate enough to be using Debian or one of its derivatives (ex. Ubuntu/Kubuntu) can just apt-get libnet-irc-perl

#Commands to be typed on the commandline when someone adds to AIV
our $browserCommand = "firefox http://en.wikipedia.org/wiki/WP:AIV&";
our $beepCommand = "xterm -e \"printf '\\a';sleep 1\"";

#---------------------------------------------------------------------------
#If you don't speak perl, you probably don't  want to edit below this point
#---------------------------------------------------------------------------

use Net::IRC;
use strict;

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 ($rawMessage =~ /Wikipedia:Administrator intervention against vandalism/) {
             if (!($rawMessage =~ /empty/i) && !($rawMessage =~ /clear/i)) { #Don't include admins clearing the list
                system "$beepCommand";
                system "$browserCommand";
             }
          }
       }
}

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.