"\fbody{\n",
format_part_start_text,
NULL,
+ NULL,
format_part_content_text,
format_part_end_text,
"",
format_part_start_json (unused (GMimeObject *part),
int *part_count);
+static void
+format_part_encstatus_json (int status);
+
static void
format_part_sigstatus_json (const GMimeSignatureValidity* validity);
", \"headers\": {", format_headers_json, "}",
", \"body\": [",
format_part_start_json,
+ format_part_encstatus_json,
format_part_sigstatus_json,
format_part_content_json,
format_part_end_json,
NULL,
NULL,
NULL,
+ NULL,
"",
"",
"", "",
"", NULL,
"", NULL, "",
"",
+ NULL,
NULL,
NULL,
format_part_content_raw,
printf ("{\"id\": %d", *part_count);
}
+static void
+format_part_encstatus_json (int status)
+{
+ printf (", \"encstatus\": [{\"status\": ");
+ if (status) {
+ printf ("\"good\"");
+ } else {
+ printf ("\"bad\"");
+ }
+ printf ("}]");
+}
+
static void
format_part_sigstatus_json (const GMimeSignatureValidity* validity)
{
params.raw = 0;
params.part = -1;
params.cryptoctx = NULL;
+ params.decrypt = 0;
for (i = 0; i < argc && argv[i][0] == '-'; i++) {
if (strcmp (argv[i], "--") == 0) {
params.part = atoi(argv[i] + sizeof ("--part=") - 1);
} else if (STRNCMP_LITERAL (argv[i], "--entire-thread") == 0) {
params.entire_thread = 1;
- } else if (STRNCMP_LITERAL (argv[i], "--verify") == 0) {
+ } else if ((STRNCMP_LITERAL (argv[i], "--verify") == 0) ||
+ (STRNCMP_LITERAL (argv[i], "--decrypt") == 0)) {
if (params.cryptoctx == NULL) {
GMimeSession* session = g_object_new(notmuch_gmime_session_get_type(), NULL);
if (NULL == (params.cryptoctx = g_mime_gpg_context_new(session, "gpg")))
g_object_unref (session);
session = NULL;
}
+ if (STRNCMP_LITERAL (argv[i], "--decrypt") == 0)
+ params.decrypt = 1;
} else {
fprintf (stderr, "Unrecognized option: %s\n", argv[i]);
return 1;