unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] reply: Convert JSON format to use sprinter
@ 2012-08-07 12:57 Austin Clements
  2012-08-07 13:07 ` Tomi Ollila
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Austin Clements @ 2012-08-07 12:57 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] reply: Convert JSON format to use sprinter
  2012-08-07 12:57 [PATCH] reply: Convert JSON format to use sprinter Austin Clements
@ 2012-08-07 13:07 ` Tomi Ollila
  2012-08-07 15:59 ` Mark Walters
  2012-08-12 19:53 ` David Bremner
  2 siblings, 0 replies; 4+ messages in thread
From: Tomi Ollila @ 2012-08-07 13:07 UTC (permalink / raw)
  To: Austin Clements, notmuch

On Tue, Aug 07 2012, Austin Clements <amdragon@MIT.EDU> wrote:

> Almost all of reply was already being formatted using the sprinter.
> This patch converts the top-level dictionary to use the sprinter
> interface.
> ---

LGTM.

Tomi


>
> 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
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] reply: Convert JSON format to use sprinter
  2012-08-07 12:57 [PATCH] reply: Convert JSON format to use sprinter Austin Clements
  2012-08-07 13:07 ` Tomi Ollila
@ 2012-08-07 15:59 ` Mark Walters
  2012-08-12 19:53 ` David Bremner
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Walters @ 2012-08-07 15:59 UTC (permalink / raw)
  To: Austin Clements, notmuch



On Tue, 07 Aug 2012, Austin Clements <amdragon@MIT.EDU> wrote:
> 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.

Looks good to me +1

Mark

>
>  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
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] reply: Convert JSON format to use sprinter
  2012-08-07 12:57 [PATCH] reply: Convert JSON format to use sprinter Austin Clements
  2012-08-07 13:07 ` Tomi Ollila
  2012-08-07 15:59 ` Mark Walters
@ 2012-08-12 19:53 ` David Bremner
  2 siblings, 0 replies; 4+ messages in thread
From: David Bremner @ 2012-08-12 19:53 UTC (permalink / raw)
  To: Austin Clements, notmuch

Austin Clements <amdragon@MIT.EDU> writes:

> Almost all of reply was already being formatted using the sprinter.
> This patch converts the top-level dictionary to use the sprinter
> interface.

pushed,

d

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-08-12 19:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-07 12:57 [PATCH] reply: Convert JSON format to use sprinter Austin Clements
2012-08-07 13:07 ` Tomi Ollila
2012-08-07 15:59 ` Mark Walters
2012-08-12 19:53 ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).