--- /dev/null
+Return-Path: <tomi.ollila@iki.fi>\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 B94B5431FAF\r
+ for <notmuch@notmuchmail.org>; Sun, 5 Aug 2012 02:33:50 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ 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 Xxr27X-hQ35T for <notmuch@notmuchmail.org>;\r
+ Sun, 5 Aug 2012 02:33:49 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 75CA4431FAE\r
+ for <notmuch@notmuchmail.org>; Sun, 5 Aug 2012 02:33:49 -0700 (PDT)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id 5FAED10014F;\r
+ Sun, 5 Aug 2012 12:33:54 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Peter Wang <novalazy@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 1/4] show: indicate length of omitted body content (json)\r
+In-Reply-To: <1344151345-25411-1-git-send-email-novalazy@gmail.com>\r
+References: <1344151345-25411-1-git-send-email-novalazy@gmail.com>\r
+User-Agent: Notmuch/0.13.2+123~gd19b5be (http://notmuchmail.org) Emacs/24.1.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Sun, 05 Aug 2012 12:32:22 +0300\r
+Message-ID: <m21ujladll.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\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: Sun, 05 Aug 2012 09:33:50 -0000\r
+\r
+On Sun, Aug 05 2012, Peter Wang <novalazy@gmail.com> wrote:\r
+\r
+> If a leaf part's body content is omitted, return the content length in\r
+> --format=json output. This information may be used by the consumer,\r
+> e.g. to decide whether to download a large attachment over a slow link.\r
+> ---\r
+\r
+Code looks good to me and tests pass. So I am not against pushing...\r
+\r
+Tomi\r
+\r
+\r
+> devel/schemata | 5 ++++-\r
+> notmuch-show.c | 8 ++++++++\r
+> 2 files changed, 12 insertions(+), 1 deletions(-)\r
+>\r
+> diff --git a/devel/schemata b/devel/schemata\r
+> index 9cb25f5..3df2764 100644\r
+> --- a/devel/schemata\r
+> +++ b/devel/schemata\r
+> @@ -69,7 +69,10 @@ part = {\r
+> # A leaf part's body content is optional, but may be included if\r
+> # it can be correctly encoded as a string. Consumers should use\r
+> # this in preference to fetching the part content separately.\r
+> - content?: string\r
+> + content?: string,\r
+> + # If a leaf part's body content is not included, the content-length\r
+> + # may be included instead.\r
+> + content-length?: int\r
+> }\r
+> \r
+> # The headers of a message or part (format_headers_json with reply = FALSE)\r
+> diff --git a/notmuch-show.c b/notmuch-show.c\r
+> index 3556293..5c54257 100644\r
+> --- a/notmuch-show.c\r
+> +++ b/notmuch-show.c\r
+> @@ -664,6 +664,14 @@ format_part_json (const void *ctx, sprinter_t *sp, mime_node_t *node,\r
+> sp->map_key (sp, "content");\r
+> sp->string_len (sp, (char *) part_content->data, part_content->len);\r
+> g_object_unref (stream_memory);\r
+> + } else {\r
+> + GMimeDataWrapper *wrapper = g_mime_part_get_content_object (GMIME_PART (node->part));\r
+> + GMimeStream *stream = g_mime_data_wrapper_get_stream (wrapper);\r
+> + ssize_t length = g_mime_stream_length (stream);\r
+> + if (length >= 0) {\r
+> + sp->map_key (sp, "content-length");\r
+> + sp->integer (sp, length);\r
+> + }\r
+> }\r
+> } else if (GMIME_IS_MULTIPART (node->part)) {\r
+> sp->map_key (sp, "content");\r
+> -- \r
+> 1.7.4.4\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r