mcom: add -body to prepopulate drafts

pull/117/head
Leah Neukirchen 6 years ago
parent d1a1245742
commit 64da4ff0fa

@ -69,6 +69,15 @@ to prefill header fields,
e.g. you can use e.g. you can use
.Sq Nm mcom Fl to No merrilyn Fl cc No elea becci Fl subject No 'Party invite' .Sq Nm mcom Fl to No merrilyn Fl cc No elea becci Fl subject No 'Party invite'
to create a draft with the To, Cc and Subject fields already set. to create a draft with the To, Cc and Subject fields already set.
The flag
.Fl body Ar file
can be used to prepopulate the draft for
.Nm mcom
and
.Nm mrep
with the contents of
.Ar file .
.Pp
Note that these flags apply to Note that these flags apply to
.Em all .Em all
arguments after them arguments after them

19
mcom

@ -211,12 +211,17 @@ fi
printf '%s' "$hdrs" | mhdr -M -h bcc /dev/stdin | printf '%s' "$hdrs" | mhdr -M -h bcc /dev/stdin |
commajoin | sed 's/^/Bcc: /' commajoin | sed 's/^/Bcc: /'
printf '%s\n' "$hdrs" | awk '{ print }' | printf '%s\n' "$hdrs" | awk '{ print }' |
msed "/to/d; /cc/d; /bcc/d" /dev/stdin msed "/to/d; /cc/d; /bcc/d; /body/d" /dev/stdin
} | msed "/cc/a//; /bcc/a//; /subject/a//; /from/a/$default_from/" /dev/stdin | sed '/^$/d' } | msed "/cc/a//; /bcc/a//; /subject/a//; /from/a/$default_from/" /dev/stdin | sed '/^$/d'
msgid msgid
museragent museragent
cat "$MBLAZE/headers" 2>/dev/null cat "$MBLAZE/headers" 2>/dev/null
printf '\n\n' printf '\n'
(
IFS=$NL
cat -- /dev/null $(printf '%s' "$hdrs" | mhdr -M -h body /dev/stdin)
)
printf '\n'
;; ;;
*mfwd*) *mfwd*)
{ {
@ -277,8 +282,9 @@ fi
printf 'Cc: %s\n' \ printf 'Cc: %s\n' \
"$(mhdr -d -A -h to:cc: "$1" |notmine |commajoin)" "$(mhdr -d -A -h to:cc: "$1" |notmine |commajoin)"
printf 'Bcc: \n' printf 'Bcc: \n'
printf '%s\n' "$hdrs" | awk '/./ { print }' printf '%s\n' "$hdrs" | awk '{ print }' |
fi msed "/body/d" /dev/stdin
fi | sed '/^$/d'
printf 'Subject: Re: %s\n' "$(COLUMNS=10000 mscan -f '%S' "$1")" printf 'Subject: Re: %s\n' "$(COLUMNS=10000 mscan -f '%S' "$1")"
from=$(mhdr -h local-mailbox "$MBLAZE/profile") from=$(mhdr -h local-mailbox "$MBLAZE/profile")
[ "$from" ] && printf 'From: %s\n' "$from" [ "$from" ] && printf 'From: %s\n' "$from"
@ -298,6 +304,11 @@ fi
mquote "$1" mquote "$1"
printf '\n' printf '\n'
(
IFS=$NL
cat -- /dev/null $(printf '%s' "$hdrs" | mhdr -M -h body /dev/stdin)
)
printf '\n'
;; ;;
esac esac

Loading…
Cancel
Save