about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2018-08-13 13:18:22 +0200
committerLeah Neukirchen <leah@vuxu.org>2018-08-13 13:18:22 +0200
commiteca1ff8087ef1f7b81c8811b6becc5bc5fabbd0a (patch)
tree18118b5b38b5bd3089800d4b009a644087f1e344
parentebaf9e2df23775eff5d594c94d0f04b933530ff7 (diff)
downloadmblaze-eca1ff8087ef1f7b81c8811b6becc5bc5fabbd0a.tar.gz
mblaze-eca1ff8087ef1f7b81c8811b6becc5bc5fabbd0a.tar.xz
mblaze-eca1ff8087ef1f7b81c8811b6becc5bc5fabbd0a.zip
mrep: don't put To: into Cc:, don't duplicate addresses in Cc:
-rwxr-xr-xmcom8
1 files changed, 7 insertions, 1 deletions
diff --git a/mcom b/mcom
index c66abea..db841c7 100755
--- a/mcom
+++ b/mcom
@@ -15,6 +15,10 @@ notmine() {
 	grep -Fv -e "$mine"
 }
 
+ouniq() {
+	awk '!seen[$0]++' 
+}
+
 reffmt() {
 	sed 's/^[^<]*//g;s/[^>]*$//g;s/>[^<]*</>\
 </g' | uniq | sed 's/^/ /'
@@ -280,7 +284,9 @@ fi
 			[ -z "$to" ] && to=$(mhdr -h from "$1")
 			printf 'To: %s\n' "$to"
 			printf 'Cc: %s\n' \
-			       "$(mhdr -d -A -h to:cc: "$1" |notmine |commajoin)"
+			       "$(mhdr -d -A -h to:cc: "$1" |
+			       	       notmine |grep -Fv -e "$to" |
+				       ouniq |commajoin)"
 			printf 'Bcc: \n'
 			printf '%s\n' "$hdrs" | awk '{ print }' |
 				msed "/body/d" /dev/stdin