about summary refs log tree commit diff
path: root/mcom
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2018-03-10 22:28:41 +0100
committerLeah Neukirchen <leah@vuxu.org>2018-03-10 22:28:41 +0100
commit64da4ff0fa4ad00c6330732394251c88d2fd90ce (patch)
tree5f01d3535d4f25f7cd4abe453ebdf28eba816786 /mcom
parentd1a12457421dc9b08c57431d08ffa150763a3f76 (diff)
downloadmblaze-64da4ff0fa4ad00c6330732394251c88d2fd90ce.tar.gz
mblaze-64da4ff0fa4ad00c6330732394251c88d2fd90ce.tar.xz
mblaze-64da4ff0fa4ad00c6330732394251c88d2fd90ce.zip
mcom: add -body to prepopulate drafts
Diffstat (limited to 'mcom')
-rwxr-xr-xmcom19
1 files changed, 15 insertions, 4 deletions
diff --git a/mcom b/mcom
index eb965b3..4f8f4f6 100755
--- a/mcom
+++ b/mcom
@@ -211,12 +211,17 @@ fi
 			printf '%s' "$hdrs" | mhdr -M -h bcc /dev/stdin |
 				commajoin | sed 's/^/Bcc: /'
 			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'
 		msgid
 		museragent
 		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*)
 		{
@@ -277,8 +282,9 @@ fi
 			printf 'Cc: %s\n' \
 			       "$(mhdr -d -A -h to:cc: "$1" |notmine |commajoin)"
 			printf 'Bcc: \n'
-			printf '%s\n' "$hdrs" | awk '/./ { print }'
-		fi
+			printf '%s\n' "$hdrs" | awk '{ print }' |
+				msed "/body/d" /dev/stdin
+		fi | sed '/^$/d'
 		printf 'Subject: Re: %s\n' "$(COLUMNS=10000 mscan -f '%S' "$1")"
 		from=$(mhdr -h local-mailbox "$MBLAZE/profile")
 		[ "$from" ] && printf 'From: %s\n' "$from"
@@ -298,6 +304,11 @@ fi
 
 		mquote "$1"
 		printf '\n'
+		(
+			IFS=$NL
+			cat -- /dev/null $(printf '%s' "$hdrs" | mhdr -M -h body /dev/stdin)
+		)
+		printf '\n'
 		;;
 	esac