[PATCH] reply: Convert JSON format to use sprinter
Austin Clements
amdragon at MIT.EDU
Tue Aug 7 05:57:10 PDT 2012
Almost all of reply was already being formatted using the sprinter.
This patch converts the top-level dictionary to use the sprinter
interface.
---
One last sprinter piece that had slipped through the cracks.
notmuch-reply.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/notmuch-reply.c b/notmuch-reply.c
index fa6665f..e60a264 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -614,20 +614,20 @@ notmuch_reply_format_json(void *ctx,
return 1;
sp = sprinter_json_create (ctx, stdout);
+ sp->begin_map (sp);
/* The headers of the reply message we've created */
- printf ("{\"reply-headers\": ");
+ sp->map_key (sp, "reply-headers");
format_headers_json (sp, reply, TRUE);
g_object_unref (G_OBJECT (reply));
reply = NULL;
/* Start the original */
- printf (", \"original\": ");
-
+ sp->map_key (sp, "original");
format_part_json (ctx, sp, node, TRUE, TRUE);
/* End */
- printf ("}\n");
+ sp->end (sp);
notmuch_message_destroy (message);
return 0;
--
1.7.10
More information about the notmuch
mailing list