#! /bin/sh
# fixscript will replace this line with code to load innshellvars

##  $Revision: 1.11 $
##  Senduuname control-message handler

PROG=senduuname
##  Some shells don't pass in $* unless we explicitly pass it in here.
. ${PATHBIN}/parsecontrol "$@"

SUBJECT="Senduuname reply from `innconfval pathhost`"
case ${ACTION} in
mail)
    export FROM MAILCMD SUBJECT ARTICLE
    (
	echo "${FROM} posted a senduuname."
	echo 'To reply, do the following:'
	echo "	uuname | ${MAILCMD} -s \"${SUBJECT}\" ${FROM}"
	echo 'The full article was:'
	${SM} ${ARTICLE}
    ) | sed -e 's/^~/~~/' | ${MAILCMD} -s "senduuname by ${FROM}" ${NEWSMASTER}
    ;;
logit)
    ${SM} ${ARTICLE} | ${WRITELOG} ${LOGFILE} "senduuname by ${FROM}; reply skipped"
    ;;
doit)
    uuname | ${MAILCMD} -s "${SUBJECT}" ${REPLYTO}
    ${SM} ${ARTICLE} | ${WRITELOG} ${LOGFILE} "senduuname by ${FROM}; reply sent"
    ;;
esac

exit
