egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

add exceptions in idle tcl

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
simo
Master


Joined: 22 Mar 2015
Posts: 204

PostPosted: Sun Dec 04, 2016 11:29 am    Post subject: add exceptions in idle tcl Reply with quote

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
View user's profile Send private message
Get_A_Fix
Master


Joined: 07 May 2005
Posts: 206
Location: New Zealand

PostPosted: Sun Dec 04, 2016 9:30 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
simo
Master


Joined: 22 Mar 2015
Posts: 204

PostPosted: Mon Dec 05, 2016 11:41 am    Post subject: Reply with quote

thnx Get_A_Fix edited it and testing will let you know about results
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 204

PostPosted: Mon Dec 05, 2016 1:56 pm    Post subject: Reply with quote

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
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 505
Location: Tennessee, USA

PostPosted: Mon Dec 05, 2016 6:08 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
simo
Master


Joined: 22 Mar 2015
Posts: 204

PostPosted: Mon Dec 05, 2016 8:20 pm    Post subject: Reply with quote

tnx SpiKe^^ ill try that and test it
Back to top
View user's profile Send private message
Get_A_Fix
Master


Joined: 07 May 2005
Posts: 206
Location: New Zealand

PostPosted: Tue Dec 06, 2016 2:51 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
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


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber