proc pub:topic {hand chan args x mix} { global botnick set option [string tolower [lindex $args 0]] set args [join [lrange $args 0 end]] if {![string length $option]} { a:usage $x topic; return "FAILED: not all parameters specified" } if { [a:check -info $option]} { set option info } switch -exact -- $option { lock { if {![channel get $chan topic] } { channel set $chan +topic ::stats::channel -set $chan topicwhom "$hand" ::stats::channel -set $chan topictext "[topic $chan]" a:tell $x 54 "$chan [topic $chan]"; return "LOCK" } else { a:tell $x 55 $chan; return "FAILED TO LOCK: locked already" } } enforce { if {![botisop $chan]} { a:tell $x 96 $chan; return "FAILED: bot is not opped" } if { [::stats::channel -get $chan topictext]==""} { a:tell $x 121 $chan; return "FAILED TO ENFORCE: no topic"} else { putserv "TOPIC $chan :[::stats::channel -get $chan topictext]"; return "ENFORCE" } } unlock { if { [channel get $chan topic]} { channel set $chan -topic a:tell $x 116 $chan; return "UNLOCK"} else { a:tell $x 117 $chan; return "FAILED TO UNLOCK: not locked" } } info { if { [::stats::channel -get $chan topictext] != "" } { a:tell $x 118 "[::stats::channel -get $chan topictext]" a:tell $x 119 "[::stats::channel -get $chan topicwhom] [iif [channel get $chan topic] + -]topic [iif [channel get $chan enforcetopic] + -]enforcetopic"; return "INFO"} else { a:tell $x 120; return "FAILED TO INFO: no info" } } } if {![botisop $chan]} { a:tell $x 96 $chan; return "FAILED: bot is not opped" } if { [channel get $chan topic] } { a:tell $x 119 "[::stats::channel -get $chan topicwhom] [iif [channel get $chan topic] + -]topic [iif [channel get $chan enforcetopic] + -]enforcetopic" ::stats::channel -set $chan topicwhom $hand ::stats::channel -set $chan topictext $args } putserv "TOPIC $chan :[join $args]" return "[join $args]" }