#	$eterna: kpstat,v 1.2 2001/08/12 15:57:11 mrg Exp $
#
# This one by Snoopy (hellmond@phoenix.princeton.edu)
#
# Due to the annoying feature [bug] of frequent ServerKills, I updated the
# nkpath script to put serverkills into the status_user variable and to
# display only operkills.
# 
# -- Peter

# No Kill Path Script
# ===================
# Original script from YeggMan
# Version for servers 2.7.1* by Nap
# modified for displaying Serverkills in Status_Line by snoopy
# This version works both with old and new 2.7.1e kill formats !
# conversion to 2.2.1 by phone

assign _kpath <empty>
alias kpath echo !LASTKILL! Last received KILL Path: $_kpath

alias _ridx ^assign function_return $RINDEX(! $0)
alias _is_serv ^assign function_return $INDEX(. $MID($_ridx($0) 512 $0))
alias _opkill xecho -level OPNOTES OPERKILL: by $MID($_ridx($1) 9 $1) for $0 $2-
alias _svkill ^set status_user SERVERKILL: $0 ($1)

alias _napEserv {
        ^assign _kpath $12-
        if ( _is_serv($12) > -1 )
	{
		_svkill $8 $10
	}
	{
		_opkill $8 $10 $13-
	}
}

alias _napDserv {
        ^assign _kpath $10-
        if ( _is_serv($10) >- 1)
	{
		_svkill $8 $10
	}
	{
		_opkill $8 $10 $11-
	}
}

on ^server_notice "% * Notice -- Received KILL*" {
	echo $0-
        if ([$9] == [From])
	{
		_napEserv $0-
	}
	{
		_napDserv $0-
	}
}
