diff --git a/Chanban/chanban.tcl b/Chanban/chanban.tcl index de090c4..e778b3e 100644 --- a/Chanban/chanban.tcl +++ b/Chanban/chanban.tcl @@ -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