| View previous topic :: View next topic |
| Author |
Message |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun Dec 04, 2016 11:29 am Post subject: add exceptions in idle tcl |
|
|
how to add exeptions for nicks/hosts in this anti idle tcl
| Code: | # - Using -
# Type in partyline:
# .chanset #help maxidle <time in minutes>
# If set 0 channel's check will be ignored.
# Punishing method (1 = Kick, 2 = Kick/Ban)
set pmethod 2
# Ban time in minutes.
set bantime 1
# Kick's reason
set aidlereason "4NO IDLING! "
# Exception's flags
set flags f|f
# Kick op? (0 = Yes, 1 = No)
set kickop 1
# Kick voice? (0 = Yes, 1 = No)
set kickvoice 1
#Check for idling users every minutes.
bind time - * aidle:checkidle
setudef int maxidle
proc aidle:checkidle { min hour day month year } {
global botnick flags kickop kickvoice
foreach chan [channels] {
if {![channel get $chan "maxidle"]} {continue}
foreach nick [chanlist $chan] {
if {$nick == $botnick} {continue}
if {([isop $nick $chan]) && ($kickop)} {continue}
if {([isvoice $nick $chan]) && ($kickvoice)} {continue}
if {[matchattr [nick2hand $nick] $flags] == 1} {continue}
if {[getchanidle $nick $chan] > [channel get $chan "maxidle"]} {
aidle:punish $chan $nick [channel get $chan "maxidle"]
}
}
}
}
proc aidle:punish { channel nick idletime } {
global pmethod aidlereason bantime
regsub -all "%idletime" $aidlereason $idletime aidlereason
switch $pmethod {
1 { putquick "MODE $channel -qaho $nick $nick $nick $nick" -next }
3 { putserv "KICK $channel $nick :$aidlereason" }
2 {
#putserv "KICK $channel $nick :$aidlereason"
# putquick "MODE $channel -qaho $nick $nick $nick $nick"
putquick "MODE $channel -qaho $nick $nick $nick $nick" -next
#utimer 300 "pushmode $channel -b *!*@[lindex [split [getchanhost $nick $channel] @] 1]"
}
}
}
|
|
|
| Back to top |
|
 |
Get_A_Fix Master

Joined: 07 May 2005 Posts: 206 Location: New Zealand
|
Posted: Sun Dec 04, 2016 9:30 pm Post subject: |
|
|
First, set the exempt list in the settings area.
| Code: |
# Set nickname or host exemptions
set exemptlist {
"bob"
"*.host.mask.etc"
}
|
Then, you'd want to add the argument to your list of globals in the aidle:punish proc.
| Code: |
global exemptlist pmethod aidlereason bantime
|
And finally, a string match to the aidle:punish procedure.
| Code: |
if {[string match -nocase $exemptlist $nick] || [string match $exemptlist [getchanhost $nick $channel]]} {return}
|
_________________ We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Dec 05, 2016 11:41 am Post subject: |
|
|
| thnx Get_A_Fix edited it and testing will let you know about results |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Dec 05, 2016 1:56 pm Post subject: |
|
|
tested it it doesnt seem to exempt
this is what i have so far:
| Code: | # Set nickname or host exemptions
set exemptlist {
"^__^"
"*.I.Am.Me."
}
# - Using -
# Type in partyline:
# .chanset #help maxidle <time in minutes>
# If set 0 channel's check will be ignored.
# Punishing method (1 = Kick, 2 = Kick/Ban)
set pmethod 2
# Ban time in minutes.
set bantime 1
# Kick's reason
set aidlereason "14,1IPT Account help ONLY! state your user name and issue then wait patiently. Do NOT spam the channel. 4NO IDLING! 4DO NOT ASK FOR INVITES HERE! DO NOT PM ANYONE HERE!"
# Exception's flags
set flags f|f
# Kick op? (0 = Yes, 1 = No)
set kickop 1
# Kick voice? (0 = Yes, 1 = No)
set kickvoice 1
#Check for idling users every minutes.
bind time - * aidle:checkidle
setudef int maxidle
proc aidle:checkidle { min hour day month year } {
global botnick flags kickop kickvoice
foreach chan [channels] {
if {![channel get $chan "maxidle"]} {continue}
foreach nick [chanlist $chan] {
if {$nick == $botnick} {continue}
if {([isop $nick $chan]) && ($kickop)} {continue}
if {([isvoice $nick $chan]) && ($kickvoice)} {continue}
if {[matchattr [nick2hand $nick] $flags] == 1} {continue}
if {[getchanidle $nick $chan] > [channel get $chan "maxidle"]} {
aidle:punish $chan $nick [channel get $chan "maxidle"]
}
}
}
}
proc aidle:punish { channel nick idletime } {
#global pmethod aidlereason bantime
global exemptlist pmethod aidlereason bantime
if {[string match -nocase $exemptlist $nick] || [string match $exemptlist [getchanhost $nick $channel]]} {return}
regsub -all "%idletime" $aidlereason $idletime aidlereason
switch $pmethod {
1 { putquick "MODE $channel -qaho $nick $nick $nick $nick" -next }
3 { putserv "KICK $channel $nick :$aidlereason" }
2 {
#putserv "KICK $channel $nick :$aidlereason"
# putquick "MODE $channel -qaho $nick $nick $nick $nick"
putquick "MODE $channel -qaho $nick $nick $nick $nick" -next
#utimer 300 "pushmode $channel -b *!*@[lindex [split [getchanhost $nick $channel] @] 1]"
}
}
}
|
|
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Mon Dec 05, 2016 6:08 pm Post subject: |
|
|
That won't work, that's not how string match wants its stuff...
I might remove this entire line | Code: | | if {[string match -nocase $exemptlist $nick] || [string match $exemptlist [getchanhost $nick $channel]]} {return} |
and replace it with something more like | Code: |
set uhost [getchanhost $nick $channel]
foreach mask $exemptlist {
if {[string match -nocase $mask $nick!$uhost]} { return }
}
|
Then in the exempt list setting use fully qualified irc masks (nick!username@host)
so to exempt a nick: somenick!*
exempt a masked host: *@*.some.domain.com
etc..................
goodluck _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Dec 05, 2016 8:20 pm Post subject: |
|
|
| tnx SpiKe^^ ill try that and test it |
|
| Back to top |
|
 |
Get_A_Fix Master

Joined: 07 May 2005 Posts: 206 Location: New Zealand
|
Posted: Tue Dec 06, 2016 2:51 am Post subject: |
|
|
Strange, it has worked for me in the past. Alternatively, as the exemptlist is a list, you could lsearch to match. _________________ We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals. |
|
| Back to top |
|
 |
|