This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

add exceptions in idle tcl

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
s
simo
Revered One
Posts: 1073
Joined: Sun Mar 22, 2015 2:41 pm

add exceptions in idle tcl

Post by simo »

how to add exeptions for nicks/hosts in this anti idle tcl

Code: Select all

# - 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]"
  }
	}
}


User avatar
Get_A_Fix
Master
Posts: 206
Joined: Sat May 07, 2005 6:11 pm
Location: New Zealand

Post by Get_A_Fix »

First, set the exempt list in the settings area.

Code: Select all

# 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: Select all

global exemptlist pmethod aidlereason bantime
And finally, a string match to the aidle:punish procedure.

Code: Select all

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.
s
simo
Revered One
Posts: 1073
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

thnx Get_A_Fix edited it and testing will let you know about results
s
simo
Revered One
Posts: 1073
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

tested it it doesnt seem to exempt

this is what i have so far:

Code: Select all

# 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]"
  }
	}
}
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

That won't work, that's not how string match wants its stuff...

I might remove this entire line

Code: Select all

if {[string match -nocase $exemptlist $nick] || [string match $exemptlist [getchanhost $nick $channel]]} {return} 
and replace it with something more like

Code: Select all

  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
.
s
simo
Revered One
Posts: 1073
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

tnx SpiKe^^ ill try that and test it
User avatar
Get_A_Fix
Master
Posts: 206
Joined: Sat May 07, 2005 6:11 pm
Location: New Zealand

Post by Get_A_Fix »

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.
Post Reply