3 0e30865e 2022-08-10 op mquote - format MSG as a quotation.
5 0e30865e 2022-08-10 op This is a tweaked copy of mquote from mblaze that adds the date of the
6 0e30865e 2022-08-10 op original message.
10 0e30865e 2022-08-10 op Extract the sender
12 0e30865e 2022-08-10 op : ${from:=$(mhdr -d -h x-original-from "$1")}
13 0e30865e 2022-08-10 op : ${from:=$(mhdr -d -h from "$1")}
14 0e30865e 2022-08-10 op : ${from:=Someone}
18 0e30865e 2022-08-10 op pfmt="%a, %d %b %Y %H:%M:%S %z"
19 0e30865e 2022-08-10 op : ${date:=$(mhdr -d -h date "$1")}
20 0e30865e 2022-08-10 op date="${date:+$(dateconv -f "$pfmt" "$date")}"
22 0e30865e 2022-08-10 op printf '%s%s wrote:\n' "${date:+On $date, }" "$from"
24 0e30865e 2022-08-10 op Then strip the signature, empty lines and prefix everything with ">"
26 0e30865e 2022-08-10 op { mshow -R "$1" || mshow -h '' -N "$1"; } |
27 0e30865e 2022-08-10 op sed -n '/^-- $/,$!p' |
28 0e30865e 2022-08-10 op sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' |