Re: [PATCH 9/9] add has: query prefix to search for specific properties
[notmuch-archives.git] / b8 / b455f58b12911ea0807646f8c2f8b6c9c5be72
1 Return-Path: <dkg@fifthhorseman.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 arlo.cworth.org (Postfix) with ESMTP id DC1616DE1416\r
6  for <notmuch@notmuchmail.org>; Tue, 19 Jan 2016 18:53:22 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.023\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.023 tagged_above=-999 required=5\r
12  tests=[AWL=-0.023] autolearn=disabled\r
13 Received: from arlo.cworth.org ([127.0.0.1])\r
14  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
15  with ESMTP id ffcvkxF1Shln for <notmuch@notmuchmail.org>;\r
16  Tue, 19 Jan 2016 18:53:19 -0800 (PST)\r
17 Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108])\r
18  by arlo.cworth.org (Postfix) with ESMTP id 036D06DE1557\r
19  for <notmuch@notmuchmail.org>; Tue, 19 Jan 2016 18:53:16 -0800 (PST)\r
20 Received: from fifthhorseman.net (unknown [38.109.115.130])\r
21  by che.mayfirst.org (Postfix) with ESMTPSA id D08EBF999\r
22  for <notmuch@notmuchmail.org>; Tue, 19 Jan 2016 21:53:13 -0500 (EST)\r
23 Received: by fifthhorseman.net (Postfix, from userid 1000)\r
24  id E9A5320698; Tue, 19 Jan 2016 18:53:10 -0800 (PST)\r
25 From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
26 To: Notmuch Mail <notmuch@notmuchmail.org>\r
27 Subject: [PATCH v2 08/16] reorganize indexing of multipart/signed and\r
28  multipart/encrypted\r
29 Date: Tue, 19 Jan 2016 21:52:41 -0500\r
30 Message-Id: <1453258369-7366-9-git-send-email-dkg@fifthhorseman.net>\r
31 X-Mailer: git-send-email 2.7.0.rc3\r
32 In-Reply-To: <1453258369-7366-1-git-send-email-dkg@fifthhorseman.net>\r
33 References: <1453258369-7366-1-git-send-email-dkg@fifthhorseman.net>\r
34 X-BeenThere: notmuch@notmuchmail.org\r
35 X-Mailman-Version: 2.1.20\r
36 Precedence: list\r
37 List-Id: "Use and development of the notmuch mail system."\r
38  <notmuch.notmuchmail.org>\r
39 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
40  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
42 List-Post: <mailto:notmuch@notmuchmail.org>\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
44 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
45  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
46 X-List-Received-Date: Wed, 20 Jan 2016 02:53:23 -0000\r
47 \r
48 This prepares the codebase for a cleaner changeset for dealing with\r
49 indexing some encrypted messages in the clear.\r
50 ---\r
51  lib/index.cc | 39 +++++++++++++++++++--------------------\r
52  1 file changed, 19 insertions(+), 20 deletions(-)\r
53 \r
54 diff --git a/lib/index.cc b/lib/index.cc\r
55 index f166aef..ab0fd78 100644\r
56 --- a/lib/index.cc\r
57 +++ b/lib/index.cc\r
58 @@ -333,27 +333,26 @@ _index_mime_part (notmuch_message_t *message,\r
59         GMimeMultipart *multipart = GMIME_MULTIPART (part);\r
60         int i;\r
61  \r
62 -       if (GMIME_IS_MULTIPART_SIGNED (multipart))\r
63 -         _notmuch_message_add_term (message, "tag", "signed");\r
64 -\r
65 -       if (GMIME_IS_MULTIPART_ENCRYPTED (multipart))\r
66 -         _notmuch_message_add_term (message, "tag", "encrypted");\r
67 -\r
68 -       for (i = 0; i < g_mime_multipart_get_count (multipart); i++) {\r
69 -           if (GMIME_IS_MULTIPART_SIGNED (multipart)) {\r
70 -               /* Don't index the signature. */\r
71 -               if (i == 1)\r
72 -                   continue;\r
73 -               if (i > 1)\r
74 -                   _notmuch_database_log (_notmuch_message_database (message),\r
75 -                                         "Warning: Unexpected extra parts of multipart/signed. Indexing anyway.\n");\r
76 -           }\r
77 -           if (GMIME_IS_MULTIPART_ENCRYPTED (multipart)) {\r
78 -               /* Don't index encrypted parts. */\r
79 -               continue;\r
80 -           }\r
81 +       if (GMIME_IS_MULTIPART_SIGNED (multipart)) {\r
82 +           _notmuch_message_add_term (message, "tag", "signed");\r
83 +           /* FIXME: should we try to validate the signature? */\r
84 +           \r
85 +           /* FIXME: is it always just the first part that is signed in\r
86 +            all multipart/signed messages?*/\r
87             _index_mime_part (message,\r
88 -                             g_mime_multipart_get_part (multipart, i));\r
89 +                             g_mime_multipart_get_part (multipart, 0));\r
90 +           \r
91 +           if (g_mime_multipart_get_count (multipart) > 2)\r
92 +               _notmuch_database_log (_notmuch_message_database (message),\r
93 +                                      "Warning: Unexpected extra parts of multipart/signed. Indexing anyway.\n");\r
94 +       } else if (GMIME_IS_MULTIPART_ENCRYPTED (multipart)) {\r
95 +           /* Don't index encrypted parts */\r
96 +           _notmuch_message_add_term (message, "tag", "encrypted");\r
97 +       } else {\r
98 +           for (i = 0; i < g_mime_multipart_get_count (multipart); i++) {\r
99 +               _index_mime_part (message,\r
100 +                                 g_mime_multipart_get_part (multipart, i));\r
101 +           }\r
102         }\r
103         return;\r
104      }\r
105 -- \r
106 2.7.0.rc3\r
107 \r