Re: [PATCH v4 09/16] index encrypted parts when asked.
[notmuch-archives.git] / b3 / d1007401595b24ed4cb52339fa3dfcf876b188
1 Return-Path: <jrollins@servo.finestructure.net>\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 2366C429E48\r
6         for <notmuch@notmuchmail.org>; Wed, 25 May 2011 18:01:37 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.921\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.921 tagged_above=-999 required=5\r
12         tests=[NO_DNS_FOR_FROM=0.379, RCVD_IN_DNSWL_MED=-2.3]\r
13         autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id RXAShqdU+RD2 for <notmuch@notmuchmail.org>;\r
17         Wed, 25 May 2011 18:01:36 -0700 (PDT)\r
18 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
19         [131.215.239.19])\r
20         by olra.theworths.org (Postfix) with ESMTP id 44E01429E32\r
21         for <notmuch@notmuchmail.org>; Wed, 25 May 2011 18:01:34 -0700 (PDT)\r
22 Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
23         by fire-doxen-postvirus (Postfix) with ESMTP id E0F2A3282D3;\r
24         Wed, 25 May 2011 17:55:18 -0700 (PDT)\r
25 X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new\r
26 Received: from servo.finestructure.net (gwave-104.ligo.caltech.edu\r
27         [131.215.114.104]) (Authenticated sender: jrollins)\r
28         by fire-doxen-submit (Postfix) with ESMTP id DF0DB3281DB;\r
29         Wed, 25 May 2011 17:55:11 -0700 (PDT)\r
30 Received: by servo.finestructure.net (Postfix, from userid 1000)\r
31         id 6DA457BE; Wed, 25 May 2011 18:01:26 -0700 (PDT)\r
32 From: Jameson Graef Rollins <jrollins@finestructure.net>\r
33 To: notmuch@notmuchmail.org\r
34 Subject: [PATCH 01/11] Simplify reply_part function to eliminate redundant\r
35         code paths.\r
36 Date: Wed, 25 May 2011 18:01:10 -0700\r
37 Message-Id: <1306371680-19441-2-git-send-email-jrollins@finestructure.net>\r
38 X-Mailer: git-send-email 1.7.4.4\r
39 In-Reply-To: <1306371680-19441-1-git-send-email-jrollins@finestructure.net>\r
40 References: <1306371680-19441-1-git-send-email-jrollins@finestructure.net>\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.13\r
43 Precedence: list\r
44 List-Id: "Use and development of the notmuch mail system."\r
45         <notmuch.notmuchmail.org>\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
49 List-Post: <mailto:notmuch@notmuchmail.org>\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
53 X-List-Received-Date: Thu, 26 May 2011 01:01:37 -0000\r
54 \r
55 This is the same logic but with less code.\r
56 ---\r
57  notmuch-reply.c |   41 ++++++++++++++---------------------------\r
58  1 files changed, 14 insertions(+), 27 deletions(-)\r
59 \r
60 diff --git a/notmuch-reply.c b/notmuch-reply.c\r
61 index ab15650..5d72b1f 100644\r
62 --- a/notmuch-reply.c\r
63 +++ b/notmuch-reply.c\r
64 @@ -88,31 +88,8 @@ static void\r
65  reply_part (GMimeObject *part,\r
66             unused (int *part_count))\r
67  {\r
68 -    GMimeContentDisposition *disposition;\r
69 -    GMimeContentType *content_type;\r
70 -\r
71 -    disposition = g_mime_object_get_content_disposition (part);\r
72 -    if (disposition &&\r
73 -       strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)\r
74 -    {\r
75 -       const char *filename = g_mime_part_get_filename (GMIME_PART (part));\r
76 -       content_type = g_mime_object_get_content_type (GMIME_OBJECT (part));\r
77 -\r
78 -       if (g_mime_content_type_is_type (content_type, "text", "*") &&\r
79 -           !g_mime_content_type_is_type (content_type, "text", "html"))\r
80 -       {\r
81 -           reply_part_content (part);\r
82 -       }\r
83 -       else\r
84 -       {\r
85 -           printf ("Attachment: %s (%s)\n", filename,\r
86 -                   g_mime_content_type_to_string (content_type));\r
87 -       }\r
88 -\r
89 -       return;\r
90 -    }\r
91 -\r
92 -    content_type = g_mime_object_get_content_type (GMIME_OBJECT (part));\r
93 +    GMimeContentType *content_type = g_mime_object_get_content_type (GMIME_OBJECT (part));\r
94 +    GMimeContentDisposition *disposition = g_mime_object_get_content_disposition (part);\r
95  \r
96      if (g_mime_content_type_is_type (content_type, "text", "*") &&\r
97         !g_mime_content_type_is_type (content_type, "text", "html"))\r
98 @@ -121,8 +98,18 @@ reply_part (GMimeObject *part,\r
99      }\r
100      else\r
101      {\r
102 -       printf ("Non-text part: %s\n",\r
103 -               g_mime_content_type_to_string (content_type));\r
104 +       if (disposition &&\r
105 +           strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)\r
106 +       {\r
107 +           const char *filename = g_mime_part_get_filename (GMIME_PART (part));\r
108 +           printf ("Attachment: %s (%s)\n", filename,\r
109 +                   g_mime_content_type_to_string (content_type));\r
110 +       }\r
111 +       else\r
112 +       {\r
113 +           printf ("Non-text part: %s\n",\r
114 +                   g_mime_content_type_to_string (content_type));\r
115 +       }\r
116      }\r
117  }\r
118  \r
119 -- \r
120 1.7.4.4\r
121 \r