]> git.notmuchmail.org Git - notmuch/commitdiff
reply: Create a JSON sprinter
authorAustin Clements <amdragon@MIT.EDU>
Fri, 3 Aug 2012 01:14:51 +0000 (21:14 -0400)
committerDavid Bremner <bremner@debian.org>
Fri, 3 Aug 2012 23:24:07 +0000 (20:24 -0300)
notmuch-reply.c

index de21f3b2e8660755ee38b3cd8b2c83e8a586cbfc..e42ba79fcb443796a03cfb150a01d45899ab8f4e 100644 (file)
@@ -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);