|
| Author |
Message |
Tony_shu God Like

Joined: 12 Nov 2003 Posts: 624
    
|
Posted: Fri Jan 23, 2004 2:12 pm Post subject: |
|
|
I thought I saw, somewhere on this forum, a command/handler to check the status (i.e., sub status())of a screenname (online,offline,sleeping,idle,etc.).
However, I can't seem to find it. Can someone please show me the link to its posting?
Thanks  _________________ Anthony Arslan
@-Squared Enterprises
MacroHard Corporation |
|
| Back to top |
|
 |
Tony_shu God Like

Joined: 12 Nov 2003 Posts: 624
    
|
Posted: Fri Jan 23, 2004 2:48 pm Post subject: |
|
|
Doesn't BotWorkWatcher uses a status check command/handler of some sort to check for uptime of bots. _________________ Anthony Arslan
@-Squared Enterprises
MacroHard Corporation |
|
| Back to top |
|
 |
Sypher Senior Member

Joined: 01 Jan 2004 Posts: 233 Location: The Netherlands
    
|
Posted: Fri Jan 23, 2004 3:15 pm Post subject: |
|
|
I'm looking for the same thing but slightly different, a block checker (almost the same but it checks on 'online' and 'offline') for msn  _________________ Sypher
Developer of Codera |
|
| Back to top |
|
 |
Tony_shu God Like

Joined: 12 Nov 2003 Posts: 624
    
|
Posted: Fri Jan 23, 2004 10:48 pm Post subject: |
|
|
Mojave (sorry to call you out)...any help here? B) _________________ Anthony Arslan
@-Squared Enterprises
MacroHard Corporation |
|
| Back to top |
|
 |
Mojave Almost An Agent

Joined: 01 Nov 2003 Posts: 1434
 
|
Posted: Sat Jan 24, 2004 2:14 am Post subject: |
|
|
If you want to know when an MSN user goes online for offline, you need to add them to your 'FL' list. This is the normal contacts list that people would use. Anyhow, then you will get notifications for that user.
I believe there is a new MSN.pm in the works and I'll be sure that the code to add and rem buddies is included.
What do you mean by a block checker? |
|
| Back to top |
|
 |
Keenie Almost An Agent

Joined: 31 Oct 2003 Posts: 1071
 
|
Posted: Sat Jan 24, 2004 2:20 am Post subject: |
|
|
naw i think he meens for aim Mojave, sypher just posted offtopic(plus "blockcheckers" for msn do not work, "block all otheres" is enabled by default, plus last week they fixed the 216 bug which let you know if you were blocked")
anyways I have no idea how net::aim works so im not much help here |
|
| Back to top |
|
 |
Myzterio Not Yet a God

Joined: 13 Dec 2003 Posts: 429
    
|
Posted: Sat Jan 24, 2004 2:21 am Post subject: |
|
|
Block Checker :
eg : \check johndoe@hotmail.com = if he was offline it would say like "johndoe@hotmail.com is currently offline"
Edit :Sorry, For this post me and keenie must of posted at the same time |
|
| Back to top |
|
 |
Mojave Almost An Agent

Joined: 01 Nov 2003 Posts: 1434
 
|
Posted: Sat Jan 24, 2004 2:24 am Post subject: |
|
|
| Tony, are you looking for MSN or AIM code? I can give you the AIM code as well. |
|
| Back to top |
|
 |
Tony_shu God Like

Joined: 12 Nov 2003 Posts: 624
    
|
Posted: Sat Jan 24, 2004 4:29 am Post subject: |
|
|
I'm looking for help with the AIM status check...thanx _________________ Anthony Arslan
@-Squared Enterprises
MacroHard Corporation |
|
| Back to top |
|
 |
Tony_shu God Like

Joined: 12 Nov 2003 Posts: 624
    
|
Posted: Sun Jan 25, 2004 4:50 pm Post subject: |
|
|
I found this code in the other forum (the old WirdBots forum/site....I closed the window & have lost the link :huh: )
| Code: | | sub on_update_buddy {<br /><br /><br />#Variables for holding online, away, and idle users<br />my %users_online;<br />my %buddies_away;<br />my %buddies_idle;<br /><br />my ($self,$evt,$from,$to) = @_;<br />my ($bud,$online,$evil,$signon_time,$idle_amount,$user_class) = @{$evt->args()};<br /><br />$scn = lc($bud);<br />$scn =~ s/ //g;<br /><br />#Buddy has signed on<br />if ($online eq "T" && !exists $users_online{$scn}) {<br /> $user_online{$scn} = time;<br /> $time = localtime();<br /> print "<$time> User $bud has just signed on.\n\n";<br />}<br />#Buddy has signed offline<br />if ($online eq "F") {<br /> if (exists $buddies_away{$scn}) {<br /> delete $buddies_away{$scn};<br /> }<br /> if (exists $buddies_idle{$scn}) {<br /> delete $buddies_idle{$scn};<br /> }<br /> delete $users_online{$scn};<br /> $time = localtime();<br /> print "<$time> User $bud has signed off.\n\n";<br />}<br />#Buddy is away<br />if ($online eq "T" && !exists $buddies_away{$scn} && length $user_class==3) {<br /> $buddies_away{$scn} = time;<br /> $time = localtime();<br /> print "<$time> User $bud is away.\n\n";<br />}<br />#Buddy is idle<br />if ($online eq "T" && !exists $buddies_idle{$scn} && $idle_amount>0) {<br /> $buddies_idle{$scn} = time;<br /> $time = localtime();<br /> print "<$time> User $bud is idle.\n\n";<br />}<br />#Buddy returns from away status<br />if ($online eq "T" && exists $buddies_away{SN} && length $user_class != 3) {<br /> delete $buddies_away{$scn};<br /> $time = localtime();<br /> print "<$time> User $bud has returned from away status.\n\n";<br />}<br />#Buddy is no longer idle<br />if ($online eq "T" && exists $buddies_idle{$scn} && $idle_amount == 0) {<br /> delete $buddies_idle{$scn};<br /> $time = localtime();<br /> print "<$time> User $bud is no longer idle.\n\n"<br />}<br />#Buddy is not away OR idle<br />if ($online eq "T" && (exists $buddies_away{$scn} || exists $buddies_idle{$scn}) && $idle_amount == 0 && length $user_class != 3) {<br /> if (exists $buddies_away{$scn}) {<br /> delete $buddies_away{$scn};<br /> }<br /> if (exists $buddies_idle{$scn}) {<br /> delete $buddies_idle{$scn};<br /> }<br /> $time = localtime();<br /> print "<$time> $bud is not away or idle.\n\n";<br />}<br />}<br />1; |
Does it still work?...or have I "installed" it wrong.
I opened my login.pl and placed this in the code to automatically call on this sub.
| Code: | | $conn->set_handler('update_buddy', \&on_update_buddy); |
_________________ Anthony Arslan
@-Squared Enterprises
MacroHard Corporation |
|
| Back to top |
|
 |
Tony_shu God Like

Joined: 12 Nov 2003 Posts: 624
    
|
Posted: Mon Jan 26, 2004 7:35 am Post subject: |
|
|
Mojave...this is the post I was talking about. Thans  _________________ Anthony Arslan
@-Squared Enterprises
MacroHard Corporation |
|
| Back to top |
|
 |
Mojave Almost An Agent

Joined: 01 Nov 2003 Posts: 1434
 
|
Posted: Mon Jan 26, 2004 10:08 am Post subject: |
|
|
That code looks like it would work except for one important thing: the three variables %users_online, %buddies_away and %buddies_idle are my varialbes inside that sub so they are deleted once the sub returns and created again next time the sub is called.
You need to put them at the top of your main bot code and then they will work properly.
Were you getting any other errors? Should at least have been getting some prints. |
|
| Back to top |
|
 |
Tony_shu God Like

Joined: 12 Nov 2003 Posts: 624
    
|
Posted: Mon Jan 26, 2004 2:42 pm Post subject: |
|
|
It does not print anything. My buddy list groups are called "Admins, Blocks, and Buddies"...does that have any affect?
Also...my entire bot code pretty much uses $aim instead of $self...I'm not sure if that has any effect.
EDITED: I finally found the link where I got this code from: http://www.wiredbots.com/ib/index.php?act=ST&f=7&t=1702&hl=
Yes...apparently, all my buddies have to be in the "buddy" group. Is there a way for the bot to check all the groups? _________________ Anthony Arslan
@-Squared Enterprises
MacroHard Corporation |
|
| Back to top |
|
 |
Tony_shu God Like

Joined: 12 Nov 2003 Posts: 624
    
|
Posted: Mon Jan 26, 2004 5:37 pm Post subject: |
|
|
OK...I got the above code to work. Thanks for the help Mojave .
Now...I tried to add a little extra to my bot...but it doesn't seem to work.
When people use the !sendim command the bot just "sends" a message, and tells the user that the message was sent. However, a lot of times, it was not received because the target of !sendim is not online.
So I tried to use a modified version of on_update_buddy() and called it status(): | Code: | | sub status {<br /><br /> my ($self,$evt,$from,$to) = @_;<br /> my ($bud,$online,$evil,$signon_time,$idle_amount,$user_class) = @{$evt->args()};<br /> my $who = shift;<br /> my ($toprint,$status);<br /><br /> #Buddy has signed on<br /> if ($online eq "T" && !exists $users_online{$who}) {<br /> $status = "on";<br /> $toprint .= "<$time> User $who is online.\n\n";<br /> }<br /> #Buddy has signed offline<br /> if ($online eq "F" && !exists $users_online{$who} ne 1) {<br /> $status = "off";<br /> $toprint .= "<$time> User $who is offline.\n\n";<br /> }<br /> #Buddy is away<br /> if ($online eq "T" && !exists $buddies_away{$who} && length $user_class==3) {<br /> $status = "away";<br /> $toprint .= "<$time> User $who is away.\n\n";<br /> }<br /> #Buddy is idle<br /> if ($online eq "T" && !exists $buddies_idle{$who} && $idle_amount>0) {<br /> $status = "idle";<br /> $toprint .= "<$time> User $who is idle.\n\n";<br /> }<br /><br /> &print($toprint);<br /> return $status;<br /><br />}<br />1; |
The !sendim command calls on status() this way: | Code: | | $status = &status($scrn); | I know it opens up the status() because thats where the bot crashes. I normally get an error saying something failed in the calls (on line 4) | Quote: | my ($bud,$online,$evil,$signon_time,$idle_amount,$user_class) = @{$evt->args()};
|
_________________ Anthony Arslan
@-Squared Enterprises
MacroHard Corporation |
|
| Back to top |
|
 |
Keenie Almost An Agent

Joined: 31 Oct 2003 Posts: 1071
 
|
Posted: Mon Jan 26, 2004 6:11 pm Post subject: |
|
|
I don't know much about net::aim, but isnt on_update_buddies an event, which you can't just update any time you want.
so how you should do it is keep the updatebuddy event, which will store everything in a hash for you, then when you do the !sendim, check for info about the user in the hash, and act based on where they are. |
|
| Back to top |
|
 |
|