All pastes #986277 Raw Edit

Something

public text v1 · immutable
·published 2008-04-15 17:52 UTC
rendered paste body
proc pub:chanset {hand chan args x mix} {
	
	set mode   [string tolower [lindex $args 0]]
	set opti   [lindex $args 1]

	if {([regexp {^aop-delay|flood-(chan|deop|kick|join|nick|ctcp)$} $mode] && [regexp {^\d{1,2}\:\d{1,3}$} $opti]) || ([string equal $mode stopnethack-mode] && [string match {[0-6]} $opti]) || ([string equal $mode idle-kick] && [a:check -digit $opti]) || ([string equal -nocase $mode idle-deop] && [a:check -digit $opti])  || ([string equal $mode revenge-mode] && [string match {[0-3]} $opti]) || ([regexp {^(ban|exempt|invite)-time$} $mode] && [a:check -digit $opti])} {channel set $chan $mode $opti} elseif { 
	     [string equal $mode -inactive] && [channel get $chan suspended]} {a:tell $x 127 $chan ; return "FAILED: chan suspended ($chan)"} elseif {
	     [string equal $mode +suspended] && [check:m:gl $hand]} {channel set $chan +inactive +suspended} elseif {
	     [string equal $mode -suspended] && [check:m:gl $hand]} {channel set $chan -inactive -suspended} elseif {
	     [regexp {^[+-](auto(op|voice)|bitch|cycle|revenge(bot|)|dontkickops|nodesynch|(dynamic|enforce|user)bans|inactive|protect(friends|ops)|secret|greet|seen|anti(pub|colour|bold|underline|notice|url|reverse|repeat|action)|limit|secure|voice|op|enforcetopic)$} $mode]} {channel set $chan $mode} elseif { 
     	     [regexp -- {^(rules|url|faq|fuck|news|desc|mail|slap|kiss)$} $mode]} {if { [string equal $opti none] || $opti == ""} {set opti ""; a:tell $x 136 "$chan $mode"; ::stats::channel -set $chan $mode $opti; return "$mode none"} {set opti [join [lrange $args 1 end]]; ::stats::channel -set $chan $mode $opti}} elseif {
	     [string equal $mode mode] || [string equal $mode modes] && [regexp {^[ntrimlkprs+-]+$} $opti]} {channel set $chan chanmode $opti} elseif {	
	     [string match {[-+]locked} $mode] && [check:N:gl $hand] } {channel set $chan $mode } else {a:help $x chanset ; return "FAILED: wrong options ($mode $opti)"}

	a:tell $x 126 "$chan $mode $opti"
	return "$mode $opti"