rohrpost

A commandline mail client to change the world as we see it.
git clone git://r-36.net/rohrpost
Log | Files | Refs | README | LICENSE

rpfwd (562B)


      1 #!/bin/sh
      2 
      3 BASE="$(rppath -b)"
      4 
      5 usage() {
      6 	printf "usage. %s [-h] msgids\n" "$(basename $1)" 2>&1
      7 	exit 1
      8 }
      9 
     10 if [ "$1" = "--" ];
     11 then
     12 	shift 1
     13 fi
     14 
     15 ids="$@"
     16 if [ -z "$ids" ];
     17 then
     18 	usage $0
     19 fi
     20 
     21 if [ ! -x $BASE/tmpl/fwd.sh ];
     22 then
     23 	echo "$BASE/tmpl/fwd.sh does not exist. Will" \
     24 	       "not proceed."
     25 	exit 1
     26 fi
     27 
     28 tmpfile=$(mktemp)
     29 signalh() {
     30 	rm -f $tmpfile
     31 }
     32 trap 'signalh' 3 6 9 15 
     33 
     34 dfolder=$(rpcfg -v fold_drafts)
     35 
     36 $BASE/tmpl/fwd.sh -- "$ids" > $tmpfile
     37 mid=$(rpadd -m $dfolder -f seen $tmpfile)
     38 signalh
     39 
     40 if [ $? -eq 0 ];
     41 then
     42 	rpedit -m $dfolder $mid 
     43 fi
     44