AOL-TOC
view release on metacpan or search on metacpan
# Autoload methods go after =cut, and are processed by the autosplit program.
=head1 NAME
AOL::TOC - Perl extension for interfacing with AOL's AIM service
=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
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; }
@skey = split('', $key);
for $c (split('', $password)) {
$p = unpack("c", $c);
$k = unpack("c", @skey[$i % length($key)]);
$rpassword = sprintf("%s%02x", $rpassword, $p ^ $k);
$i ++;
}
return ($rpassword);
}
sub encode_string {
my ($self, $str) = @_;
my ($estr, $i);
if (!$str) { $str = $self; }
$estr = "\"";
}
print "...............S TOC scan callbacks\n";
for $k (keys %{$self->{callback}}) {
print ".............S Scan key ($k)\n";
}
}
sub new {
my ($tochost, $authorizer, $port, $nickname, $password) = @_;
my ($self, $ipaddr, $sflap);
$self = {
nickname => $nickname,
password => $password,
caller => "file:line"
};
bless($self);
$sflap = AOL::SFLAP::new($tochost, $authorizer, $port, $nickname);
$self->{sflap} = $sflap;
#print "*************************** AOL::TOC::new(...) sflap = $self->{sflap}\n";
#print " sflap cb = $self->{sflap}{callback}\n";
#$self->{sflap}->register_callback($AOL::SFLAP::SFLAP_SIGNON, \&sflap_signon, $password, "english", "TIK:\$Revision: 1.148 \$", $self);
#$self->{sflap}->register_callback($AOL::SFLAP::SFLAP_DATA, \&sflap_data, $self);
#$self->{sflap}->register_callback($AOL::SFLAP::SFLAP_ERROR, \&sflap_error, $self);
#$self->{sflap}->register_callback($AOL::SFLAP::SFLAP_SIGNOFF, \&sflap_signoff, $self);
#$self->{sflap}->register_callback($AOL::SFLAP::SFLAP_KEEPALIVE, \&sflap_keepalive, $self);
#
#$self->register_callback("SIGN_ON", \&check_version);
#$self->register_callback("CHAT_JOIN", \&_chat_join);
return $self;
}
if ($self->{debug_level} > 0) {
print @args;
}
}
sub connect {
my ($self) = @_;
$self->{sflap}->register_callback($AOL::SFLAP::SFLAP_SIGNON, \&sflap_signon, $self->{password}, "english", "TIK:\$Revision: 1.148 \$", $self);
$self->{sflap}->register_callback($AOL::SFLAP::SFLAP_DATA, \&sflap_data, $self);
$self->{sflap}->register_callback($AOL::SFLAP::SFLAP_ERROR, \&sflap_error, $self);
$self->{sflap}->register_callback($AOL::SFLAP::SFLAP_SIGNOFF, \&sflap_signoff, $self);
$self->{sflap}->register_callback($AOL::SFLAP::SFLAP_KEEPALIVE, \&sflap_keepalive, $self);
$self->register_callback("SIGN_ON", \&check_version);
$self->register_callback("CHAT_JOIN", \&_chat_join);
$self->{sflap}->connect();
}
sub dispatch {
my ($self) = @_;
$self->{sflap}->recv();
}
# Utilities
sub signon {
my ($self, $authorizer, $port, $nickname, $roasted_password, $language, $version) = @_;
$self->send("toc_signon $authorizer $port $nickname $roasted_password $language " . &encode_string($version));
return;
}
sub init_done {
my ($self) = @_;
$self->send("toc_init_done");
return;
}
my ($self, $info) = @_;
$self->send("toc_set_info " . &encode_string($info));
return;
}
# SFLAP Callbacks
sub sflap_signon {
my ($self, $data, $password, $language, $version, $toc) = @_;
my ($buffer, $roasted_password);
$roasted_password = roast_password($password, $ROASTING_KEY);
$buffer = pack("Nnna*", 1, 1, length($toc->{sflap}->{nickname}), $toc->{sflap}->{nickname});
$toc->{sflap}->send($AOL::SFLAP::SFLAP_SIGNON, $buffer);
$toc->signon($toc->{sflap}->{authorizer}, $toc->{sflap}->{port}, $toc->{sflap}->{nickname}, $roasted_password, $language, $version);
}
sub sflap_data {
my ($self, $data, $toc) = @_;
my ($cmd, $args);
($cmd, $args) = ($data =~ /^(\w+)\:(.*)$/);
return unless defined $cmd && defined $args;
tocbot/tocbot.config view on Meta::CPAN
# tocbot.config
#
@tocbot_modules = ("ident", "relay", "do", "fortune");
%tocbot_config = (
tochost => "toc.oscar.aol.com",
authorizer => "login.oscar.aol.com",
port => 443,
nickname => "vaxd00d",
password => "qazwsx"
)
tocbot/tocbot.pl view on Meta::CPAN
require "$name".".pl";
eval { &{$name . "_init"} };
}
open(client_config, "toc.config");
$client_config = join('', <client_config>);
close(client_config);
$toc = AOL::TOC::new($tocbot_config{tochost}, $tocbot_config{authorizer},
$tocbot_config{port},
$tocbot_config{nickname}, $tocbot_config{password});
#$toc->set_debug(9);
$toc->connect();
$toc->register_callback("ERROR", \&client_error);
$toc->register_callback("CLOSED", \&client_closed);
$toc->register_callback("SIGN_ON", \&client_signon);
$toc->register_callback("IM_IN", \&client_im);
$toc->register_callback("UPDATE_BUDDY", \&client_buddy);
while (1) {
( run in 0.551 second using v1.01-cache-2.11-cpan-49f99fa48dc )