Posted: Tue Jun 10, 2008 7:07 pm Post subject: How to login and send IM using perl AIM?
I wrote the following code,
Code:
#!/usr/bin/perl -w
use Net::OSCAR qw(:standard);
my $oscar = Net::OSCAR->new();
$oscar->signon(
"screenname" => "removed",
"password" => "removed",
"host" => "im001.imcomply.com",
"port" => 5190);
my $on = $oscar->is_on();
print $on;
$oscar->send_im("nishttal007","test");
When I run the code, the print out says $on is undef, which means I didn't login. the host and port are my company's AIM server. And the send_im
doesn't work. I tried many other perl AIM modules, they all don't work. I always cannot login, can anybody help?
Joined: 25 Jun 2004 Posts: 130 Location: Liverpool(home) or Derby(uni), UK votes: 3
Posted: Thu Jun 12, 2008 12:11 pm Post subject:
If you put the host as whatever the AOL AIM server is, does it connect?
Im going to assume that AIM uses the same server to verify users and passwords as it does for buddy lists and conversations? I dont use it so im not very familiar with the protocol, but if thats the way it works and you can connect to AOL aim then id assume some kind of port problem (firewall, port forwarding etc).
If not, then I will assume either it is trying to auth you with the AOL login servers then connect to your own, OR if it works like MSN and the first server just redirects to the rest, then its not redirecting properly.
But as I said, im not familiar with the AIM protocol so I cant really be of that much help.
I wasnt aware that you could host your own AIM servers...
Thanks for your reply. I tried to use the default AIM server,toc.oscar.aol.com, it doesn't work. I believe it is not a port (firewall or port number) problem because I can use AIM GUI to talk to other people, I just cannot send_im using perl on my linux server.
My host is just a routing server for AIM, not AIM server, I am sorry for the confusion. I know that AOL upgraded toc protocal to toc2 protocal in August 2005, is it possible that AOL stopped supporting AIM perl scripting for toc2 since I didn't see any perl in AOL's AIM homepage?(There are only Java/C++/C#) or do you have some other suggesting?
Any help is greatly appreciated!
Joined: 25 Jun 2004 Posts: 130 Location: Liverpool(home) or Derby(uni), UK votes: 3
Posted: Fri Jun 13, 2008 12:19 pm Post subject:
I would imagine TOC has no effect on the Net::Oscar module, I dont think it uses TOC to acces OSCAR otherwise it should becalled Net::TOC or something. The documentation for it definitely says it is an implementation of the OSCAR protocol.
# loop to get events from server
while (1) {
$oscar->do_one_loop();
}
sub on_connect {
my $self = shift;
$self->send_im("whoever", "whatever");
}
OSCAR takes a moment to do all the authentication and sign-on stuff, so if you try to login and then send an IM immediately, you're most likely not gonna actually be "online" when you tried to send that IM, causing it to crash. And without doing do_one_loop you don't receive events from the server, and if Net::OSCAR has any events queued to help the auth process, it won't send those events back to the server either so it's possible it doesn't even complete the auth process to even get your bot to sign on. _________________ Current Site (2008) http://www.cuvou.com/