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

##  $Revision: 1.16 $
##  Version control-message handler

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

WHERE=`innconfval pathhost`

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

exit
