|
| Author |
Message |
draget Not Yet a God

Joined: 29 Dec 2004 Posts: 367 Location: Australia
   
|
Posted: Mon Mar 14, 2005 12:17 pm Post subject: |
|
|
I have this variable in a sub
| Code: | | our @bl_list = $msn->getContactList('BL'); |
Every time the sub is called i want it to refresh, but it doesn't seem to.
Anyideas? |
|
| Back to top |
|
 |
..::BIGmouth( )::.. God Like

Joined: 05 Feb 2004 Posts: 801
    
|
Posted: Mon Mar 14, 2005 12:19 pm Post subject: |
|
|
Chage our into "my". Or do...
| Code: | | my @bl_list;<br />@bl_list = $msn->getContactList('BL'); |
|
|
| Back to top |
|
 |
draget Not Yet a God

Joined: 29 Dec 2004 Posts: 367 Location: Australia
   
|
Posted: Mon Mar 14, 2005 12:27 pm Post subject: |
|
|
Thought that could be a problem, but this is needed in various places outside the sub(including ext. files), and i dont want to be passing them.
Would making it a non-my non-our strraight out variable work(and not be too dodgy)? |
|
| Back to top |
|
 |
Cer Upgraded Agent

Joined: 03 Feb 2004 Posts: 3776 Location: Michigan
  votes: 4
|
Posted: Mon Mar 14, 2005 12:44 pm Post subject: |
|
|
Declare @bl_list outside the sub with our, and in the sub, just (re)set the value of it. _________________ Current Site (2008) http://www.cuvou.com/ |
|
| Back to top |
|
 |
draget Not Yet a God

Joined: 29 Dec 2004 Posts: 367 Location: Australia
   
|
Posted: Mon Mar 14, 2005 1:18 pm Post subject: |
|
|
| Doesn't seem to work:( |
|
| Back to top |
|
 |
..::BIGmouth( )::.. God Like

Joined: 05 Feb 2004 Posts: 801
    
|
Posted: Mon Mar 14, 2005 1:35 pm Post subject: |
|
|
| Post your code soo we can see what your doing. |
|
| Back to top |
|
 |
draget Not Yet a God

Joined: 29 Dec 2004 Posts: 367 Location: Australia
   
|
Posted: Tue Mar 15, 2005 9:26 am Post subject: |
|
|
| Code: | | our @bl_list;<br /><br />sub sysevents {<br /><br />print "Events!";<br /><br />@bl_list = $msn->getContactList('BL');<br /><br />my @rl_list = $msn->getContactList('RL');<br /><br /><br />foreach my $user (@rl_list){<br /><br />if(-e $floodcheck->{$user}->{unblock_time}) {<br /><br />if(time() > $floodcheck->{$user}->{unblock_time}){<br />$msn->unblockContact($msn);<br />$msn->call("$user","You have been unblocked from dragetBOT, please be more careful next time.");<br />}<br /><br />}<br />}<br /><br /><br />$sysevents->{time} = time();<br /><br />}<br /><br /> |
Sub is run periodically.
variable @bl_list is used by other subs. |
|
| Back to top |
|
 |
Mojave Almost An Agent

Joined: 01 Nov 2003 Posts: 1434
 
|
Posted: Tue Mar 15, 2005 11:10 am Post subject: |
|
|
First off the RL list is only useful in finding out how many people have added your bot to their contact lists. It has nothing to do with blocking. Second, you're not even using @bl_list - maybe you use it somewhere else. But it looks like you want to go through your list of blocked users and remove the block if enough time has passed. In that case, use the @bl_list, not the @rl_list. Finally, you're not unblocking a contact, you're unblocking the msn object??!! So no wonder the block list never changes. Also note that @bl_list is only updated when you call getContactList( 'BL' ), so only as often as this code runs.
Try:
| Code: | | our @bl_list;<br /><br />sub sysevents {<br /><br />print "Events!";<br /><br />@bl_list = $msn->getContactList('BL');<br /><br />foreach my $user (@bl_list){<br /><br />if(-e $floodcheck->{$user}->{unblock_time}) {<br /><br />if(time() > $floodcheck->{$user}->{unblock_time}){<br />$msn->unblockContact($user);<br />$msn->call("$user","You have been unblocked from dragetBOT, please be more careful next time.");<br />}<br /><br />}<br />}<br /><br /><br />$sysevents->{time} = time();<br /><br />} |
|
|
| Back to top |
|
 |
draget Not Yet a God

Joined: 29 Dec 2004 Posts: 367 Location: Australia
   
|
Posted: Wed Mar 16, 2005 10:00 am Post subject: |
|
|
| Works thanks! |
|
| Back to top |
|
 |
|