Update Chanban/chanban.tcl

Some more protections
This commit is contained in:
Teh PeGaSuS
2026-03-02 00:08:30 +01:00
parent ae8854cbc8
commit 81fafac891
+40 -7
View File
@@ -44,6 +44,11 @@ namespace eval cmgmt {
# 9 nick!*@*.host
variable banMask "2"
# Masks to protect from bans
variable protectMasks {
"*!*@services.ptirc.org"
}
# Mask type to use to track hostmasks that should not trigger auto adding bans
# Same type as banMask
variable noAddType "1"
@@ -114,7 +119,7 @@ namespace eval cmgmt {
return 0
}
if {$nick ne "$::botnick" && $nick ni $::cmgmt::noAddNicks && $hostmask ni $::cmgmt::noAddMasks} {
if {$nick ne "$::botnick" && $nick ni $::cmgmt::noAddNicks && $hostmask ni $::cmgmt::noAddMasks && $hostmask ni $::cmgmt::protectMasks} {
# We also need to deal with the addition of extbans, since we don't deal with them internally
if {[matchstr "~*" $target] && ![isban $target $chan]} {
newchanban $chan $target $nick EXTBAN 0 sticky
@@ -193,12 +198,19 @@ namespace eval cmgmt {
}
if {[isop $target $chan] || [matchattr [nick2hand $target] o|o $chan]} {
putserv "NOTICE $nick :You can't use this command on $target."
putserv "NOTICE $nick :You can't use this command on the nick $target."
return 0
}
set bhost [string trim [getchanhost $target $chan] ~]
foreach pmask $::cmgmt::protectMasks {
if {[matchstr $pmask "${target}!$bhost"]} {
putserv "NOTICE $nick :You can't use this command on the nick $target."
return 0
}
}
if {[matchstr "uid*" $bhost] || [matchstr "sid*" $bhost]} {
set banmask *!*$bhost
} else {
@@ -237,12 +249,19 @@ namespace eval cmgmt {
}
if {[isop $target $chan] || [matchattr [nick2hand $target] o|o $chan]} {
putserv "NOTICE $nick :You can't use this command on $target."
putserv "NOTICE $nick :You can't use this command on the nick $target."
return 0
}
set bhost [string trim [getchanhost $target $chan] ~]
foreach pmask $::cmgmt::protectMasks {
if {[matchstr $pmask "${target}!$bhost"]} {
putserv "NOTICE $nick :You can't use this command on the nick $target."
return 0
}
}
if {[matchstr "uid*" $bhost] || [matchstr "sid*" $bhost]} {
set banmask *!*$bhost
} else {
@@ -281,7 +300,7 @@ namespace eval cmgmt {
}
if {[isop $target $chan] || [matchattr [nick2hand $target] o|o $chan]} {
putserv "NOTICE $nick :You can't use this command on $target."
putserv "NOTICE $nick :You can't use this command on the nick $target."
return 0
}
@@ -471,12 +490,19 @@ namespace eval cmgmt {
}
if {[isop $target $chan] || [matchattr [nick2hand $target] o|o $chan]} {
putserv "PRIVMSG $nick :You can't use this command on $target."
putserv "PRIVMSG $nick :You can't use this command on the nick $target."
return 0
}
set bhost [string trim [getchanhost $target $chan] ~]
foreach pmask $::cmgmt::protectMasks {
if {[matchstr $pmask "${target}!$bhost"]} {
putserv "PRIVMSG $nick :You can't use this command on the nick $target."
return 0
}
}
if {[matchstr "uid*" $bhost] || [matchstr "sid*" $bhost]} {
set banmask *!*$bhost
} else {
@@ -527,12 +553,19 @@ namespace eval cmgmt {
}
if {[isop $target $chan] || [matchattr [nick2hand $target] o|o $chan]} {
putserv "PRIVMSG $nick :You can't use this command on $target."
putserv "PRIVMSG $nick :You can't use this command on the nick $target."
return 0
}
set bhost [string trim [getchanhost $target $chan] ~]
foreach pmask $::cmgmt::protectMasks {
if {[matchstr $pmask "${target}!$bhost"]} {
putserv "PRIVMSG $nick :You can't use this command on the nick $target."
return 0
}
}
if {[matchstr "uid*" $bhost] || [matchstr "sid*" $bhost]} {
set banmask *!*$bhost
} else {
@@ -583,7 +616,7 @@ namespace eval cmgmt {
}
if {[isop $target $chan] || [matchattr [nick2hand $target] o|o $chan]} {
putserv "PRIVMSG $nick :You can't use this command on $target."
putserv "PRIVMSG $nick :You can't use this command on the nick $target."
return 0
}
putkick $chan $target $::cmgmt::kickReason