about summary refs log tree commit diff
path: root/mcom
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2018-01-06 19:17:49 +0100
committerLeah Neukirchen <leah@vuxu.org>2018-01-06 19:17:49 +0100
commit88a87a361a5eb8675fbe8f9628c9b230c40dba3e (patch)
treee5e3e978a548c226ae8a8c922f9d3b710450b01f /mcom
parenta6243d7a2f799bc988cc69b14b235db04f7617e9 (diff)
downloadmblaze-88a87a361a5eb8675fbe8f9628c9b230c40dba3e.tar.gz
mblaze-88a87a361a5eb8675fbe8f9628c9b230c40dba3e.tar.xz
mblaze-88a87a361a5eb8675fbe8f9628c9b230c40dba3e.zip
add mbnc to bounce messages
Diffstat (limited to 'mcom')
-rwxr-xr-xmcom38
1 files changed, 29 insertions, 9 deletions
diff --git a/mcom b/mcom
index fb7ec8d..0603cee 100755
--- a/mcom
+++ b/mcom
@@ -143,6 +143,14 @@ fi
 			done
 		) fi
 		;;
+	*mbnc*)
+		printf '%s: \n' Resent-To
+		from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+		[ "$from" ] && printf 'Resent-From: %s\n' "$from"
+		msgid | sed 's/^/Resent-/'
+		printf 'Resent-Date: %s\n' "$(mdate)"
+		mseq "${@:-.}" | xargs -d'\n' cat
+		;;
 	*mrep*)
 		[ "$#" -eq 0 ] && set -- .
 		ng=$(mhdr -h newsgroups "$1")
@@ -178,16 +186,20 @@ fi
 		;;
 	esac
 
-	if [ -f "$MBLAZE/signature" ]; then
-		SIGNATURE="$MBLAZE/signature"
-	elif [ -f ~/.signature ]; then
-		SIGNATURE="$HOME/.signature"
-	fi
+	case "$0" in
+	*mbnc*) ;;
+	*)
+		if [ -f "$MBLAZE/signature" ]; then
+			SIGNATURE="$MBLAZE/signature"
+		elif [ -f ~/.signature ]; then
+			SIGNATURE="$HOME/.signature"
+		fi
 
-	if [ -n "$SIGNATURE" ]; then
-		printf '%s\n' '-- '
-		cat "$SIGNATURE"
-	fi
+		if [ -n "$SIGNATURE" ]; then
+			printf '%s\n' '-- '
+			cat "$SIGNATURE"
+		fi
+	esac
 } >$draft
 
 automime=
@@ -200,6 +212,14 @@ while :; do
 			*.*) sendmail="mblow";;
 		esac
 
+		resent="$(maddr -h resent-to "$draft")"
+		case "$resent" in
+		?*)
+			sendmail=$(mhdr -h sendmail "$MBLAZE/profile")
+			sendmail="${sendmail:-sendmail} -- $resent"
+			;;
+		esac
+
 		if [ -e $draftmime ]; then
 			if [ $draft -ot $draftmime ] || [ "$automime" -eq 1 ]; then
 				stampdate $draftmime