reply: Convert JSON format to use sprinter

Almost all of reply was already being formatted using the sprinter.
This patch converts the top-level dictionary to use the sprinter
interface.
This commit is contained in:
Austin Clements 2012-08-07 08:57:10 -04:00 committed by David Bremner
parent d41946ea78
commit e0d97a639c

View file

@ -614,20 +614,20 @@ notmuch_reply_format_json(void *ctx,
return 1; return 1;
sp = sprinter_json_create (ctx, stdout); sp = sprinter_json_create (ctx, stdout);
sp->begin_map (sp);
/* The headers of the reply message we've created */ /* The headers of the reply message we've created */
printf ("{\"reply-headers\": "); sp->map_key (sp, "reply-headers");
format_headers_json (sp, reply, TRUE); format_headers_json (sp, reply, TRUE);
g_object_unref (G_OBJECT (reply)); g_object_unref (G_OBJECT (reply));
reply = NULL; reply = NULL;
/* Start the original */ /* Start the original */
printf (", \"original\": "); sp->map_key (sp, "original");
format_part_json (ctx, sp, node, TRUE, TRUE); format_part_json (ctx, sp, node, TRUE, TRUE);
/* End */ /* End */
printf ("}\n"); sp->end (sp);
notmuch_message_destroy (message); notmuch_message_destroy (message);
return 0; return 0;