sorry I'm so late in a reply, but i got everything working ;D, here's the code , i will add more features later, after i get a nice server box going i may release it as some sort of project, but i definatley need to add more features first...
special thanks to ashcrow and gorn, for basically teaching/telling me how to do everything...
Code:#!/usr/bin/perl -w use PHP::Strings; use Net::OSCAR qw(:standard); # Set configuration params -------------------------------- %users = ('allowed_user' => 1, 'unauthorized' => 0); $aim = Net::OSCAR->new(); $aim->set_callback_im_in(\&im_in); $aim->set_callback_evil(\&evil); $aim->set_callback_signon_done(\&signon_done); $aim->signon(screenname => "sn", password => "passwd", OSCAR_SVC_AIM); $aim->set_visibility(VISMODE_PERMITALL); # ------------------------------------------------------------ # Main Loop while(1) { $aim->do_one_loop(); } sub signon_done { my ($aim) = @_; $aim->commit_buddylist; print "signed on\n"; return; } # When an IM comes in do the following ... sub im_in { my ($aim, $from, $msg, $away) = @_; print "message recieved\n"; $from = lc($from); $from =~ s/ //g; $msg =~ s/<.*?>//g; $log = "$from: $msg\n"; print $log; open LOG, ">>log"; print LOG "$log"; close LOG; if (!$users{$from}) { print "$from didn't get authed\n"; return; } else { print "$from got authed\n"; @command = split(/ /, $msg); if ($command[0] eq "!warn") { $victim = $command[1]; $aim->evil($victim); $aim->send_im($from, "$victim warned"); return; } if ($command[0] eq "!dc") { $aim->send_im($from, "disconnecting"); $aim->signoff; exit; } } if ($command[0] eq "hello") { $aim->send_im($from, "hello"); return; } } #} # If someone 'warns' the bot then ... sub evil { my ($aim, $new, $from) = @_; $aim->send_im($from, "don't warn me"); $aim->evil($from); $aim->evil($from); $aim->evil($from); $aim->evil($from); $aim->evil($from); }


Reply With Quote

Bookmarks