#!/proj/DVT/bin/perl -w
use strict;
use Net::AIM;
use Data::Dumper;

unless (@ARGV == 4) {
  print "usage:  aim_fire <from> <passwd> <to> <msg>\n";
}

my ($from, $passwd, $to, $msg) = @ARGV;

my $AIM = new Net::AIM;
$AIM->newconn(Screenname   => $from,
              Password     => $passwd)
  or die "Unable to open AIM connection.\n";
my $conn = $AIM->getconn();

my $ready = 0;

$conn->set_handler(config => sub {$ready = 1});

do {
  $AIM->do_one_loop;
} until $ready;

$AIM->send_im($to, $msg);

sleep 2;

__END__
=head1 NAME

aim_fire - command-line utility that sends a quick AIM message to somebody.

=head1 DESCRIPTION

This script sends AIM messages.  It's mostly useful for tacking onto the
end of a long-running program (like a make) to AIM you when it's done.

The syntax is:

  aim_fire <from> <passwd> <to> <msg>

=head1 README

This script sends AIM messages.  It's mostly useful for tacking onto the
end of a long-running program (like a make) to AIM you when it's done.

=head1 PREREQUISITES

This script requires C<Net::AIM 1.21>.

=head1 COREQUISITES

=pod OSNAMES

any

=pod SCRIPT CATEGORIES

Fun/Educational

=cut