database error
[notmuch-archives.git] / f8 / f131a14438f10bda4665563092536a8f005ba0
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 2A4796DE1601\r
6  for <notmuch@notmuchmail.org>; Wed,  9 Dec 2015 19:40:12 -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.034\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.034 tagged_above=-999 required=5\r
12  tests=[AWL=-0.034] 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 y4EAL1bUZIj0 for <notmuch@notmuchmail.org>;\r
16  Wed,  9 Dec 2015 19:40:10 -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 9FE736DE1737\r
19  for <notmuch@notmuchmail.org>; Wed,  9 Dec 2015 19:40:05 -0800 (PST)\r
20 Received: from fifthhorseman.net (unknown [38.109.115.130])\r
21  by che.mayfirst.org (Postfix) with ESMTPSA id 68F42F98B\r
22  for <notmuch@notmuchmail.org>; Wed,  9 Dec 2015 22:40:04 -0500 (EST)\r
23 Received: by fifthhorseman.net (Postfix, from userid 1000)\r
24  id A0BB91FEDC; Wed,  9 Dec 2015 22:40:03 -0500 (EST)\r
25 From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
26 To: Notmuch Mail <notmuch@notmuchmail.org>\r
27 Subject: [PATCH 1/9] reorganize indexing of multipart/signed and\r
28  multipart/encrypted\r
29 Date: Wed,  9 Dec 2015 22:39:38 -0500\r
30 Message-Id: <1449718786-28000-2-git-send-email-dkg@fifthhorseman.net>\r
31 X-Mailer: git-send-email 2.6.2\r
32 In-Reply-To: <1449718786-28000-1-git-send-email-dkg@fifthhorseman.net>\r
33 References: <1449718786-28000-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: Thu, 10 Dec 2015 03:40:12 -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 | 38 ++++++++++++++++++--------------------\r
52  1 file changed, 18 insertions(+), 20 deletions(-)\r
53 \r
54 diff --git a/lib/index.cc b/lib/index.cc\r
55 index f166aef..2fa6616 100644\r
56 --- a/lib/index.cc\r
57 +++ b/lib/index.cc\r
58 @@ -333,27 +333,25 @@ _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 +       } else {\r
97 +           for (i = 0; i < g_mime_multipart_get_count (multipart); i++) {\r
98 +               _index_mime_part (message,\r
99 +                                 g_mime_multipart_get_part (multipart, i));\r
100 +           }\r
101         }\r
102         return;\r
103      }\r
104 -- \r
105 2.6.2\r
106 \r