Re: [PATCH 1/4] show: Pass notmuch_message_t instead of path to show_message_body.
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Fri, 9 Dec 2011 19:05:23 +0000 (23:05 +0400)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:40:42 +0000 (09:40 -0800)
bc/a9e286cb2fd5c45b070dd3c36862f9325d6216 [new file with mode: 0644]

diff --git a/bc/a9e286cb2fd5c45b070dd3c36862f9325d6216 b/bc/a9e286cb2fd5c45b070dd3c36862f9325d6216
new file mode 100644 (file)
index 0000000..4c0bcce
--- /dev/null
@@ -0,0 +1,150 @@
+Return-Path: <dmitry.kurochkin@gmail.com>\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 DBEDE431FD0\r
+       for <notmuch@notmuchmail.org>; Fri,  9 Dec 2011 11:05:59 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, 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 5twdQCPY93rg for <notmuch@notmuchmail.org>;\r
+       Fri,  9 Dec 2011 11:05:59 -0800 (PST)\r
+Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com\r
+       [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 3004F431FB6\r
+       for <notmuch@notmuchmail.org>; Fri,  9 Dec 2011 11:05:59 -0800 (PST)\r
+Received: by bkat8 with SMTP id t8so3503471bka.26\r
+       for <notmuch@notmuchmail.org>; Fri, 09 Dec 2011 11:05:57 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
+       :mime-version:content-type;\r
+       bh=ZBBxHMds7DmNU1+Aon40Lqr+y3JMPJ4vKYUM0Lz3OlI=;\r
+       b=KRPGBhix5qnW7d8rwy+I2bqrCBTN8wxWxxJEx8OYShrsFqa4Rij73hwNI04p8zChU2\r
+       O7mhWJN2tyRCgd1xq9ZJV7JZwnU5/nIVjsQpdXgJXCV5O2xH/bM/+mkHr/MziTayr5+L\r
+       cVRdhEkZu9etGFuHZdJFGgcAe8aRMsXM4lVAQ=\r
+Received: by 10.204.148.76 with SMTP id o12mr4629961bkv.114.1323457557733;\r
+       Fri, 09 Dec 2011 11:05:57 -0800 (PST)\r
+Received: from localhost ([91.144.186.21])\r
+       by mx.google.com with ESMTPS id zv9sm12029944bkb.0.2011.12.09.11.05.55\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Fri, 09 Dec 2011 11:05:56 -0800 (PST)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 1/4] show: Pass notmuch_message_t instead of path to\r
+       show_message_body.\r
+In-Reply-To: <1323027100-10307-2-git-send-email-amdragon@mit.edu>\r
+References: <1322446871-14986-1-git-send-email-amdragon@mit.edu>\r
+       <1323027100-10307-1-git-send-email-amdragon@mit.edu>\r
+       <1323027100-10307-2-git-send-email-amdragon@mit.edu>\r
+User-Agent: Notmuch/0.10.2+82~g96a629c (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Fri, 09 Dec 2011 23:05:23 +0400\r
+Message-ID: <87ty597eh8.fsf@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\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, 09 Dec 2011 19:06:00 -0000\r
+\r
+On Sun,  4 Dec 2011 14:31:37 -0500, Austin Clements <amdragon@MIT.EDU> wrote:\r
+> In addition to simplifying the code, we'll need the notmuch_message_t*\r
+> in show_message_body shortly.\r
+> ---\r
+>  notmuch-client.h |    2 +-\r
+>  notmuch-reply.c  |    3 +--\r
+>  notmuch-show.c   |    3 +--\r
+>  show-message.c   |    3 ++-\r
+>  4 files changed, 5 insertions(+), 6 deletions(-)\r
+> \r
+> diff --git a/notmuch-client.h b/notmuch-client.h\r
+> index b50cb38..d7fb6ee 100644\r
+> --- a/notmuch-client.h\r
+> +++ b/notmuch-client.h\r
+> @@ -162,7 +162,7 @@ char *\r
+>  query_string_from_args (void *ctx, int argc, char *argv[]);\r
+>  \r
+>  notmuch_status_t\r
+> -show_message_body (const char *filename,\r
+> +show_message_body (notmuch_message_t *message,\r
+>                 const notmuch_show_format_t *format,\r
+>                 notmuch_show_params_t *params);\r
+>  \r
+> diff --git a/notmuch-reply.c b/notmuch-reply.c\r
+> index 7ac879f..f8d5f64 100644\r
+> --- a/notmuch-reply.c\r
+> +++ b/notmuch-reply.c\r
+> @@ -546,8 +546,7 @@ notmuch_reply_format_default(void *ctx,\r
+>              notmuch_message_get_header (message, "date"),\r
+>              notmuch_message_get_header (message, "from"));\r
+>  \r
+> -    show_message_body (notmuch_message_get_filename (message),\r
+> -                       format, params);\r
+> +    show_message_body (message, format, params);\r
+>  \r
+>      notmuch_message_destroy (message);\r
+>      }\r
+> diff --git a/notmuch-show.c b/notmuch-show.c\r
+> index 603992a..1dee3aa 100644\r
+> --- a/notmuch-show.c\r
+> +++ b/notmuch-show.c\r
+> @@ -753,8 +753,7 @@ show_message (void *ctx,\r
+>      }\r
+>  \r
+>      if (format->part_content)\r
+> -    show_message_body (notmuch_message_get_filename (message),\r
+> -                       format, params);\r
+> +    show_message_body (message, format, params);\r
+>  \r
+>      if (params->part <= 0) {\r
+>      fputs (format->body_end, stdout);\r
+> diff --git a/show-message.c b/show-message.c\r
+> index d83f04e..09fa607 100644\r
+> --- a/show-message.c\r
+> +++ b/show-message.c\r
+> @@ -175,7 +175,7 @@ show_message_part (GMimeObject *part,\r
+>  }\r
+>  \r
+>  notmuch_status_t\r
+> -show_message_body (const char *filename,\r
+> +show_message_body (notmuch_message_t *message,\r
+>                 const notmuch_show_format_t *format,\r
+>                 notmuch_show_params_t *params)\r
+\r
+Is show_message_body() (or functions that it calls/would call) supposed\r
+to modify the message structure?  If not, we should make it const.\r
+\r
+I would also make all pointers constant (i.e. const notmuch_message_t\r
+*const message), but I can not insist since it is not common in notmuch.\r
+\r
+Regards,\r
+  Dmitry\r
+\r
+>  {\r
+> @@ -183,6 +183,7 @@ show_message_body (const char *filename,\r
+>      GMimeParser *parser = NULL;\r
+>      GMimeMessage *mime_message = NULL;\r
+>      notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS;\r
+> +    const char *filename = notmuch_message_get_filename (message);\r
+>      FILE *file = NULL;\r
+>      show_message_state_t state;\r
+>  \r
+> -- \r
+> 1.7.5.4\r
+> \r