#!/bin/sh TMP_DIR=${TMPDIR:-/tmp} tmp=$TMP_DIR/moderate.$$.d if mkdir -p $tmp ; then true else echo "FATAL: cannot mkdir $tmp" 1>&2 cat # ensure we don't lose the message! exit 2 fi cat > $tmp/msg head -1 $tmp/msg > $tmp/head1 usehead1=0 if egrep '^From ' $tmp/head1 > /dev/null 2>&1 ; then tail +2 $tmp/msg > $tmp/foot1 usehead1=1 else ln -s msg $tmp/foot1 rm $tmp/head1 usehead1=0 fi touch $tmp/modheaders if moderate-list -auto -file $tmp/msg > $tmp/log 2>&1 ; then echo "X-Moderate-List-Performed: yes" > $tmp/modheaders estatus=0 else echo "X-Moderate-List-Performed: no" > $tmp/modheaders estatus=1 fi [ $usehead1 ] && cat $tmp/head1 cat $tmp/modheaders $tmp/foot1 echo "------------------------ AUTOMODERATION RESULTS: (todo: mime)" cat $tmp/log rm -rf $tmp exit $estatus