about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2019-01-29 13:07:50 +0100
committerLeah Neukirchen <leah@vuxu.org>2019-01-29 13:10:25 +0100
commita6f48fe3717664fa0b58f0ca27f64c6c244b51be (patch)
tree6da9b4580ad42547476ebc8a8ba1bdebec27dc81
parent6b3cca21fb237297c92552e6bd77f69cb7ffe3eb (diff)
downloadmblaze-a6f48fe3717664fa0b58f0ca27f64c6c244b51be.tar.gz
mblaze-a6f48fe3717664fa0b58f0ca27f64c6c244b51be.tar.xz
mblaze-a6f48fe3717664fa0b58f0ca27f64c6c244b51be.zip
mcom: add -send
-rw-r--r--man/mcom.18
-rwxr-xr-xmcom26
2 files changed, 32 insertions, 2 deletions
diff --git a/man/mcom.1 b/man/mcom.1
index 4d4c81b..ed2e675 100644
--- a/man/mcom.1
+++ b/man/mcom.1
@@ -1,4 +1,4 @@
-.Dd January 6, 2017
+.Dd January 29, 2019
 .Dt MCOM 1
 .Os
 .Sh NAME
@@ -97,6 +97,12 @@ when you want to use this feature together with
 .Nm mfwd ,
 or
 .Nm mbnc .
+.Pp
+If the flag
+.Fl send
+is passed,
+the message will be sent directly using the data on
+the command line, and no editor or edit loop will be run.
 .Sh MENU COMMANDS
 .Bl -tag -width 2n
 .It Ic s
diff --git a/mcom b/mcom
index dba0983..69bf1ee 100755
--- a/mcom
+++ b/mcom
@@ -74,6 +74,8 @@ sendmail_args=$(mhdr -h sendmail-args "$MBLAZE/profile")
 sendmail="${sendmail:-sendmail} ${sendmail_args:--t}"
 default_from=$(mhdr -h local-mailbox "$MBLAZE/profile")
 
+defaultc=e
+
 hdrs=
 resume=
 noquote=
@@ -104,6 +106,9 @@ case "$0" in
 				shift
 			fi
 			;;
+		-send)
+			defaultc=justsend
+			shift;;
 		-??*)
 			hdr=${1#-}
 			shift;;
@@ -127,6 +132,9 @@ case "$0" in
 		-r)
 			shift
 			raw=1;;
+		-send)
+			defaultc=justsend
+			shift;;
 		-??*)
 			hdr=${1#-}
 			shift;;
@@ -148,6 +156,9 @@ case "$0" in
 		--)
 			shift
 			break;;
+		-send)
+			defaultc=justsend
+			shift;;
 		-??*)
 			hdr=${1#-}
 			shift;;
@@ -169,6 +180,9 @@ case "$0" in
 		--)
 			shift
 			break;;
+		-send)
+			defaultc=justsend
+			shift;;
 		-noquote)
 			noquote=1
 			shift;;
@@ -349,7 +363,7 @@ fi
 } >$draft
 
 automime=
-c=e
+c=$defaultc
 while :; do
 	case "$c" in
 	s|send)
@@ -436,6 +450,16 @@ while :; do
 			do_mime
 		fi
 		;;
+	justsend)
+		stripempty $draft
+		if mmime -c <$draft && ! needs_multipart $draft; then
+			automime=
+		else
+			automime=1
+			do_mime
+		fi
+		c=send
+		;;
 	d|delete)
 		rm -i $draft
 		if ! [ -f $draft ]; then