Return to Snippet

Revision: 415
at July 12, 2006 14:29 by sudarkoff


Initial Code
#!/usr/bin/perl

use warnings;
use strict;
use Net::OSCAR qw(:standard);

my $screenname = 'screenname';
my $password = 'password';
my $logfile = '~/aimbot.log';

my $oscar;
$oscar = Net::OSCAR->new(capabilities => [qw(extended_status)]);
$oscar->set_callback_im_in(\&im_in);
$oscar->signon($screenname, $password);
while(1) { $oscar->do_one_loop(); }

sub im_in {
	my($oscar, $sender, $message, $is_away) = @_;
    
	# respond to the poor soul still using ICQ
	my $response = "Sorry, I am no longer using ICQ. " .
		"If you need to contact me, try sending me an " .
		"email/Jabber/GTalk message at 'me\@domain.com'. " .
		"(This is an automated response.)\n";
	$oscar->send_im($sender, $response);

	# save the message to the log-file
	open (LOG, ">>$logfile") or print "Oops, can't open logfile.\a\n";
	print LOG scalar(localtime)." [AWAY] " if $is_away;
	print LOG scalar(localtime).(" "x8)."$sender: $message\n";
	close LOG
}

Initial URL


Initial Description
I no longer use ICQ, but I still have dozens of contacts there. To let them know of other ways to contact me I wrote this little script.

Initial Title
AIM autoresponder

Initial Tags


Initial Language
Perl