use configurable program paths (formail & reformail)
[muttjump] / muttjump
index 0a45d1da18de72b3ffa688bd19a4ae5c4d434a70..3cba9b794eb392dcf64116128f9dff027e554840 100755 (executable)
--- a/muttjump
+++ b/muttjump
@@ -46,6 +46,8 @@ MAIRIX=${MAIRIX:-mairix}
 MU=${MU:-mu}
 NMZMAIL=${NMZMAIL:-nmzmail}
 SCREEN=${SCREEN:-screen}
+FORMAIL=${FORMAIL:-formail}
+REFORMAIL=${REFORMAIL:-reformail}
 
 function die () {
     echo -e >&2 "$0: $1"
@@ -70,7 +72,13 @@ if ! type -p $MUTT >/dev/null ; then
 fi
 
 # search for Message-ID in STDIN
-msgid=$(sed -n 's/^Message-ID: \(.*\)/\1/Ip' | head -n1)
+if type -p $FORMAIL >/dev/null ; then
+    msgid=$($FORMAIL -c -z -x Message-ID | head -n1)
+elif type -p $REFORMAIL >/dev/null ; then
+    msgid=$($REFORMAIL -c -x Message-ID: | head -n1)
+else
+    msgid=$(sed -n 's/^Message-ID: \(.*\)/\1/Ip' | head -n1)
+fi
 if [ -z "$msgid" ] ; then
     die "could not find Message-ID header in standard input"
 fi

Benjamin Mako Hill || Want to submit a patch?