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 D78B5431FC0 for ; Fri, 27 Jul 2012 21:29:25 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 VCQo-orea2cV for ; Fri, 27 Jul 2012 21:29:25 -0700 (PDT) Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU [18.7.68.34]) by olra.theworths.org (Postfix) with ESMTP id 301FE431FAF for ; Fri, 27 Jul 2012 21:29:25 -0700 (PDT) X-AuditID: 12074422-b7f1f6d00000090b-4a-50136aa4f98b Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP id EB.82.02315.4AA63105; Sat, 28 Jul 2012 00:29:24 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q6S4TNxv002939; Sat, 28 Jul 2012 00:29:23 -0400 Received: from drake.dyndns.org (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com [209.6.116.242]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q6S4TKoL027356 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sat, 28 Jul 2012 00:29:22 -0400 (EDT) Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1SuyeW-0002Wv-I1; Sat, 28 Jul 2012 00:29:20 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH v2 05/13] reply: Create a JSON sprinter Date: Sat, 28 Jul 2012 00:29:06 -0400 Message-Id: <1343449754-9010-6-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1343449754-9010-1-git-send-email-amdragon@mit.edu> References: <1343449754-9010-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrAIsWRmVeSWpSXmKPExsUixG6norskSzjAYP1CbYu9De2MFqvn8lhc vzmT2eLNynmsDiweO2fdZfdYvGk/m8fhrwtZPJ6tusUcwBLFZZOSmpNZllqkb5fAlXHixjTG glvsFZ/eHmFuYOxg62Lk5JAQMJE4dPQMC4QtJnHh3nqgOBeHkMA+Ronntx6zQDgbGCXmXPzH DOE8YpJ4t341I4Qzl1FiZ+sDsFlsAhoS2/YvZwSxRQSkJXbenc3axcjBwSyQJ/F4rQRIWFjA XGLvibtg61gEVCXmzVvHDmLzCthL3Dq7gQniDHmJp/f7wEZyCjhIbH75gRnEFgKq2T15A+sE Rv4FjAyrGGVTcqt0cxMzc4pTk3WLkxPz8lKLdE31cjNL9FJTSjcxggPORWkH48+DSocYBTgY lXh4T10RChBiTSwrrsw9xCjJwaQkyhsVLhwgxJeUn1KZkVicEV9UmpNafIhRgoNZSYR3pyBQ jjclsbIqtSgfJiXNwaIkznst5aa/kEB6YklqdmpqQWoRTFaGg0NJgnd7JlCjYFFqempFWmZO CUKaiYMTZDgP0HDFLJDhxQWJucWZ6RD5U4yKUuK8j0GaBUASGaV5cL2whPCKURzoFWFeYZB2 HmAyget+BTSYCWiwRbQQyOCSRISUVAMj88p654dNby6G3O4S/+iSHnnRcs5KmedX/19Unbnx Z+Rb3tM6u30OScp0GJm7Rwpsfs3zlycp8abbXuuH5pwbBLX+GC++ZHRnPeMeoasqQW9yDs88 xG1/7cWDGzp2p15lSm8LuqkTXfTrbv4Rj/+eMT8ez34p38ne+vTEjs9HJP9fWPxB7erHk0os xRmJhlrMRcWJAH7wDFjjAgAA Cc: tomi.ollila@iki.fi 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: Sat, 28 Jul 2012 04:29:26 -0000 --- notmuch-reply.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/notmuch-reply.c b/notmuch-reply.c index de21f3b..e42ba79 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); -- 1.7.10