From f48baa32826c2cc001bc65c259e47055f584b6b1 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Tue, 7 Aug 2012 16:59:49 +0100 Subject: [PATCH] Re: [PATCH] reply: Convert JSON format to use sprinter --- a1/ee3b54acac29ead52dfd2b3d6f1ce4e7af426e | 129 ++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 a1/ee3b54acac29ead52dfd2b3d6f1ce4e7af426e diff --git a/a1/ee3b54acac29ead52dfd2b3d6f1ce4e7af426e b/a1/ee3b54acac29ead52dfd2b3d6f1ce4e7af426e new file mode 100644 index 000000000..8aedee51a --- /dev/null +++ b/a1/ee3b54acac29ead52dfd2b3d6f1ce4e7af426e @@ -0,0 +1,129 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 1AE6E431FC0 + for ; Tue, 7 Aug 2012 09:00:01 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id bd+dIXfZZyKq for ; + Tue, 7 Aug 2012 09:00:00 -0700 (PDT) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 620D4431FAF + for ; Tue, 7 Aug 2012 09:00:00 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1SymCK-0003TN-Ht; Tue, 07 Aug 2012 16:59:59 +0100 +Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223] + helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) + (envelope-from ) + id 1SymCK-000262-6e; Tue, 07 Aug 2012 16:59:56 +0100 +From: Mark Walters +To: Austin Clements , notmuch@notmuchmail.org +Subject: Re: [PATCH] reply: Convert JSON format to use sprinter +In-Reply-To: <1344344230-9937-1-git-send-email-amdragon@mit.edu> +References: <1344344230-9937-1-git-send-email-amdragon@mit.edu> +User-Agent: Notmuch/0.13.2+96~g634443c (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Tue, 07 Aug 2012 16:59:49 +0100 +Message-ID: <87k3xabslm.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 94.192.233.223 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: efaa6eca1b9335628939c80835879687 (of first 20000 bytes) +X-SpamAssassin-Score: -1.8 +X-SpamAssassin-SpamBar: - +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored -1.8 points. + Summary of the scoring: + * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, + * medium trust + * [138.37.6.40 listed in list.dnswl.org] + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay + * domain + * 0.5 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Tue, 07 Aug 2012 16:00:01 -0000 + + + +On Tue, 07 Aug 2012, Austin Clements 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 -- 2.26.2