mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 20:08:10 +01:00
reply: Create a JSON sprinter
This commit is contained in:
parent
d79b24b98d
commit
7b2c4481f1
1 changed files with 4 additions and 0 deletions
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "notmuch-client.h"
|
#include "notmuch-client.h"
|
||||||
#include "gmime-filter-headers.h"
|
#include "gmime-filter-headers.h"
|
||||||
|
#include "sprinter.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_reply_headers (GMimeMessage *message)
|
show_reply_headers (GMimeMessage *message)
|
||||||
|
@ -596,6 +597,7 @@ notmuch_reply_format_json(void *ctx,
|
||||||
notmuch_messages_t *messages;
|
notmuch_messages_t *messages;
|
||||||
notmuch_message_t *message;
|
notmuch_message_t *message;
|
||||||
mime_node_t *node;
|
mime_node_t *node;
|
||||||
|
sprinter_t *sp;
|
||||||
|
|
||||||
if (notmuch_query_count_messages (query) != 1) {
|
if (notmuch_query_count_messages (query) != 1) {
|
||||||
fprintf (stderr, "Error: search term did not match precisely one message.\n");
|
fprintf (stderr, "Error: search term did not match precisely one message.\n");
|
||||||
|
@ -611,6 +613,8 @@ notmuch_reply_format_json(void *ctx,
|
||||||
if (!reply)
|
if (!reply)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
sp = sprinter_json_create (ctx, stdout);
|
||||||
|
|
||||||
/* The headers of the reply message we've created */
|
/* The headers of the reply message we've created */
|
||||||
printf ("{\"reply-headers\": ");
|
printf ("{\"reply-headers\": ");
|
||||||
format_headers_json (ctx, reply, TRUE);
|
format_headers_json (ctx, reply, TRUE);
|
||||||
|
|
Loading…
Reference in a new issue