From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
To: Notmuch Mail <notmuch@notmuchmail.org>
Subject: [PATCH v4 7/8] cli/{show,reply}: skip over legacy-display parts
Date: Thu, 29 Aug 2019 11:38:52 -0400 [thread overview]
Message-ID: <20190829153853.12199-8-dkg@fifthhorseman.net> (raw)
In-Reply-To: <20190829153853.12199-1-dkg@fifthhorseman.net>
Make use of the previous changes to fast-forward past any
legacy-display parts during "notmuch show" and "notmuch reply".
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
mime-node.c | 11 ++++++++++-
| 2 --
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/mime-node.c b/mime-node.c
index abb6dd84..599d3b65 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -333,7 +333,16 @@ _mime_node_set_up_part (mime_node_t *node, GMimeObject *part, int numchild)
node_verify (node, part);
}
} else {
- (void) _notmuch_message_crypto_potential_payload (node->ctx->msg_crypto, part, node->parent ? node->parent->part : NULL, numchild);
+ if (_notmuch_message_crypto_potential_payload (node->ctx->msg_crypto, part, node->parent ? node->parent->part : NULL, numchild) &&
+ node->ctx->msg_crypto->decryption_status == NOTMUCH_MESSAGE_DECRYPTED_FULL) {
+ GMimeObject *clean_payload = _notmuch_repair_crypto_payload_skip_legacy_display (part);
+ if (clean_payload != part) {
+ /* only one layer of recursion is possible here
+ * because there can be only a single cryptographic
+ * payload: */
+ return _mime_node_set_up_part (node, clean_payload, numchild);
+ }
+ }
}
return true;
--git a/test/T356-protected-headers.sh b/test/T356-protected-headers.sh
index 43dfffe6..867b8722 100755
--- a/test/T356-protected-headers.sh
+++ b/test/T356-protected-headers.sh
@@ -137,14 +137,12 @@ id:protected-header@crypto.notmuchmail.org
id:subjectless-protected-header@crypto.notmuchmail.org'
test_begin_subtest "when rendering protected headers, avoid rendering legacy-display part"
-test_subtest_known_broken
output=$(notmuch show --format=json id:protected-with-legacy-display@crypto.notmuchmail.org)
test_json_nodes <<<"$output" \
'subject:[0][0][0]["headers"]["Subject"]="Interrupting Cow"' \
'no_legacy_display:[0][0][0]["body"][0]["content"][1]["content-type"]="text/plain"'
test_begin_subtest "when replying, avoid rendering legacy-display part"
-test_subtest_known_broken
output=$(notmuch reply --format=json id:protected-with-legacy-display@crypto.notmuchmail.org)
test_json_nodes <<<"$output" \
'no_legacy_display:["original"]["body"][0]["content"][1]["content-type"]="text/plain"'
--
2.23.0.rc1
next prev parent reply other threads:[~2019-08-29 15:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-29 15:38 v4 of legacy-display cleanup Daniel Kahn Gillmor
2019-08-29 15:38 ` [PATCH v4 1/8] mime-node: split out _mime_node_set_up_part Daniel Kahn Gillmor
2019-08-29 15:38 ` [PATCH v4 2/8] repair: set up codebase for repair functionality Daniel Kahn Gillmor
2019-08-29 15:38 ` [PATCH v4 3/8] test: avoid showing legacy-display parts Daniel Kahn Gillmor
2019-08-29 15:38 ` [PATCH v4 4/8] util/crypto: _n_m_crypto_potential_payload: rename "payload" arg to "part" Daniel Kahn Gillmor
2019-08-29 15:38 ` [PATCH v4 5/8] util/crypto: _n_m_crypto_potential_payload returns whether part is the payload Daniel Kahn Gillmor
2019-08-29 15:38 ` [PATCH v4 6/8] util/repair: add _notmuch_repair_crypto_payload_skip_legacy_display Daniel Kahn Gillmor
2019-08-29 15:38 ` Daniel Kahn Gillmor [this message]
2019-08-29 15:38 ` [PATCH v4 8/8] index: avoid indexing legacy-display parts Daniel Kahn Gillmor
2019-09-03 23:34 ` v4 of legacy-display cleanup David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190829153853.12199-8-dkg@fifthhorseman.net \
--to=dkg@fifthhorseman.net \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).