Re: [PATCH v4 01/16] add util/search-path.{c, h} to test for executables in $PATH
[notmuch-archives.git] / 2b / 9d74a0f6277e590b0cfd86102dcadce4e84b80
1 Return-Path: <dme@dme.org>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 7BE2F40DF1B\r
6         for <notmuch@notmuchmail.org>; Mon, 22 Nov 2010 03:40:32 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.9\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
12         tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id ulegLFMCckpm for <notmuch@notmuchmail.org>;\r
16         Mon, 22 Nov 2010 03:40:22 -0800 (PST)\r
17 Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com\r
18         [74.125.82.181])\r
19         by olra.theworths.org (Postfix) with ESMTP id 2D53040DF18\r
20         for <notmuch@notmuchmail.org>; Mon, 22 Nov 2010 03:40:22 -0800 (PST)\r
21 Received: by wyb36 with SMTP id 36so2362221wyb.26\r
22         for <notmuch@notmuchmail.org>; Mon, 22 Nov 2010 03:40:21 -0800 (PST)\r
23 Received: by 10.216.30.10 with SMTP id j10mr3982583wea.8.1290426017619;\r
24         Mon, 22 Nov 2010 03:40:17 -0800 (PST)\r
25 Received: from ut.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com\r
26         [81.149.164.25])\r
27         by mx.google.com with ESMTPS id x3sm2215979wes.22.2010.11.22.03.40.16\r
28         (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
29         Mon, 22 Nov 2010 03:40:17 -0800 (PST)\r
30 Received: by ut.hh.sledj.net (Postfix, from userid 1000)\r
31         id 037CD594058; Mon, 22 Nov 2010 11:36:48 +0000 (GMT)\r
32 From: David Edmondson <dme@dme.org>\r
33 To: notmuch@notmuchmail.org\r
34 Subject: [PATCH] MIME: Output the filename of a part whatever the declared\r
35         disposition.\r
36 Date: Mon, 22 Nov 2010 11:36:47 +0000\r
37 Message-Id: <1290425807-14946-1-git-send-email-dme@dme.org>\r
38 X-Mailer: git-send-email 1.7.2.3\r
39 X-BeenThere: notmuch@notmuchmail.org\r
40 X-Mailman-Version: 2.1.13\r
41 Precedence: list\r
42 List-Id: "Use and development of the notmuch mail system."\r
43         <notmuch.notmuchmail.org>\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
47 List-Post: <mailto:notmuch@notmuchmail.org>\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
51 X-List-Received-Date: Mon, 22 Nov 2010 11:40:32 -0000\r
52 \r
53 Some user agents create MIME parts that are generally not rendered\r
54 inline by the emacs user interface (for example application/pdf) yet\r
55 set the disposition for the part to 'inline'. If the user wishes to\r
56 save such parts it is convenient to be prompted with the filename used\r
57 for the attachment by the sender, should it be present. To allow this,\r
58 output the filename for all MIME parts if it is known irrespective of\r
59 the declared disposition.\r
60 ---\r
61  notmuch-show.c |   11 +++--------\r
62  1 files changed, 3 insertions(+), 8 deletions(-)\r
63 \r
64 diff --git a/notmuch-show.c b/notmuch-show.c\r
65 index ef421ec..f8e37c5 100644\r
66 --- a/notmuch-show.c\r
67 +++ b/notmuch-show.c\r
68 @@ -423,7 +423,7 @@ static void\r
69  format_part_json (GMimeObject *part, int *part_count)\r
70  {\r
71      GMimeContentType *content_type;\r
72 -    GMimeContentDisposition *disposition;\r
73 +    const char *filename;\r
74      void *ctx = talloc_new (NULL);\r
75      GMimeStream *stream_memory = g_mime_stream_mem_new ();\r
76      GByteArray *part_content;\r
77 @@ -437,14 +437,9 @@ format_part_json (GMimeObject *part, int *part_count)\r
78             *part_count,\r
79             json_quote_str (ctx, g_mime_content_type_to_string (content_type)));\r
80  \r
81 -    disposition = g_mime_object_get_content_disposition (part);\r
82 -    if (disposition &&\r
83 -       strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)\r
84 -    {\r
85 -       const char *filename = g_mime_part_get_filename (GMIME_PART (part));\r
86 -\r
87 +    filename = g_mime_part_get_filename (GMIME_PART (part));\r
88 +    if (filename != NULL)\r
89         printf (", \"filename\": %s", json_quote_str (ctx, filename));\r
90 -    }\r
91  \r
92      if (g_mime_content_type_is_type (content_type, "text", "*") &&\r
93         !g_mime_content_type_is_type (content_type, "text", "html"))\r
94 -- \r
95 1.7.2.3\r
96 \r