]> diplodocus.org Git - nmh/commitdiff
show and mhl now decode more addresses in header fields.
authorDavid Levine <levinedl@acm.org>
Sun, 14 Jul 2019 13:29:21 +0000 (09:29 -0400)
committerDavid Levine <levinedl@acm.org>
Sun, 14 Jul 2019 13:29:21 +0000 (09:29 -0400)
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
docs/pending-release-notes
etc/mhl.format
etc/mhl.headers
test/mhl/test-format [new file with mode: 0755]

index e553295..ffc4d65 100644 (file)
@@ -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 \
index 5ee7d81..361b165 100644 (file)
@@ -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
index 289f0b8..c75da10 100644 (file)
@@ -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
 :
index 27a08d7..e82648f 100644 (file)
@@ -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 (executable)
index 0000000..38daf7f
--- /dev/null
@@ -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" <<EOF
+Resent-To: Encoded ! <encoded_exclamation@example.com>
+Date:    Sat, 13 Jul 2019 16:02:39
+To:      Encoded + <encoded_plus@example.com>,
+        Encoded # <encoded_hash@example.com>
+cc:      Encoded - <encoded_minus@example.com>
+From:    Encoded * <encoded_asterisk@example.com>
+Subject: encoded addresses
+
+
+EOF
+
+cat >"`mhpath new`" <<EOF
+Resent-To: "Encoded =?utf-8?Q?=21?=" <encoded_exclamation@example.com>
+To: "Encoded =?utf-8?Q?=2b?=" <encoded_plus@example.com>,
+    "Encoded =?utf-8?Q?=23?=" <encoded_hash@example.com>
+Cc: "Encoded =?utf-8?Q?=2d?=" <encoded_minus@example.com>
+From: "Encoded =?utf-8?Q?=2a?=" <encoded_asterisk@example.com>
+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