All pastes #759940 Raw Edit

Something

public text v1 · immutable
·published 2007-11-03 17:19 UTC
rendered paste body
proc a:parser {nick uhost hand chan dir comm arg} {

	if { [check:b:gl $hand]} {return}

	set option  [lindex $arg 0]
	set chan1st $chan
      set comm [alias -check $chan $comm]
	if { [string match "#*" $option]} {set args [lrange $arg 1 end]; set chan $option} { set args $arg}
	if {![a:command -exists $comm]} {return} elseif { [a:command -inactive $comm $chan]} {return}

	global settings 
	if {$settings(flood) && ([a:flood -user $chan $hand $uhost] || [a:flood -chan $chan $dir])} {return}

	set x "[split $nick] [split $hand] [split $chan1st] $dir"

	if { [validchan $chan] } {
		if {![botonchan $chan] && ![string match {|[suU]} [a:command -level $comm]] && ![regexp -nocase -- {^(purge|comeback|templeave|xremuser|xban|xkick|stats|chaninfo|chanset|suspend|admins|list)$} $comm]} {
		      a:tell $x 21 "$chan"; putcmdlog "<<$hand>> $nick!$uhost $chan INACTIVE CHAN ($chan)"; return 
		}
        } elseif {![string equal $comm join] && ![string equal $comm verify] && ![string equal $comm stats]} {
			if { [check:v:gl $hand]} {a:tell $x 20 "$chan"} 
			return
	}

	if { [check:S:ch $hand $chan] && ![check:N:gl $hand]} { a:tell $x 149; return}

	set mix	"[split $uhost]"

	switch -glob -- [a:command -level $comm] {
		{|[us]}  {set report [catch {[a:command -proc $comm] $hand $chan $args $x $mix} execute]}
		|*       {if { [check:[string index [a:command -level $comm] 1]:ch $hand $chan] && [a:authorised $nick $uhost $hand]} { set report [catch {[a:command -proc $comm] $hand $chan $args $x $mix} execute]} {return}}
		default  {if { [check:[a:command -level $comm]:gl $hand] && [a:authorised $nick $uhost $hand]}                        { set report [catch {[a:command -proc $comm] $hand $chan $args $x $mix} execute]} {return}}
	}

	putcmdlog "<<$hand>> $nick!$uhost $chan [string toupper $comm] $execute"

	if {$report && $settings(tcl_error_warn)} {a:announce -permowner ERROR "<<$hand>> $nick!$uhost $chan $dir >>> [a:command -proc $comm] >>> $comm $args >>> $::errorInfo"}
}