Well I got my aimbot written.
I still had to rely on an event from the server to kick anything off, fortunately the act of logging on produces an event that I can use to kick off what I want.
The do one loop command loops the serve to see if there's anything there for the client.
As far as I can tell there is no way to simply initiate the client and send a message. You have to have an event from the server, like an IM, an error, a chat invitation, something, in order to to get the AimBot to do something.
Anyways thanks for tips, here is my shempy code below. It aint pretty but it does what I want. Namely read an OpenNMS database for outages and then sametime those outages to me:
#Aimbot to read outages in an OpenNMS database
#http://opennms.org) and IM outages to myself.
use DBI;
use Net::AIM;
$aim = new Net::AIM;
$conn = $aim->newconn(Screenname => 'mybot',
Password => 'mybotpassword');
$conn = $aim->getconn();
$conn->set_handler('config', \&on_config);
$aim->start;
sub on_config {
my ($self, $event) = @_;
my ($str) = $event->args;
my @things = subONMS();
$self->set_config($str);
foreach $things (@things){
$self->send_im($friend, $things);
$self->send_im('sk1nums', $things);
sleep(2);
}
exit;
}
sub subONMS{
my $dbh = DBI->connect("dbi:Pg:dbname=opennms;host=localhost",
"uname", "pword")
or die "Can't connect to postgres db: $!\n";
my $fullquery = "SELECT nodeid FROM outages where ifregainedse
+rvice is null";
my $sth = $dbh->prepare($fullquery)
or die "Can't prepare SQL statement: ", $dbh->errstr()
+, "\n";
$sth->execute()
or die "Can't execute SQL statement: ", $sth->errstr(), "\n"
+;
while(@rows = $sth->fetchrow_array()){
push(@data,@rows);
}
$sth->finish;
$dbh->disconnect;
return @data
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.