#!/bin/csh -f

# This script moves mail messages into the central tkWWW bug repository
set name = `scan cur -format "%(friendly{from})"`
set rootdir = /afs/athena.mit.edu/course/other/cdsdev
cd $rootdir/scripts

clear 
echo "*** UU-NNA Mail Handler ***"
echo -n "Look at letter (y/n)? "

if ($< =~ [Yy]*) then
   show
endif

echo ""
echo "Reply options "
echo "1) File and send automated thank you letter"
echo "2) File and send personal response"
echo "3) File and do nothing"
echo "4) Do nothing"
echo -n "Please select an option "

switch ($<) 
   case 1:
      echo "Filing letter in uu-nna ..."
      refile +$rootdir/mail-archive/uu-nna 	
      echo "Sending thank you ..."
      cat uu.form.letter | mhmail $name -subject "UU-NNA"
      echo "done"
      breaksw
   case 2:
      echo "Filing letter in uu-nna ..."
      refile +$rootdir/mail-archive/uu-nna
      folder -push +$rootdir/mail-archive/uu-nna
      echo "Generating reply"
      repl -annotate -filter $cwd/bug.filter -fcc +$rootdir/mail-archive/uu-nna last
      folder -pop
      breaksw
   case 3:
      echo "Filing letter in uu-nna ..."
      refile +$rootdir/mail-archive/uu-nna 		
   default:
      echo "No reply sent"
endsw
endif

