Channel Protection
# ChanProt - Lamego
putlog "ChanProt by Lamego"
set tclver "1.1"
bind mode - * prot:deop
bind kick - * prot:kick
proc prot:deop {nick uhost handle channel mchange theone} {
global botnick
if {[string tolower $nick] == "chanserv"} { return 0 }
if {$nick == $theone || [matchattr $handle b] } { return 0 }
set mode [lindex $mchange 0]
if {[matchattr $handle m] && [string tolower $theone] != [string tolower $botnick] } { return 0 }
set mode [lindex $mchange 0]
if {$mode != "-o" || ![matchattr [nick2hand $theone $channel] P] } { return 0}
putlog "in deop protect"
pushmode $channel +o $theone
pushmode $channel -o $nick
putserv "PRIVMSG ChanServ :DEOP $channel $nick"
putserv "NOTICE $nick :Never DEOP a protected OPerator"
putlog "## Activated deop protection, $nick trying to deop $theone"
return 0
}
proc prot:kick {nick uhost handle channel theone arg} {
global botnick
if {$nick == $theone || [matchattr $handle b]} { return 0 }
if {[matchattr $handle m] && [string tolower $theone] != [string tolower $botnick] } { return 0 }
if {![matchattr [nick2hand $theone $channel] P] } { return 0 }
if {[matchattr handle o]} { return 0 }
pushmode $channel -o $nick
putlog "on kick protect"
putserv "PRIVMSG ChanServ :DEOP $channel $nick"
chattr [nick2hand $nick $channel] +d
putserv "NOTICE $nick :Never kick a protected OPerator"
putlog "## Activated kick protection, $nick kicked $theone"
return 0
}