diff options
| author | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2019-05-26 18:15:58 -0400 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2019-05-29 08:05:01 -0300 |
| commit | 1c7fbbcc99693c0433f7b06b569ce90c19ac5e1b (patch) | |
| tree | 23fa9bd1bdb6fd4839fc111861f50e5abc586738 /notmuch-show.c | |
| parent | 528f526f6970499575712fd1db6610d773a0b80e (diff) | |
cli/show: emit payload subject instead of outside subject
Correctly fix the two outstanding tests so that the protected (hidden)
subject is properly reported.
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Diffstat (limited to 'notmuch-show.c')
| -rw-r--r-- | notmuch-show.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/notmuch-show.c b/notmuch-show.c index 0816a5e1..b1f6a4bb 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -197,7 +197,7 @@ _is_from_line (const char *line) void format_headers_sprinter (sprinter_t *sp, GMimeMessage *message, - bool reply) + bool reply, const _notmuch_message_crypto_t *msg_crypto) { /* Any changes to the JSON or S-Expression format should be * reflected in the file devel/schemata. */ @@ -209,7 +209,10 @@ format_headers_sprinter (sprinter_t *sp, GMimeMessage *message, sp->begin_map (sp); sp->map_key (sp, "Subject"); - sp->string (sp, g_mime_message_get_subject (message)); + if (msg_crypto && msg_crypto->payload_subject) { + sp->string (sp, msg_crypto->payload_subject); + } else + sp->string (sp, g_mime_message_get_subject (message)); sp->map_key (sp, "From"); sp->string (sp, g_mime_message_get_from_string (message)); @@ -616,6 +619,7 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node, * reflected in the file devel/schemata. */ if (node->envelope_file) { + const _notmuch_message_crypto_t *msg_crypto = NULL; sp->begin_map (sp); format_message_sprinter (sp, node->envelope_file); @@ -626,8 +630,8 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node, sp->end (sp); } + msg_crypto = mime_node_get_message_crypto_status (node); if (notmuch_format_version >= 4) { - const _notmuch_message_crypto_t *msg_crypto = mime_node_get_message_crypto_status (node); sp->map_key (sp, "crypto"); sp->begin_map (sp); if (msg_crypto->sig_list || @@ -655,7 +659,7 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node, } sp->map_key (sp, "headers"); - format_headers_sprinter (sp, GMIME_MESSAGE (node->part), false); + format_headers_sprinter (sp, GMIME_MESSAGE (node->part), false, msg_crypto); sp->end (sp); return; @@ -748,7 +752,7 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node, sp->begin_map (sp); sp->map_key (sp, "headers"); - format_headers_sprinter (sp, GMIME_MESSAGE (node->part), false); + format_headers_sprinter (sp, GMIME_MESSAGE (node->part), false, NULL); sp->map_key (sp, "body"); sp->begin_list (sp); |
