| View previous topic :: View next topic |
| Author |
Message |
dfxrick Voice
Joined: 26 Jan 2010 Posts: 4 Location: Alexandria, KY
|
Posted: Wed Mar 31, 2010 10:59 pm Post subject: timer |
|
|
Can someone please help me out with this code? I'm having problems finding out why its not working. I dont see it. after 60 minutes of idle its supposed to remove the authflag, and it isn't, can anyone please help with this problem. u can find me on #fam or #tzirc on efnet. Please help me out. Thanks!!!
proc auth_idle {} {
global _auth authflag
set idletime 1
set chans [channels]
set chan_tot [llength $chans]
set chan_num 0
for {set loop 0} {$loop < $chan_tot} {incr loop} {
set nicks [chanlist [lindex $chans $loop] $authflag]
set nickidle 1
set nick_tot [llength $nicks]
for {set loop2 0} {$loop2 < $nick_tot} {incr loop2} {
set idletime [getchanidle [lindex $nicks $loop2] [lindex $chans $loop]]
if {$idletime >= $nickidle} {set nickidle $idletime}
if {($idletime > 60)} {
set nick [lindex $nicks $loop2]
set hand [nick2hand [lindex $nicks $loop2]]
if {[hand2idx $hand] == -1} {
putlog "$nick Idle over 60 minutes. Deauthenticated."
chattr $hand "-${authflag}"
putserv "NOTICE $nick :Idle over 60 minutes. Deauthenticated."
}
}
}
} _________________ www.tzirc.com check us out |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Apr 01, 2010 1:50 pm Post subject: |
|
|
At a first glance, there seems to be one } missing at the end. I'd recommend using the "code" BB-code tags for code, as this preserve indenting, and generally makes the code easier to read.
Also, you could easily replace all those for-loops and multiple lindex operations with a simple foreach-loop.
As for the logics, should a user be deauth'd if (s)he's idle on a single channel (even if (s)he's been active on any other), or does (s)he have to be idle on all channels?
Finally, how do you trigger the code? Timers/utimers, time binding, other event?
That said, here's a cleanup of your code sofar:
| Code: | proc auth_idle {} {
global authflag
foreach chan [channels] {
foreach nick [chanlist $chan $authflag] {
if {[getchanidle $nick $chan] > 60 && [hand2idx [nick2hand $nick]] == -1} {
putlog "$nick Idle over 60 minutes. Deauthenticated."
chattr $hand "-${authflag}"
putserv "NOTICE $nick :Idle over 60 minutes. Deauthenticated."
}
}
}
} |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|