- const GMimeSigner *signer = g_mime_signature_validity_get_signers (validity);
- int first = 1;
- void *ctx_quote = talloc_new (NULL);
-
- while (signer) {
- if (first)
- first = 0;
- else
- printf (", ");
-
- printf ("{");
-
- /* status */
- printf ("\"status\": %s",
- json_quote_str (ctx_quote,
- signer_status_to_string (signer->status)));
-
- if (signer->status == GMIME_SIGNER_STATUS_GOOD)
- {
- if (signer->fingerprint)
- printf (", \"fingerprint\": %s", json_quote_str (ctx_quote, signer->fingerprint));
- /* these dates are seconds since the epoch; should we
- * provide a more human-readable format string? */
- if (signer->created)
- printf (", \"created\": %d", (int) signer->created);
- if (signer->expires)
- printf (", \"expires\": %d", (int) signer->expires);
- /* output user id only if validity is FULL or ULTIMATE. */
- /* note that gmime is using the term "trust" here, which
- * is WRONG. It's actually user id "validity". */
- if ((signer->name) && (signer->trust)) {
- if ((signer->trust == GMIME_SIGNER_TRUST_FULLY) || (signer->trust == GMIME_SIGNER_TRUST_ULTIMATE))
- printf (", \"userid\": %s", json_quote_str (ctx_quote, signer->name));
- }
- } else {
- if (signer->keyid)
- printf (", \"keyid\": %s", json_quote_str (ctx_quote, signer->keyid));
- }
- if (signer->errors != GMIME_SIGNER_ERROR_NONE) {
- printf (", \"errors\": %d", signer->errors);
- }
-
- printf ("}");
- signer = signer->next;
- }
-
- printf ("]");
-
- talloc_free (ctx_quote);
-}
-#endif
-
-static void
-format_part_content_raw (GMimeObject *part)
-{
- if (! GMIME_IS_PART (part))
- return;
-
- GMimeStream *stream_stdout;
- GMimeStream *stream_filter = NULL;
- GMimeDataWrapper *wrapper;
-
- stream_stdout = g_mime_stream_file_new (stdout);
- g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);
-
- stream_filter = g_mime_stream_filter_new (stream_stdout);
-
- wrapper = g_mime_part_get_content_object (GMIME_PART (part));
-
- if (wrapper && stream_filter)
- g_mime_data_wrapper_write_to_stream (wrapper, stream_filter);
-
- if (stream_filter)
- g_object_unref (stream_filter);
-
- if (stream_stdout)
- g_object_unref(stream_stdout);
-}
-
-static void
-format_part_text (const void *ctx, mime_node_t *node,