mcom: add Date: header before submission, or when cancelling a draft

pull/41/head
Leah Neukirchen 7 years ago
parent 862d6b24e4
commit 2db5551a7e

19
mcom

@ -20,9 +20,16 @@ msgid() {
mgenmid 2>/dev/null | sed 's/^/Message-Id: /' mgenmid 2>/dev/null | sed 's/^/Message-Id: /'
} }
msgdate() { stampdate() {
printf 'Date: ' if ! mhdr -h date "$1" >/dev/null; then
mdate tmp=$(mktemp -t mcom.XXXXXX)
{
printf 'Date: '
mdate
cat "$1"
} >"$tmp" &&
mv "$tmp" "$1"
fi
} }
needs_multipart() { needs_multipart() {
@ -88,7 +95,6 @@ fi
cat "$MBLAZE/headers" 2>/dev/null cat "$MBLAZE/headers" 2>/dev/null
msgid msgid
museragent museragent
msgdate
printf '\n\n' printf '\n\n'
;; ;;
*mfwd*) *mfwd*)
@ -102,7 +108,6 @@ fi
cat "$MBLAZE/headers" 2>/dev/null cat "$MBLAZE/headers" 2>/dev/null
msgid msgid
museragent museragent
msgdate
printf '\n\n' printf '\n\n'
if [ -z "$raw" ]; then if [ -z "$raw" ]; then
mseq -r "$@" | sed 's:^:#message/rfc822#inline :; s:$:>:' mseq -r "$@" | sed 's:^:#message/rfc822#inline :; s:$:>:'
@ -148,7 +153,6 @@ fi
fi fi
msgid msgid
museragent museragent
msgdate
printf '\n' printf '\n'
mquote "$1" mquote "$1"
@ -179,6 +183,7 @@ while :; do
if [ -e $draftmime ]; then if [ -e $draftmime ]; then
if [ $draft -ot $draftmime ]; then if [ $draft -ot $draftmime ]; then
stampdate $draftmime
if $sendmail <$draftmime; then if $sendmail <$draftmime; then
if [ "$outbox" ]; then if [ "$outbox" ]; then
mv $draftmime $draft mv $draftmime $draft
@ -197,6 +202,7 @@ while :; do
fi fi
else else
if mmime -c <$draft; then if mmime -c <$draft; then
stampdate $draft
if $sendmail <$draft; then if $sendmail <$draft; then
if [ "$outbox" ]; then if [ "$outbox" ]; then
mflag -d $draft mflag -d $draft
@ -215,6 +221,7 @@ while :; do
fi fi
;; ;;
c|cancel) c|cancel)
stampdate $draft
printf '%s\n' "mcom: cancelled draft $draft" printf '%s\n' "mcom: cancelled draft $draft"
exit 1 exit 1
;; ;;

Loading…
Cancel
Save