about summary refs log tree commit diff
path: root/mcom
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-06-18 17:48:24 +0200
committerLeah Neukirchen <leah@vuxu.org>2017-06-18 17:48:24 +0200
commit2939be9f34b400fa59cb12c59c2c101c852fea92 (patch)
tree6ba7822a45584666ae967ffe9c070af667576bdf /mcom
parent01ad9ec927a6ec1b4acbce2a7e3b48135fa794e4 (diff)
downloadmblaze-2939be9f34b400fa59cb12c59c2c101c852fea92.tar.gz
mblaze-2939be9f34b400fa59cb12c59c2c101c852fea92.tar.xz
mblaze-2939be9f34b400fa59cb12c59c2c101c852fea92.zip
mcom: add mfwd command to forward messages
Diffstat (limited to 'mcom')
-rwxr-xr-xmcom30
1 files changed, 30 insertions, 0 deletions
diff --git a/mcom b/mcom
index 07f25f8..9fea4c6 100755
--- a/mcom
+++ b/mcom
@@ -67,6 +67,35 @@ fi
 		msgdate
 		printf '\n\n'
 		;;
+	*mfwd*)
+		raw=
+		[ "$1" = -r ] && raw=1 && shift
+		[ "$#" -eq 0 ] && set -- .
+		printf '%s: \n' To Cc Bcc
+		mscan -f 'Subject: [%f] %s' "$@" | sed 1q
+		from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+		[ "$from" ] && printf 'From: %s\n' "$from"
+		cat "$MBLAZE/headers" 2>/dev/null
+		msgid
+		museragent
+		msgdate
+		printf '\n\n'
+		if [ -n "$raw" ]; then
+			mseq -r "$@" | sed 's:^:#message/rfc822 :'
+		else (
+			SEP=-----
+			IFS='
+'
+			for f in $(mseq -r "$@"); do
+				printf '%s Forwarded message from %s %s\n\n' \
+				       $SEP "$(mhdr -d -h from "$f")" $SEP
+				DISPLAY= mshow -n -N "$f" </dev/null |
+					sed 's/^-/- &/'    # RFC934
+				printf '\n%s %s %s\n\n' \
+				       $SEP 'End forwarded message' $SEP
+			done
+		) fi
+		;;
 	*mrep*)
 		[ "$#" -eq 0 ] && set -- .
 		ng=$(mhdr -h newsgroups "$1")
@@ -100,6 +129,7 @@ fi
 
 		mquote "$1"
 		printf '\n'
+		;;
 	esac
 
 	if [ -f "$MBLAZE/signature" ]; then