]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch-show.c
cli/show: emit headers after emitting body
[notmuch] / notmuch-show.c
index b95fc389cf009eec354a44bc09787e7009083fad..0816a5e1b8c786fdb70b0bc29d796c60403084a7 100644 (file)
@@ -619,15 +619,44 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
        sp->begin_map (sp);
        format_message_sprinter (sp, node->envelope_file);
 
-       sp->map_key (sp, "headers");
-       format_headers_sprinter (sp, GMIME_MESSAGE (node->part), false);
-
        if (output_body) {
            sp->map_key (sp, "body");
            sp->begin_list (sp);
            format_part_sprinter (ctx, sp, mime_node_child (node, 0), true, include_html);
            sp->end (sp);
        }
+
+       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 ||
+               msg_crypto->decryption_status != NOTMUCH_MESSAGE_DECRYPTED_NONE) {
+               if (msg_crypto->sig_list) {
+                   sp->map_key (sp, "signed");
+                   sp->begin_map (sp);
+                   sp->map_key (sp, "status");
+                   format_part_sigstatus_sprinter (sp, msg_crypto->sig_list);
+                   if (msg_crypto->signature_encrypted) {
+                       sp->map_key (sp, "encrypted");
+                       sp->boolean (sp, msg_crypto->signature_encrypted);
+                   }
+                   sp->end (sp);
+               }
+               if (msg_crypto->decryption_status != NOTMUCH_MESSAGE_DECRYPTED_NONE) {
+                   sp->map_key (sp, "decrypted");
+                   sp->begin_map (sp);
+                   sp->map_key (sp, "status");
+                   sp->string (sp, msg_crypto->decryption_status == NOTMUCH_MESSAGE_DECRYPTED_FULL ? "full" : "partial");
+                   sp->end (sp);
+               }
+           }
+           sp->end (sp);
+       }
+
+       sp->map_key (sp, "headers");
+       format_headers_sprinter (sp, GMIME_MESSAGE (node->part), false);
+
        sp->end (sp);
        return;
     }