AOL-TOC
view release on metacpan or search on metacpan
=head1 SYNOPSIS
use AOL::TOC;
$toc = AOL::TOC::new($toc_server, $login_server, $port,
$screenname, $password);
$toc->connect();
=head1 DESCRIPTION
This module implements SFLAP, which I presume to be AOL's authenticiation
protocol, and TOC, which is the actual "meat" of the AIM protocol.
=head1 INTERFACE
=head2 connect
connects to the AIM server
=head2 register_callback
Takes two arguments, the name of the chat room, and the message.
=head1 AUTHOR
xjharding@newbedford.k12.ma.us cleaned it up and added DOC
james@foo.org was the original author
=head1 SEE ALSO
Net::AIM, a new module, but it doesn't have the features of this one
=cut
sub roast_password {
my ($password, $key) = @_;
my @skey;
my $rpassword = "0x";
my $i = 0;
if (!$key) { $key = $ROASTING_KEY; }
if ($cmd eq "CONFIG") {
$toc->callback("CONFIG", $args);
}
if ($cmd eq "NICK") {
($beautified_nick) = ($args =~ /^(.*)$/);
$toc->callback("NICK", $beautified_nick);
}
if ($cmd eq "IM_IN") {
($nickname, $autoresponse, $message) = ($args =~ /^(.*)\:(.*)\:(.*)$/);
$toc->callback("IM_IN", $nickname, $autoresponse, $message);
}
if ($cmd eq "UPDATE_BUDDY") {
($nickname, $online, $evil, $signon_time, $idle_time, $class) = ($args =~ /^(.*)\:(.*)\:(.*)\:(.*)\:(.*)\:(.*)$/);
$toc->callback("UPDATE_BUDDY", $nickname, $online, $evil, $signon_time, $idle_Time, $class);
}
if ($cmd eq "ERROR") {
($code, $args) = ($args =~ /^(\d*).?(.*)$/);
$toc->callback("ERROR", $code, $args);
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use AOL::TOC;
$loaded = 1;
print "ok 1\n";
######################### End of black magic.
# Insert your test code below (better if it prints "ok 13"
# (correspondingly "not ok 13") depending on the success of chunk 13
# of the test code):
tocbot/tocbot.pl view on Meta::CPAN
$toc->register_callback("SIGN_ON", \&client_signon);
$toc->register_callback("IM_IN", \&client_im);
$toc->register_callback("UPDATE_BUDDY", \&client_buddy);
while (1) {
$toc->dispatch();
}
sub client_im {
my ($self, $nickname, $autoresponse, $message) = @_;
my $cmd, $args;
print "tocbot: $nickname says \"$message\"\n";
if ($autoresponse eq "T") {
print "tocbot: $nickname is away, ignoring.\n";
return;
}
($cmd, $args) = ($message =~ /bot\((\w+)\b(.*)\)/i);
if ($cmd && do_command($nickname, $cmd, $args)) {
return;
}
if ($message =~ /HELP/i) {
( run in 1.243 second using v1.01-cache-2.11-cpan-49f99fa48dc )