[PATCH v3 05/13] reply: Create a JSON sprinter
authorAustin Clements <amdragon@MIT.EDU>
Fri, 3 Aug 2012 01:14:51 +0000 (21:14 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:48:46 +0000 (09:48 -0800)
d5/621b7205c479cae87ef0a48a64fe39e9803470 [new file with mode: 0644]

diff --git a/d5/621b7205c479cae87ef0a48a64fe39e9803470 b/d5/621b7205c479cae87ef0a48a64fe39e9803470
new file mode 100644 (file)
index 0000000..966332f
--- /dev/null
@@ -0,0 +1,109 @@
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id ADB12431FAE\r
+       for <notmuch@notmuchmail.org>; Thu,  2 Aug 2012 18:15:09 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id oBDuI8K3eyNH for <notmuch@notmuchmail.org>;\r
+       Thu,  2 Aug 2012 18:15:09 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU\r
+       [18.9.25.12])\r
+       by olra.theworths.org (Postfix) with ESMTP id E47E8431E62\r
+       for <notmuch@notmuchmail.org>; Thu,  2 Aug 2012 18:15:07 -0700 (PDT)\r
+X-AuditID: 1209190c-b7f806d000006b87-15-501b261b568a\r
+Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
+       by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 1C.2B.27527.B162B105; Thu,  2 Aug 2012 21:15:07 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q731F6oQ012764; \r
+       Thu, 2 Aug 2012 21:15:06 -0400\r
+Received: from drake.dyndns.org\r
+       (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
+       [209.6.116.242]) (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q731F4oO002787\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Thu, 2 Aug 2012 21:15:05 -0400 (EDT)\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1Sx6To-0003wJ-6n; Thu, 02 Aug 2012 21:15:04 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3 05/13] reply: Create a JSON sprinter\r
+Date: Thu,  2 Aug 2012 21:14:51 -0400\r
+Message-Id: <1343956499-14543-6-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10\r
+In-Reply-To: <1343956499-14543-1-git-send-email-amdragon@mit.edu>\r
+References: <1343956499-14543-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFjrGIsWRmVeSWpSXmKPExsUixCmqrCutJh1gsOKzrMXquTwW12/OZLZ4\r
+       s3IeqwOzx85Zd9k9Dn9dyOLxbNUt5gDmKC6blNSczLLUIn27BK6MEzemMRbcYq/49PYIcwNj\r
+       B1sXIyeHhICJxOFFr1kgbDGJC/fWA8W5OIQE9jFKTFuzCspZzyjRtPwaO4TzkEni9rbpzCAt\r
+       QgJzGSWmHy0FsdkENCS27V/OCGKLCEhL7Lw7mxXEZhaIk9gy5T9YXFjAXOLJvW9gNouAqsSS\r
+       6ZvA5vAKOEgcb5oIdZK8xNP7fWA2p4CjxOu3rxghdjlILG/rZp3AyL+AkWEVo2xKbpVubmJm\r
+       TnFqsm5xcmJeXmqRrqFebmaJXmpK6SZGcHBJ8uxgfHNQ6RCjAAejEg/vLTHpACHWxLLiytxD\r
+       jJIcTEqivMxKQCG+pPyUyozE4oz4otKc1OJDjBIczEoivFVLpAKEeFMSK6tSi/JhUtIcLEri\r
+       vJdTbvoLCaQnlqRmp6YWpBbBZGU4OJQkeOerAA0VLEpNT61Iy8wpQUgzcXCCDOcBGn4MpIa3\r
+       uCAxtzgzHSJ/ilFRSpx3EchFAiCJjNI8uF5Y9L9iFAd6RZh3Kkg7DzBxwHW/AhrMBDTYzgzk\r
+       6uKSRISUVAPj1DzH71/evwp51yA7Yz7nMUaHOvH5HgV7DDg74uNjuYLTJZnY0rZxT3g7aaa9\r
+       t2DRxq7P9tuWtl1v0+bzNmpyXfiW3zlkln3px+X9Lq9FJl5QcvBvaM4Pv3lzzrOr63RfH9Tl\r
+       W7tn7mSPh8G2QT8ufTkrULhg1bGP+3T1hD95vJ908azD0dfHlFiKMxINtZiLihMBR+L1DtkC        AAA=\r
+Cc: tomi.ollila@iki.fi\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 03 Aug 2012 01:15:10 -0000\r
+\r
+---\r
+ notmuch-reply.c |    4 ++++\r
+ 1 file changed, 4 insertions(+)\r
+\r
+diff --git a/notmuch-reply.c b/notmuch-reply.c\r
+index de21f3b..e42ba79 100644\r
+--- a/notmuch-reply.c\r
++++ b/notmuch-reply.c\r
+@@ -22,6 +22,7 @@\r
\r
+ #include "notmuch-client.h"\r
+ #include "gmime-filter-headers.h"\r
++#include "sprinter.h"\r
\r
+ static void\r
+ show_reply_headers (GMimeMessage *message)\r
+@@ -596,6 +597,7 @@ notmuch_reply_format_json(void *ctx,\r
+     notmuch_messages_t *messages;\r
+     notmuch_message_t *message;\r
+     mime_node_t *node;\r
++    sprinter_t *sp;\r
\r
+     if (notmuch_query_count_messages (query) != 1) {\r
+       fprintf (stderr, "Error: search term did not match precisely one message.\n");\r
+@@ -611,6 +613,8 @@ notmuch_reply_format_json(void *ctx,\r
+     if (!reply)\r
+       return 1;\r
\r
++    sp = sprinter_json_create (ctx, stdout);\r
++\r
+     /* The headers of the reply message we've created */\r
+     printf ("{\"reply-headers\": ");\r
+     format_headers_json (ctx, reply, TRUE);\r
+-- \r
+1.7.10\r
+\r