--- mblaze-1.2/mcom 2021-12-12 11:39:30.000000000 -0500 +++ mblaze-1.2f/mcom 2022-05-12 08:54:57.169177959 -0400 @@ -12,13 +12,13 @@ commajoin() { notmine() { mine="$(maddr -a -h local-mailbox:alternate-mailboxes: "$MBLAZE/profile")" - grep -Fv -e "$mine" + grep -Fvi -e "$mine" } replyfrom() { addrs="$(maddr -a -h reply-from: "$MBLAZE/profile")" [ -z "$addrs" ] && addrs="$(maddr -a -h alternate-mailboxes: "$MBLAZE/profile")" - grep -F -e "$addrs" + grep -Fi -e "$addrs" } ouniq() { @@ -133,6 +133,19 @@ case "$0" in "$draft" 1>&2 exit 1 fi + outbox=$(mhdr -h outbox "$MBLAZE/profile" | sed "s:^~/:$HOME/:") + anyout=$(basename $outbox) + if [ -n "$(dirname "$draft" | grep "$anyout/cur$")" ]; then + newdraft=$(true | mdeliver -v -c -XD "$outbox") + if [ -z "$newdraft" ]; then + printf '%s\n' "$0: failed to load draft for editing." 1>&2 + exit 1 + fi + sed "s/^\(Message-Id: \).*/\1$(mgenmid 2>/dev/null)/" $draft \ + > $newdraft + sed -i "s/^\(Date: \).*/\1$(mdate)/" $newdraft + draft=$newdraft + fi echo "using draft $draft" shift fi @@ -358,8 +370,8 @@ fi [ -z "$to" ] && to=$(mhdr -d -A -h from "$1") printf 'To: %s\n' "$to" printf 'Cc: %s\n' \ - "$(mhdr -d -A -h to:cc: "$1" | - notmine |grep -Fv -e "$to" | + "$(maddr -a -h to:cc: "$1" | + notmine |grep -Fvi -e "$to" | ouniq |commajoin)" printf 'Bcc: \n' printf '%s\n' "$hdrs" | awk '{ print }' |