From 7b2c4481f10b19a6847e6064da5ee86f9999a0d5 Mon Sep 17 00:00:00 2001
From: Austin Clements <amdragon@MIT.EDU>
Date: Thu, 2 Aug 2012 21:14:51 -0400
Subject: [PATCH] reply: Create a JSON sprinter

---
 notmuch-reply.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/notmuch-reply.c b/notmuch-reply.c
index de21f3b2..e42ba79f 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -22,6 +22,7 @@
 
 #include "notmuch-client.h"
 #include "gmime-filter-headers.h"
+#include "sprinter.h"
 
 static void
 show_reply_headers (GMimeMessage *message)
@@ -596,6 +597,7 @@ notmuch_reply_format_json(void *ctx,
     notmuch_messages_t *messages;
     notmuch_message_t *message;
     mime_node_t *node;
+    sprinter_t *sp;
 
     if (notmuch_query_count_messages (query) != 1) {
 	fprintf (stderr, "Error: search term did not match precisely one message.\n");
@@ -611,6 +613,8 @@ notmuch_reply_format_json(void *ctx,
     if (!reply)
 	return 1;
 
+    sp = sprinter_json_create (ctx, stdout);
+
     /* The headers of the reply message we've created */
     printf ("{\"reply-headers\": ");
     format_headers_json (ctx, reply, TRUE);
-- 
2.45.2