+typedef struct show_format {
+ const char *message_set_start;
+ const char *message_start;
+ void (*message) (const void *ctx,
+ notmuch_message_t *message,
+ int indent);
+ const char *header_start;
+ void (*header) (const void *ctx,
+ notmuch_message_t *message);
+ const char *header_end;
+ const char *body_start;
+ void (*part) (GMimeObject *part,
+ int *part_count);
+ const char *body_end;
+ const char *message_end;
+ const char *message_set_sep;
+ const char *message_set_end;
+} show_format_t;
+
+static void
+format_message_text (unused (const void *ctx),
+ notmuch_message_t *message,
+ int indent);
+static void
+format_headers_text (const void *ctx,
+ notmuch_message_t *message);
+static void
+format_part_text (GMimeObject *part,
+ int *part_count);
+static const show_format_t format_text = {
+ "",
+ "\fmessage{ ", format_message_text,
+ "\fheader{\n", format_headers_text, "\fheader}\n",
+ "\fbody{\n", format_part_text, "\fbody}\n",
+ "\fmessage}\n", "",
+ ""
+};
+
+static void
+format_message_json (const void *ctx,
+ notmuch_message_t *message,
+ unused (int indent));
+static void
+format_headers_json (const void *ctx,
+ notmuch_message_t *message);
+static void
+format_part_json (GMimeObject *part,
+ int *part_count);
+static const show_format_t format_json = {
+ "[",
+ "{", format_message_json,
+ ", \"headers\": {", format_headers_json, "}",
+ ", \"body\": [", format_part_json, "]",
+ "}", ", ",
+ "]"
+};
+