User Control Panel
Advertisements

HELP US, HELP YOU!

How to login and send IM using perl AIM?

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Code Help
View unanswered posts
Author Message
sliuyan
Newbie
Newbie


Joined: 10 Jun 2008
Posts: 2


PostPosted: Tue Jun 10, 2008 7:07 pm    Post subject: How to login and send IM using perl AIM? Reply with quote

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?
Back to top
Teario
Member
Member


Joined: 25 Jun 2004
Posts: 126
Location: Liverpool(home) or Derby(uni), UK
Reputation: 58
votes: 3

PostPosted: Thu Jun 12, 2008 12:11 pm    Post subject: Reply with quote

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...
Back to top
sliuyan
Newbie
Newbie


Joined: 10 Jun 2008
Posts: 2


PostPosted: Thu Jun 12, 2008 3:57 pm    Post subject: Reply with quote

Hi Teario,

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!

Min
Back to top
Teario
Member
Member


Joined: 25 Jun 2004
Posts: 126
Location: Liverpool(home) or Derby(uni), UK
Reputation: 58
votes: 3

PostPosted: Fri Jun 13, 2008 12:19 pm    Post subject: Reply with quote

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.

Unfortunately from here I cant be of much help as my bots only run on MSN. I did find this: http://perl.about.com/od/packagesmodules/qt/perlaimbot.htm while searching for info on the OSCAR proto though which might be of some help.

~T
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Mon Jun 16, 2008 6:18 am    Post subject: Reply with quote

You should wait until your bot completely connects before jumping right in and sending a message.

Code:
#!/usr/bin/perl -w
use Net::OSCAR qw(:standard);
        my $oscar = Net::OSCAR->new();

# set a connected handler
$oscar->set_callback_connected(\&on_connect); # might be _signon_done, check the docs

        $oscar->signon(
                "screenname" => "removed",
                "password" => "removed",
                "host" => "im001.imcomply.com",
                "port" => 5190);
$oscar->signon ($sn,$pass);

# 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/
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Code Help All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group