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.
Help for those learning Tcl or writing their own scripts.
Arnold_X-P
Master
Posts: 226 Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:
Post
by Arnold_X-P » Sun Dec 21, 2014 9:39 pm
it is necessary to this tcl to add a list of ignored but I could not any friend who helps me to add such a list example: set nohostcops {
this tcl has a time error this message leaves in partyline
[21:33] <RoBoCoP> [01:33:00] Tcl error [idlekick:tick]: wrong # args: should be "timer minutes command"
Code: Select all
# How to use:
# 1) Enable on channels you wish to use it on:
# .chanset #example +idlekick
#
# 2) Configure how long users are allowed to idle (in minutes)
# .chanset #example idlekick-time 15
#
# 3) You may configure the messages below.
# Warning message
set warningmsg "Warning! You will be kicked in 18 minute due to our anti-idle policy."
# Kick message
set kickmsg "sorry no idle please - this channel has an anti-idle policy."
# How many minutes ban user for.
set bantime 5
# ------------------------------------------------------------------------------------
setudef flag idlekick
setudef str idlekick-time
## nicksname to ignore
set nonicksirpat {
"bopm"
"AdminServ"
"sedition"
"master"
"eggy"
"OperHelp"
"Arnold_X-P"
}
## vhost or ips to ignore
set nohostcops {
"*.Speed.org*"
"*.Administrator.org*"
"*.proxie.scan*"
"*190.ix.server.tor.us*"
"*.tu.ReY.es*"
"*Staff.latinchat*"
"*Staff.Speed.org*"
"*ChiQuiTiTa.es*"
"*.Network.Administrator*"
"*VicioChat.Org*"
}
bind time - "* * * * *" idlekick:tick
proc idlekick:tick {minute hour day month year} {
foreach channel [channels] {
if {[channel get $channel idlekick] == "1" && [botisop $channel]} {
foreach iu [chanlist $channel] {
if {![isbotnick $iu] && [onchan $iu $channel] && ![isop $iu $channel]
&& ![ishalfop $iu $channel] && ![isvoice $iu $channel]} {
if {[getchanidle $iu $channel] == [expr [channel get $channel idlekick-time] -1]} {
idlekick:warn $channel $iu
}
if {[getchanidle $iu $channel] >= [channel get $channel idlekick-time]} {
idlekick:kick $channel $iu
}
}
}
}
}
}
proc idlekick:warn {channel nick uhost} {
global warningmsg nonicksirpat nohostcops
foreach user $nohostcops {
if {[string match -nocase $user $uhost]} {return 0}
}
if {[lsearch -exact [string tolower $nonicksirpat] [string tolower $nick]] == -1} {
putlog "ANTIIDLE: Warning $nick on $channel due to idling"
puthelp "PRIVMSG $channel :$nick: $warningmsg"
}
proc idlekick:kick {channel nick uhost} {
global kickmsg bantime nonicksirpat nohostcops
foreach user $nohostcops {
if {[string match -nocase $user $uhost]} {return 0}
}
if {[lsearch -exact [string tolower $nonicksirpat] [string tolower $nick]] == -1} {
set nickhost [lindex [split [getchanhost $nick] "@"] 1]
putserv "MODE $channel +b *!*@$nickhost"
putserv "KICK $channel $nick :$kickmsg"
timer $bantime putserv "MODE $channel -b *!*@$nickhost"
putlog "ANTIIDLE: Banning $nick on $channel due to idling"
}
}
}
SpiKe^^
Owner
Posts: 831 Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:
Post
by SpiKe^^ » Sun Dec 21, 2014 11:44 pm
Try this...
Code: Select all
# How to use:
# 1) Enable on channels you wish to use it on:
# .chanset #example +idlekick
#
# 2) Configure how long users are allowed to idle (in minutes)
# .chanset #example idlekick-time 15
#
# 3) You may configure the messages below.
# Warning message
set warningmsg "Warning! You will be kicked in 18 minute due to our anti-idle policy."
# Kick message
set kickmsg "sorry no idle please - this channel has an anti-idle policy."
# How many minutes ban user for.
set bantime 5
# ------------------------------------------------------------------------------------
setudef flag idlekick
setudef str idlekick-time
## nicksname to ignore
set nonicksirpat {
"bopm"
"AdminServ"
"sedition"
"master"
"eggy"
"OperHelp"
"Arnold_X-P"
}
## vhost or ips to ignore
set nohostcops {
"*.Speed.org*"
"*.Administrator.org*"
"*.proxie.scan*"
"*190.ix.server.tor.us*"
"*.tu.ReY.es*"
"*Staff.latinchat*"
"*Staff.Speed.org*"
"*ChiQuiTiTa.es*"
"*.Network.Administrator*"
"*VicioChat.Org*"
}
bind time - "* * * * *" idlekick:tick
proc idlekick:tick {minute hour day month year} {
foreach ch [channels] {
if {[channel get $ch idlekick] == "1" && [botisop $ch]} {
foreach iu [chanlist $ch] {
if {![isbotnick $iu]&&[onchan $iu $ch]&&![isop $iu $ch]&&![ishalfop $iu $ch]&&![isvoice $iu $ch]} {
if {[getchanidle $iu $ch] == [expr [channel get $ch idlekick-time] -1]} {
idlekick:warn $ch $iu
}
if {[getchanidle $iu $ch] >= [channel get $ch idlekick-time]} {
idlekick:kick $ch $iu
}
}
}
}
}
}
proc idlekick:warn {channel nick uhost} {
global warningmsg nonicksirpat nohostcops
foreach user $nohostcops {
if {[string match -nocase $user $uhost]} {return 0}
}
if {[lsearch -exact [string tolower $nonicksirpat] [string tolower $nick]] == -1} {
putlog "ANTIIDLE: Warning $nick on $channel due to idling"
puthelp "PRIVMSG $channel :$nick: $warningmsg"
}
}
proc idlekick:kick {channel nick uhost} {
global kickmsg bantime nonicksirpat nohostcops
foreach user $nohostcops {
if {[string match -nocase $user $uhost]} {return 0}
}
if {[lsearch -exact [string tolower $nonicksirpat] [string tolower $nick]] == -1} {
set nickhost [lindex [split [getchanhost $nick] "@"] 1]
putserv "MODE $channel +b *!*@$nickhost"
putserv "KICK $channel $nick :$kickmsg"
timer $bantime [list putserv "MODE $channel -b *!*@$nickhost"]
putlog "ANTIIDLE: Banning $nick on $channel due to idling"
}
}
Arnold_X-P
Master
Posts: 226 Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:
Post
by Arnold_X-P » Mon Dec 22, 2014 1:15 am
the tcl works well
add a section to ignore vhost or ips and so the tcl omits the content of this list
but on having created this list, it went out new errors.
<RoBoCoP> [05:01:00] Tcl error [idlekick:tick]: wrong # args: should be "idlekick:kick channel nick uhost"
earlier
Code: Select all
proc idlekick:warn {channel nick } {
set nohostcops {
"*.Speed.org*"
"*.Administrator.org*"
"*.proxie.scan*"
"*190.ix.server.tor.us*"
"*.tu.ReY.es*"
"*Staff.latinchat*"
"*Staff.Speed.org*"
"*ChiQuiTiTa.es*"
"*.Network.Administrator*"
"*VicioChat.Org*"
}
current
proc idlekick:warn {channel nick uhost} {
++++
proc idlekick:warn {channel nick uhost} {
global warningmsg nonicksirpat nohostcops
foreach user $nohostcops {
if {[string match -nocase $user $uhost]} {return 0}
}
if {[lsearch -exact [string tolower $nonicksirpat] [string tolower $nick]] == -1} {
putlog "ANTIIDLE: Warning $nick on $channel due to idling"
puthelp "PRIVMSG $channel :$nick: $warningmsg"
}
}
proc idlekick:kick {channel nick uhost} {
global kickmsg bantime nonicksirpat nohostcops
foreach user $nohostcops {
if {[string match -nocase $user $uhost]} {return 0}
}
if {[lsearch -exact [string tolower $nonicksirpat] [string tolower $nick]] == -1} {
set nickhost [lindex [split [getchanhost $nick] "@"] 1]
putserv "MODE $channel +b *!*@$nickhost"
putserv "KICK $channel $nick :$kickmsg"
timer $bantime [list putserv "MODE $channel -b *!*@$nickhost"]
putlog "ANTIIDLE: Banning $nick on $channel due to idling"
}
}
SpiKe^^
Owner
Posts: 831 Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:
Post
by SpiKe^^ » Wed Dec 24, 2014 11:13 pm
Give this a try...
Code: Select all
# How to use:
# 1) Enable on channels you wish to use it on:
# .chanset #example +idlekick
#
# 2) Configure how long users are allowed to idle (in minutes)
# .chanset #example idlekick-time 15
#
# 3) You may configure the messages below.
# Warning message
set warningmsg "Warning! You will be kicked in 1 minute due to our anti-idle policy."
# Kick message
set kickmsg "Sorry no idle please - This channel has an anti-idle policy."
# How many minutes ban user for.
set bantime 5
## nicksname to ignore
set exemptnicks {
bopm
AdminServ
sedition
master
eggy
OperHelp
Arnold_X-P
}
## vhost or ips to ignore
set exempthosts {
*.Speed.org
*.Administrator.org
*.proxie.scan*
*190.ix.server.tor.us
*.tu.ReY.es
*Staff.latinchat*
*Staff.Speed.org
*ChiQuiTiTa.es
*.Network.Administrator*
*VicioChat.Org
}
# ----------------------------------------------------------------------------------
setudef flag idlekick
setudef str idlekick-time
set exemptnicks [split [string trim $exemptnicks] "\n"]
set exempthosts [split [string trim $exempthosts] "\n"]
bind time - "* * * * *" idlekick:tick
proc idlekick:tick {minute hour day month year} {
global exemptnicks
foreach ch [channels] {
if {[channel get $ch idlekick] && [botisop $ch]} {
set maxidle [channel get $ch idlekick-time]
set warntime [expr {$maxidle - 1}]
foreach iu [chanlist $ch] {
if {[isbotnick $iu] || ![onchan $iu $ch] || [isop $iu $ch]} { continue }
if {[ishalfop $iu $ch] || [isvoice $iu $ch]} { continue }
if {[lsearch -nocase $exemptnicks $iu]>"-1"} { continue }
set idletime [getchanidle $iu $ch]
if {$idletime == $warntime} {
idlekick:warn $ch $iu [getchanhost $iu $ch]
} elseif {$idletime >= $maxidle} {
idlekick:kick $ch $iu [getchanhost $iu $ch]
}
}
}
}
return 0
}
proc idlekick:warn {channel nick uhost} {
global warningmsg exempthosts
foreach {hostmask} $exempthosts {
if {[string match -nocase [string trim $hostmask] $uhost]} { return 0 }
}
putlog "ANTIIDLE: Warning $nick on $channel due to idling"
puthelp "PRIVMSG $channel :$nick: $warningmsg"
}
proc idlekick:kick {channel nick uhost} {
global kickmsg bantime exempthosts
foreach {hostmask} $exempthosts {
if {[string match -nocase [string trim $hostmask] $uhost]} { return 0 }
}
set nickhost [lindex [split $uhost "@"] 1]
putserv "MODE $channel +b *!*@$nickhost"
putserv "KICK $channel $nick :$kickmsg"
timer $bantime [list putserv "MODE $channel -b *!*@$nickhost"]
putlog "ANTIIDLE: Banning $nick on $channel due to idling"
}
EDIT: Note: This script requires tcl version 8.5+
Good luck.
Last edited by
SpiKe^^ on Wed Dec 24, 2014 11:50 pm, edited 1 time in total.
Arnold_X-P
Master
Posts: 226 Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:
Post
by Arnold_X-P » Wed Dec 24, 2014 11:22 pm
Arnold_X-P
Master
Posts: 226 Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:
Post
by Arnold_X-P » Wed Dec 24, 2014 11:40 pm
an error went out in partyline:
<RoBoCoP> [03:37:00] Tcl error [idlekick:tick]: bad option "-nocase": must be -all, -ascii, -decreasing, -dictionary, -exact, -glob, -increasing, -inline, -integer, -not, -real, -regexp, -sorted, or -start
my eggdrop use tcl Tcl: 8.4
that one seems to be the cause of that my bot is using an ancient tcl
[23:37] <Arnold_X-P> .tcl info tclversion
[23:37] <RoBoCoP> Tcl: 8.4
friend might create one that is compatible with 8.4 and 8.5 and 8.6
thanksss
SpiKe^^
Owner
Posts: 831 Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:
Post
by SpiKe^^ » Wed Dec 24, 2014 11:45 pm
This should get you around the old tcl issue:)
Code: Select all
# How to use:
# 1) Enable on channels you wish to use it on:
# .chanset #example +idlekick
#
# 2) Configure how long users are allowed to idle (in minutes)
# .chanset #example idlekick-time 15
#
# 3) You may configure the messages below.
# Warning message
set warningmsg "Warning! You will be kicked in 1 minute due to our anti-idle policy."
# Kick message
set kickmsg "Sorry no idle please - This channel has an anti-idle policy."
# How many minutes ban user for.
set bantime 5
## nicksname to ignore
set exemptnicks {
bopm
AdminServ
sedition
master
eggy
OperHelp
Arnold_X-P
}
## vhost or ips to ignore
set exempthosts {
*.Speed.org
*.Administrator.org
*.proxie.scan*
*190.ix.server.tor.us
*.tu.ReY.es
*Staff.latinchat*
*Staff.Speed.org
*ChiQuiTiTa.es
*.Network.Administrator*
*VicioChat.Org
}
# ----------------------------------------------------------------------------------
setudef flag idlekick
setudef str idlekick-time
set exemptnicks [split [string tolower [string trim $exemptnicks]] "\n"]
set exempthosts [split [string trim $exempthosts] "\n"]
bind time - "* * * * *" idlekick:tick
proc idlekick:tick {minute hour day month year} {
global exemptnicks
foreach {ch} [channels] {
if {[channel get $ch idlekick] && [botisop $ch]} {
set maxidle [channel get $ch idlekick-time]
set warntime [expr {$maxidle - 1}]
foreach {nk} [chanlist $ch] {
if {[isbotnick $nk] || ![onchan $nk $ch] || [isop $nk $ch]} { continue }
if {[ishalfop $nk $ch] || [isvoice $nk $ch]} { continue }
if {[lsearch -exact $exemptnicks [string tolower $nk]]>"-1"} { continue }
set idletime [getchanidle $nk $ch]
if {$idletime == $warntime} {
idlekick:warn $ch $nk [getchanhost $nk $ch]
} elseif {$idletime >= $maxidle} {
idlekick:kick $ch $nk [getchanhost $nk $ch]
}
}
}
}
return 0
}
proc idlekick:warn {channel nick uhost} {
global warningmsg exempthosts
foreach {hostmask} $exempthosts {
if {[string match -nocase [string trim $hostmask] $uhost]} { return 0 }
}
putlog "ANTIIDLE: Warning $nick on $channel due to idling"
puthelp "PRIVMSG $channel :$nick: $warningmsg"
}
proc idlekick:kick {channel nick uhost} {
global kickmsg bantime exempthosts
foreach {hostmask} $exempthosts {
if {[string match -nocase [string trim $hostmask] $uhost]} { return 0 }
}
set nickhost [lindex [split $uhost "@"] 1]
putserv "MODE $channel +b *!*@$nickhost"
putserv "KICK $channel $nick :$kickmsg"
timer $bantime [list putserv "MODE $channel -b *!*@$nickhost"]
putlog "ANTIIDLE: Banning $nick on $channel due to idling"
}
Arnold_X-P
Master
Posts: 226 Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:
Post
by Arnold_X-P » Thu Dec 25, 2014 10:22 am
very quite friendly, now if the tcl works to the perfection
once again I want to be grateful to him for its time and help
and to say to him Merry Christmas and happy new year.
abah
Halfop
Posts: 75 Joined: Sun Dec 01, 2013 3:04 am
Location: Indonesia
Post
by abah » Tue Apr 14, 2015 4:37 am
if I do not want to use .chanset #channel
if anything needs in fox so I do not need to use it ?
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Tue Apr 14, 2015 8:42 am
Code: Select all
# Warning message
set idlekick(warn) "Warning! You will be kicked in 1 minute due to our anti-idle policy."
# Kick message
set idlekick(kick) "Sorry no idle please - This channel has an anti-idle policy."
# How many minutes for max amount of idle time in minutes
set idlekick(maxidle) 15
# How many minutes ban user for.
set idlekick(bantime) 5
## nicksname to ignore
set idlekick(nicks) {
bopm
AdminServ
sedition
master
eggy
OperHelp
Arnold_X-P
}
## vhost or ips to ignore
set idlekick(hosts) {
*.Speed.org
*.Administrator.org
*.proxie.scan*
*190.ix.server.tor.us
*.tu.ReY.es
*Staff.latinchat*
*Staff.Speed.org
*ChiQuiTiTa.es
*.Network.Administrator*
*VicioChat.Org
}
bind time - * idlekick:tick
proc idlekick:tick {minute hour day month year} {
global idlekick
foreach chan [channels] {
if {![botisop $chan]} continue
set userlist [lreplace [chanlist $chan] 0 0]
foreach user [split $userlist] {
if {![onchan $user $chan] || [isop $user $chan]} continue
if {[ishalfop $user $chan] || [isvoice $user $chan]} continue
if {[lsearch -nocase $idlekick(nicks) $user] != -1} continue
set matched 0
set uhost [getchanhost $user $chan]
foreach mask $idlekick(hosts) {
if {[string match -nocase $mask $uhost]} {
set matched 1
break
}
}
if {$matched} continue
set idletime [getchanidle $user $chan]
set warntime [expr {$idlekick(maxidle) - 1}]
if {$idletime == $warntime} {
idlekick:act "warn" $chan $user
} elseif {$idletime >= $idlekick(maxidle)} {
idlekick:act "kick" $chan $user $user!$uhost
}
}
}
}
proc idlekick:act {act chan nick {uhost ""}} {
global idlekick
switch -- $act {
default {
return
}
"warn" {
putlog "ANTIIDLE: Warning $nick on $chan due to idling"
puthelp "PRIVMSG $chan :$nick: $idlekick(warn)"
}
"kick" {
putlog "ANTIIDLE: Banning $nick on $chan due to idling"
scan $uhost {%[^!]!%[^@]@%s} nick user host
pushmode $chan +b "*!*@$host"
putkick $chan $nick $idlekick(kick)
utimer [expr $idlekick(bantime) * 60] [list idlekick:act unban $chan $nick "*!*@$host"]
}
"unban" {
if {![botisop $chan]} return
if {[ischanban $uhost $chan]} {
pushmode $chan -b $uhost
}
}
}
}
}
Haven't tested so give it a try and report back if you get any errors.
Edit: Fixed typo.
Last edited by
caesar on Wed Apr 15, 2015 4:27 am, edited 3 times in total.
Once the game is over, the king and the pawn go back in the same box.
abah
Halfop
Posts: 75 Joined: Sun Dec 01, 2013 3:04 am
Location: Indonesia
Post
by abah » Tue Apr 14, 2015 11:51 pm
i try about that but dont work anything sir
maybe any wrong sir ?
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Wed Apr 15, 2015 12:58 am
Edited the above post and fixed a typo and a missing variable. Should be working fine now.
Also noticed and didn't fix was the fact that the
idlekick(bantime) in the original code is said to be in minutes, yet by using
utimer this is actually in seconds. So you got two options: either define
idlekick(bantime) in seconds or need to add something to do the math for us to turn the minutes into seconds
utimer needs.
So for example if where to go with option A and define
idlekick(bantime) in seconds then multiply 5 by 60 to get actual seconds.
If where to go with option B then change:
Code: Select all
utimer $idlekick(bantime) [list pushmode $chan -b "*!*@$host"]
with:
Code: Select all
utimer [expr $idlekick(bantime) * 60] [list pushmode $chan -b "*!*@$host"]
Once the game is over, the king and the pawn go back in the same box.
abah
Halfop
Posts: 75 Joined: Sun Dec 01, 2013 3:04 am
Location: Indonesia
Post
by abah » Thu Apr 16, 2015 2:57 am
still not working sir
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Thu Apr 16, 2015 5:15 am
Did you copy the code again? Because I have edited my previous post and did some changes in it.
Once the game is over, the king and the pawn go back in the same box.
abah
Halfop
Posts: 75 Joined: Sun Dec 01, 2013 3:04 am
Location: Indonesia
Post
by abah » Thu Apr 16, 2015 5:31 am
caesar wrote: Did you copy the code again? Because I have edited my previous post and did some changes in it.
please check my code
Code: Select all
set idlekick(warn) "Warning! You will be kicked in 1 minute due to our anti-idle policy."
set idlekick(kick) "Sorry no idle please - This channel has an anti-idle policy."
set idlekick(maxidle) 15
set idlekick(bantime) 5
set idlekick(nicks) {
abah
izzah
adinda
ameliyah
dinda
fakhrunnisa
musmed
yuli
geulis
lulu
nia
rina
susi
jundi
juli
nurafifah
vina
lidya
}
set idlekick(hosts) {
*.ukhuwah.net
}
bind time - * idlekick:tick
proc idlekick:tick {minute hour day month year} {
global idlekick
foreach chan [channels] {
if {![botisop $chan]} continue
set userlist [lreplace [chanlist $chan] 0 0]
foreach user [split $userlist] {
if {![onchan $user $chan] || [isop $user $chan]} continue
if {[ishalfop $user $chan] || [isvoice $user $chan]} continue
if {[lsearch -nocase $idlekick(nicks) $user] != -1} continue
set matched 0
set uhost [getchanhost $user $chan]
foreach mask $idlekick(hosts) {
if {[string match -nocase $mask $uhost]} {
set matched 1
break
}
}
if {$matched} continue
set idletime [getchanidle $user $chan]
set warntime [expr {$idlekick(maxidle) - 1}]
if {$idletime == $warntime} {
idlekick:act "warn" $chan $user
} elseif {$idletime >= $idlekick(maxidle)} {
idlekick:act "kick" $chan $user $uhost
}
}
}
}
proc idlekick:act {act chan user {uhost ""}} {
global idlekick
switch -- $act {
default {
return
}
"warn" {
putlog "ANTIIDLE: Warning $user on $chan due to idling"
puthelp "PRIVMSG $channel :$user: $idlekick(warn)"
}
"kick" {
putlog "ANTIIDLE: Banning $user on $chan due to idling"
scan $uhost {%[^!]!%[^@]@%s} nick user host
pushmode $chan +b "*!*@$host"
putkick $chan $user $idlekick(kick)
utimer $idlekick(bantime) [list pushmode $chan -b "*!*@$host"]
}
"unban" {
if {![botisop $chan]} return
if {[ischanban $uhost $chan]} {
pushmode $chan -b $uhost
}
}
}
}
and you code
Code: Select all
set idlekick(warn) "Warning! You will be kicked in 1 minute due to our anti-idle policy."
set idlekick(kick) "Sorry no idle please - This channel has an anti-idle policy."
set idlekick(maxidle) 15
set idlekick(bantime) 5
set idlekick(nicks) {
abah
izzah
adinda
ameliyah
dinda
fakhrunnisa
musmed
yuli
geulis
lulu
nia
rina
susi
jundi
juli
nurafifah
vina
lidya
}
set idlekick(hosts) {
*.ukhuwah.net
}
bind time - * idlekick:tick
proc idlekick:tick {minute hour day month year} {
global idlekick
foreach chan [channels] {
if {![botisop $chan]} continue
set userlist [lreplace [chanlist $chan] 0 0]
foreach user [split $userlist] {
if {![onchan $user $chan] || [isop $user $chan]} continue
if {[ishalfop $user $chan] || [isvoice $user $chan]} continue
if {[lsearch -nocase $idlekick(nicks) $user] != -1} continue
set matched 0
set uhost [getchanhost $user $chan]
foreach mask $idlekick(hosts) {
if {[string match -nocase $mask $uhost]} {
set matched 1
break
}
}
if {$matched} continue
set idletime [getchanidle $user $chan]
set warntime [expr {$idlekick(maxidle) - 1}]
if {$idletime == $warntime} {
idlekick:act "warn" $chan $user
} elseif {$idletime >= $idlekick(maxidle)} {
idlekick:act "kick" $chan $user $uhost
}
}
}
}
proc idlekick:act {act chan user {uhost ""}} {
global idlekick
switch -- $act {
default {
return
}
"warn" {
putlog "ANTIIDLE: Warning $user on $chan due to idling"
puthelp "PRIVMSG $channel :$user: $idlekick(warn)"
}
"kick" {
putlog "ANTIIDLE: Banning $user on $chan due to idling"
scan $uhost {%[^!]!%[^@]@%s} nick user host
pushmode $chan +b "*!*@$host"
putkick $chan $user $idlekick(kick)
utimer $idlekick(bantime) [list pushmode $chan -b "*!*@$host"]
}
"unban" {
if {![botisop $chan]} return
if {[ischanban $uhost $chan]} {
pushmode $chan -b $uhost
}
}
}
}
}