diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2016-07-28 13:23:36 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2016-07-28 13:23:36 +0200 |
commit | a53b3b9165a811347f51fef640108aedcc0db5f3 (patch) | |
tree | 05cd9942158bb0819c6bf55e73eb4d56fb8d21af /mcomp | |
parent | ad6cec9e16bf41de2798a0d48ae4d08d019235c9 (diff) | |
download | mblaze-a53b3b9165a811347f51fef640108aedcc0db5f3.tar.gz mblaze-a53b3b9165a811347f51fef640108aedcc0db5f3.tar.xz mblaze-a53b3b9165a811347f51fef640108aedcc0db5f3.zip |
mrepl: reply-all by default, respect reply-to
Diffstat (limited to 'mcomp')
-rwxr-xr-x | mcomp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/mcomp b/mcomp index 66980f4..b9cb20b 100755 --- a/mcomp +++ b/mcomp @@ -1,6 +1,14 @@ #!/bin/sh # mcomp [TO] - compose mail +commajoin() { + sed ':a;N;s/\n/, /;$!b a' +} + +reffmt() { + sed 's/^[^<]*//g;s/[^>]*$//g;s/>[^<]*</>\n</g' | uniq | sed 's/^/ /' +} + i=0 while [ -f "snd.$i" ]; do i=$((i+1)) @@ -27,9 +35,10 @@ draft="snd.$i" ;; *mrepl*) [ "$#" -eq 0 ] && set -- . - # XXX reply-all - echo "To: $(mhdr -h from "$1")" - echo "Cc: " + to=$(mhdr -h reply-to "$1") + [ -z "$to" ] && to=$(mhdr -h from "$1") + echo "To: $to" + echo "Cc: $(mhdr -d -A -h to:cc: "$1" | commajoin)" echo "Bcc: " s=$(mhdr -d -h subject "$1") os= @@ -46,8 +55,7 @@ draft="snd.$i" { mhdr -h references "$1" mhdr -h message-id "$1" - } | sed 's/^[^<]*//g;s/[^>]*$//g;s/>[^<]*</>\n</g' | - uniq | sed 's/^/ /' + } | reffmt echo "In-Reply-To: $(mhdr -h message-id "$1")" echo |