From 5579e0dd84f9dcb67c989a191538346ee7ab63e2 Mon Sep 17 00:00:00 2001 From: David Levine Date: Sun, 14 Jul 2019 09:29:21 -0400 Subject: [PATCH] show and mhl now decode more addresses in header fields. Added decoding of To:, Cc:, Resent-To:, Resent-Cc:, and Resent-From: addresses to mhl.format and mhl.headers. Thanks to Conrad Hughes for suggesting it for the first two components and to Ralph for suggesting it for the Resent- components. --- Makefile.am | 1 + docs/pending-release-notes | 1 + etc/mhl.format | 7 ++++-- etc/mhl.headers | 7 ++++-- test/mhl/test-format | 49 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 61 insertions(+), 4 deletions(-) create mode 100755 test/mhl/test-format diff --git a/Makefile.am b/Makefile.am index e553295d..ffc4d65b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -96,6 +96,7 @@ TESTS = \ test/mhbuild/test-utf8-body \ test/mhfixmsg/test-mhfixmsg \ test/mhical/test-mhical \ + test/mhl/test-format \ test/mhl/test-mhl-flags \ test/mhl/test-rfc6532 \ test/mhlist/test-ext-params \ diff --git a/docs/pending-release-notes b/docs/pending-release-notes index 5ee7d81e..361b1656 100644 --- a/docs/pending-release-notes +++ b/docs/pending-release-notes @@ -13,6 +13,7 @@ NEW FEATURES - A new mh-format function %(ordinal) has been implemented to output the appropriate ordinal suffix for numbers. Example: "%(num 22)%(ordinal)" will output "22nd". +- show and mhl now decode more addresses in header fields. ----------------- OBSOLETE FEATURES diff --git a/etc/mhl.format b/etc/mhl.format index 289f0b8f..c75da10b 100644 --- a/etc/mhl.format +++ b/etc/mhl.format @@ -6,9 +6,12 @@ overflowtext="***",overflowoffset=5 leftadjust,compwidth=9 ignores=msgid,message-id,received,content-type,content-transfer-encoding,content-id +Resent-To:formatfield="%(unquote(decode{text}))" +Resent-cc:formatfield="%(unquote(decode{text}))" +Resent-From:formatfield="%(unquote(decode{text}))" Date:formatfield="%<(nodate{text})%{text}%|%(pretty{text})%>" -To: -cc: +To:formatfield="%(unquote(decode{text}))" +cc:formatfield="%(unquote(decode{text}))" From:formatfield="%(unquote(decode{text}))" Subject:decode : diff --git a/etc/mhl.headers b/etc/mhl.headers index 27a08d71..e82648f3 100644 --- a/etc/mhl.headers +++ b/etc/mhl.headers @@ -7,9 +7,12 @@ overflowtext="***",overflowoffset=5 leftadjust,compwidth=9 ignores=msgid,message-id,received,content-type,content-transfer-encoding,content-id +Resent-To:formatfield="%(unquote(decode{text}))" +Resent-cc:formatfield="%(unquote(decode{text}))" +Resent-From:formatfield="%(unquote(decode{text}))" Date:formatfield="%<(nodate{text})%{text}%|%(pretty{text})%>" -To: -cc: +To:formatfield="%(unquote(decode{text}))" +cc:formatfield="%(unquote(decode{text}))" From:formatfield="%(unquote(decode{text}))" Subject:decode : diff --git a/test/mhl/test-format b/test/mhl/test-format new file mode 100755 index 00000000..38daf7f9 --- /dev/null +++ b/test/mhl/test-format @@ -0,0 +1,49 @@ +#!/bin/sh +# +# Test mhl.headers, at least. + +set -e + +if test -z "${MH_OBJ_DIR}"; then + srcdir=`dirname "$0"`/../.. + MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR +fi + +. "$MH_OBJ_DIR/test/common.sh" + +require_locale en_US.UTF-8 en_US.UTF8 en_US.utf-8 en_US.utf8 + +setup_test +mhl="${MH_LIBEXEC_DIR}/mhl" +expected="$MH_TEST_DIR/$$.expected" +actual="$MH_TEST_DIR/$$.actual" + +# check decode of To: and Cc: +start_test "decode of To: and Cc:" +cat >"$expected" < +Date: Sat, 13 Jul 2019 16:02:39 +To: Encoded + , + Encoded # +cc: Encoded - +From: Encoded * +Subject: encoded addresses + + +EOF + +cat >"`mhpath new`" < +To: "Encoded =?utf-8?Q?=2b?=" , + "Encoded =?utf-8?Q?=23?=" +Cc: "Encoded =?utf-8?Q?=2d?=" +From: "Encoded =?utf-8?Q?=2a?=" +Date: Sat, 13 Jul 2019 16:02:39 +Subject: encoded addresses +EOF + +"$mhl" -nomoreproc -form mhl.headers `mhpath last` >"$actual" +check "$expected" "$actual" + +finish_test +exit $failed -- 2.56.0