Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- proc delop_pub {nick uhost hand chan text} {
- global globflags chanflags
- if {![matchattr $hand $globflags]} {
- putserv "PRIVMSG $chan :Error! You don't have access to this script ${nick}!"
- return
- }
- set target [lindex [split $text] 0]
- set handle [nick2hand $target]
- if {![validuser $handle]} {
- putserv "PRIVMSG $chan :Error! $target doesn't exist in my database"
- return
- }
- set hasop [matchattr $handle |$chanflags $chan]
- if {$hasop} {
- # removed the chan flag from the user in the specified chan
- chattr $handle |-$chanflags $chan
- putlog "$target (handle: $handle) lost his +$chanflag in $chan"
- } else {
- putserv "PRIVMSG $chan :Error! $target is not OP on $chan"
- return
- }
- set hasmaster [matchattr $handle $globflags]
- if {!$hasmaster} {
- # deletes the user if he has no global flags and no other chan flags in other channel
- set hasanyop 0
- foreach other [channels] {
- if {[string equal -nocase $chan $other]} {
- continue
- }
- if {[matchattr $handle |$chanflags $other]} {
- set hasanyop 1
- break
- }
- }
- if {!$hasanyop} {
- deluser $target
- putlog "$target was successfully deleted from my user database"
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement