Jabber notification of new referrers


If you run a local version of Stephen Downes' referrers script, you can insert the following code beneath the line

print OUT "1\t$pageitem\t$form{'in'}\t$title\t$submitted\n"; # Save as a new record

$jabber = Net::Jabber::Client->new();
$jabber ->Connect( hostname => 'jabber.org',
               port => 5222 )
               or die "Cannot connect ($!)\n";
@result = $jabber ->AuthSend( username => 'USERNAME',
               password => 'PASSWORD',
               resource => 'referrals' );
$reply = Net::Jabber::Message->new();
$reply->SetMessage( "to"      => "RECIPIENT",
               "subject" => "New referrer",
               "type" => "normal",
               "body"    => "$form{'in'} - $title" );
$jabber ->Send($reply);
$jabber ->Disconnect();

where USERNAME and PASSWORD are previously registered with the jabber.org server and RECIPIENT is the jabber ID to which the message should be sent, eg 'example\@jabber.org'.

You'll need to have Net::Jabber installed, and add 'use Net::Jabber' at the top of the script.

This will send a message whenever a new referrer is found. Stephen will hopefully be adding this to the remote version of the script at some point.