User Control Panel
Advertisements
HELP US, HELP YOU!
Author
Message
Tony_shu God Like Joined: 12 Nov 2003Posts: 624
Posted: Thu Jan 29, 2004 9:19 am Post subject:
This is what I've done so far, with the help of Mojave, because we still couldn't resolve this problem after hours of off-forum discussion. This is what we have done so far...and none of it has really worked: Within my bot.pl file, I set the handler for update_buddy: Code: $conn->set_handler('update_buddy', \&on_update_buddy);<br />
...and by Mojave's suggestion, I created ONE global hash: This is the new on_update_buddy() sub: Code: sub on_update_buddy {<br /><br /> my ($self,$evt,$from,$to) = @_;<br /> my ($bud,$online,$evil,$signon_time,$idle_amount,$user_class) = @{$evt->args()};<br /> my $toprint;<br /><br /> $skreenname = lc($bud);<br /> $skreenname =~ s/ //g;<br /><br /> #Buddy has signed on<br /> if ($online eq "T") {<br /> $users_status{$skreenname} = "online";<br /> $time = localtime();<br /> $toprint .= "<$time> User $bud has just signed on.\n\n";<br /> }<br /> #Buddy has signed offline<br /> if ($online eq "F") {<br /> $users_status{$skreenname} = "offline";<br /> $time = localtime();<br /> $toprint .= "<$time> User $bud has signed off.\n\n";<br /> }<br /> #Buddy is away<br /> if ($online eq "T" && length $user_class == 3) {<br /> $users_status{$skreenname} = "away";<br /> $time = localtime();<br /> $toprint .= "<$time> User $bud is away.\n\n";<br /> }<br /> #Buddy is idle<br /> if ($online eq "T" && $idle_amount>0) {<br /> $users_status{$skreenname} = "idle";<br /> $time = localtime();<br /> $toprint .= "<$time> User $bud is idle.\n\n";<br /> }<br /> #Buddy returns from away status<br /> if ($online eq "T" && $users_status{$skreenname} eq "away" && length $user_class != 3) {<br /> $users_status{$skreenname} = "online";<br /> $time = localtime();<br /> $toprint .= "<$time> User $bud has returned from away status.\n\n";<br /> }<br /> #Buddy is no longer idle<br /> if ($online eq "T" && $users_status{$skreenname} eq "idle" && $idle_amount == 0) {<br /> $users_status{$skreenname} = "online";<br /> $time = localtime();<br /> $toprint .= "<$time> User $bud is no longer idle.\n\n"<br /> }<br /><br /> &print($toprint);<br /><br />}<br />1;
Code: sub status {<br /><br /> my $scrn = shift;<br /> my $toprint;<br />my $size = scalar keys %users_status;<br />$toprint .= "Online Hash Size: $size\n";<br />$toprint .= "Screenname to check: $scrn\n";<br />$toprint .= "User Stat Hash: " . %users_status . "\n";<br /><br /> my $status;<br /><br /> if ($users_status{$scrn} eq "online") {<br /> $status = "on";<br /> $toprint .= "User " . $scrn . " is online.\n\n";<br /> } elsif ($users_status{$scrn} eq "offline") {<br /> $status = "off";<br /> $toprint .= "User " . $scrn . " is offline.\n\n";<br /> } elsif ($users_status{$scrn} eq "away") {<br /> $status = "away";<br /> $toprint .= "User " . $scrn . " is away.\n\n";<br /> } elsif ($users_status{$scrn} eq "idle") {<br /> $status = "idle";<br /> $toprint .= "User " . $scrn . " is idle.\n\n";<br /> }<br /><br /> &print($toprint);<br /> return $status;<br /><br />}<br />1;
When a person wants to send a message through the !sendim command...this is how the command would call on status() sub: Code: my $status = &status($scrn);<br /> if ($status eq "on") {<br /> $aim->send_im($scrn, "$what");<br /> $toprint .= "$sn: (to $scrn) $what\n\n";<br /> sleep(2);<br /> $reply = "Message sent!";<br /> } elsif ($status eq "off") {<br /> $reply = "Sorry, but $scrn is not online to receive your message";<br /> } elsif ($status eq "away") {<br /> $reply = "Sorry, but $scrn is not available for messaging";<br /> } elsif ($status eq "idle") {<br /> $aim->send_im($scrn, "$what");<br /> $toprint .= "$sn: (to $scrn) $what\n\n";<br /> sleep(2);<br /> $reply = "Individual was idle, however message was sent.";<br /> }
_________________ Anthony Arslan
@-Squared Enterprises
MacroHard Corporation
Back to top
Tony_shu God Like Joined: 12 Nov 2003Posts: 624
Posted: Thu Jan 29, 2004 10:01 am Post subject:
OMG...ISSUE SOLVED! MOJAVE YOU ARE THE GREATEST (no offense anyone else) Issue was solved by placing this within on_config() sub: Code: $self->send_buddies();
_________________ Anthony Arslan
@-Squared Enterprises
MacroHard Corporation
Back to top
eric256 The Keymaker Joined: 03 May 2006Posts: 2292 Location: Colorado
Posted: Thu Jan 29, 2004 3:16 pm Post subject:
LOL. All that and it wasn't a hash/scope issue anyway. hehe. Glad you got it working. _________________ Eric256
Proud previous owner and current admin of Bot-depot.com
Back to top
Tony_shu God Like Joined: 12 Nov 2003Posts: 624
Posted: Thu Jan 29, 2004 3:34 pm Post subject:
Yea...all two pages of issues for something so simple...but everyone should know by know that's my style...lol The smallest things like one darn "wash" will bring the entire machine down...lol I would like to thank my Obsessive-Compulsive Disorder for not letting me quit (and bothering Mojave a lot). And especially thank Mojave for figuring it out . _________________ Anthony Arslan
@-Squared Enterprises
MacroHard Corporation
Back to top
Dazzy Agent Joined: 09 Jan 2004Posts: 1731
Posted: Thu Jan 29, 2004 4:25 pm Post subject:
does it tell you if a user is on or offline?
Back to top
Tony_shu God Like Joined: 12 Nov 2003Posts: 624
Posted: Thu Jan 29, 2004 5:00 pm Post subject:
If they are on the bot's buddy list...then on_update_buddy will print when a screenname is online/offline/away/idle _________________ Anthony Arslan
@-Squared Enterprises
MacroHard Corporation
Back to top