AOL-TOC
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
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
connects to the AIM server
=head2 register_callback
This function takes two arguments, the EVENT and the subroutine reference.
Callbacks are similar to the ones found in Net::IRC. The module defines
several AIM "events": ERROR, CLOSED, SIGN_ON, IM_IN, CHAT_IN, UPDATE_BUDDY.
These events can be bound to subroutines.
=head2 dispatch
This flushes all messages to the server, and retreives all current messages.
=head2 add_buddy
Takes one arguement, the nick of the buddy.
This adds a buddy to your buddy list.
=head2 send_im
Takes two arguments, the name of the buddy and the name of the message, and
sends the IM.
=head2 get_info
Takes one argument, the name of the buddy, and returns the info.
=head2 chat_join
Takes one argument, the name of the chat room to join
=head2 chat_send
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; }
@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 = "\"";
for $i (split('', $str)) {
if (
($i eq "\\") || ($i eq "\{") || ($i eq "\}") ||
($i eq "\(") || ($i eq "\)") || ($i eq "\[") ||
($i eq "\]") || ($i eq "\$") || ($i eq "\""))
{
$estr .= "\\";
}
$estr .= $i;
}
$estr .= "\"";
return ($estr);
}
sub register_callback {
my ($self, $event, $func, @args) = @_;
push (@{$self->{callback}{$event}}, $func);
@{$self->{callback}{$func}} = @args;
return;
}
sub callback {
my ($self, $event, @args) = @_;
my $func;
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.977 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )