Applying patches directly from emails?
[notmuch-archives.git] / e7 / 4c5af0ac325526779e7a71e3d25387e45e6807
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 D05306DE0952\r
6  for <notmuch@notmuchmail.org>; Fri,  8 Jul 2016 03:13:39 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.09\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.09 tagged_above=-999 required=5 tests=[AWL=0.090]\r
12  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 Cyatvs2H0w6s for <notmuch@notmuchmail.org>;\r
16  Fri,  8 Jul 2016 03:13:32 -0700 (PDT)\r
17 Received: from che.mayfirst.org (che.mayfirst.org [162.247.75.118])\r
18  by arlo.cworth.org (Postfix) with ESMTP id 9180F6DE02AD\r
19  for <notmuch@notmuchmail.org>; Fri,  8 Jul 2016 03:13:09 -0700 (PDT)\r
20 Received: from fifthhorseman.net (unknown [88.128.80.54])\r
21  by che.mayfirst.org (Postfix) with ESMTPSA id 4C751F99C\r
22  for <notmuch@notmuchmail.org>; Fri,  8 Jul 2016 06:13:06 -0400 (EDT)\r
23 Received: by fifthhorseman.net (Postfix, from userid 1000)\r
24  id B3CBB214AE; Fri,  8 Jul 2016 11:27:34 +0200 (CEST)\r
25 From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
26 To: Notmuch Mail <notmuch@notmuchmail.org>\r
27 Subject: [PATCH v4 10/16] Add n_d_add_message_with_indexopts (extension of\r
28  n_d_add_message)\r
29 Date: Fri,  8 Jul 2016 11:27:21 +0200\r
30 Message-Id: <1467970047-8013-11-git-send-email-dkg@fifthhorseman.net>\r
31 X-Mailer: git-send-email 2.8.1\r
32 In-Reply-To: <1467970047-8013-1-git-send-email-dkg@fifthhorseman.net>\r
33 References: <1467970047-8013-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: Fri, 08 Jul 2016 10:13:39 -0000\r
47 \r
48 Expose the ability to ask for index options via the library interface.\r
49 This _add_message_with_indexopts function is now a generalized form of\r
50 the older _add_message.  It lets you specify parameters and\r
51 configurations that can affect the indexing, like indexing encrypted\r
52 messages in the clear should the user choose to do so.\r
53 \r
54 We also adjust the tests so that we test the extended function\r
55 returning bad values (since the non-extended function just calls the\r
56 extended one).\r
57 ---\r
58  lib/database.cc     | 20 ++++++++++++++++----\r
59  lib/notmuch.h       | 14 ++++++++++++++\r
60  test/T070-insert.sh |  4 ++--\r
61  3 files changed, 32 insertions(+), 6 deletions(-)\r
62 \r
63 diff --git a/lib/database.cc b/lib/database.cc\r
64 index 4e01f12..92507b8 100644\r
65 --- a/lib/database.cc\r
66 +++ b/lib/database.cc\r
67 @@ -2417,16 +2417,16 @@ _notmuch_database_link_message (notmuch_database_t *notmuch,\r
68  }\r
69  \r
70  notmuch_status_t\r
71 -notmuch_database_add_message (notmuch_database_t *notmuch,\r
72 -                             const char *filename,\r
73 -                             notmuch_message_t **message_ret)\r
74 +notmuch_database_add_message_with_indexopts (notmuch_database_t *notmuch,\r
75 +                                            const char *filename,\r
76 +                                            notmuch_indexopts_t *indexopts,\r
77 +                                            notmuch_message_t **message_ret)\r
78  {\r
79      notmuch_message_file_t *message_file;\r
80      notmuch_message_t *message = NULL;\r
81      notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS, ret2;\r
82      notmuch_private_status_t private_status;\r
83      notmuch_bool_t is_ghost = false;\r
84 -    notmuch_indexopts_t *indexopts = NULL;\r
85  \r
86      const char *date, *header;\r
87      const char *from, *to, *subject;\r
88 @@ -2576,6 +2576,18 @@ notmuch_database_add_message (notmuch_database_t *notmuch,\r
89      return ret;\r
90  }\r
91  \r
92 +\r
93 +notmuch_status_t\r
94 +notmuch_database_add_message (notmuch_database_t *notmuch,\r
95 +                             const char *filename,\r
96 +                             notmuch_message_t **message_ret)\r
97 +{\r
98 +    return notmuch_database_add_message_with_indexopts (notmuch, filename,\r
99 +                                                       NULL,\r
100 +                                                       message_ret);\r
101 +    \r
102 +}\r
103 +\r
104  notmuch_status_t\r
105  notmuch_database_remove_message (notmuch_database_t *notmuch,\r
106                                  const char *filename)\r
107 diff --git a/lib/notmuch.h b/lib/notmuch.h\r
108 index b92d969..66b3503 100644\r
109 --- a/lib/notmuch.h\r
110 +++ b/lib/notmuch.h\r
111 @@ -605,6 +605,20 @@ notmuch_status_t\r
112  notmuch_database_add_message (notmuch_database_t *database,\r
113                               const char *filename,\r
114                               notmuch_message_t **message);\r
115 +/**\r
116 + * Add a new message to the given notmuch database or associate an\r
117 + * additional filename with an existing message using specified\r
118 + * options.\r
119 + *\r
120 + * This does the same thing as notmuch_database_add_message except\r
121 + * that it passes a pre-configured set of indexing options to indicate\r
122 + * how the specific message should be indexed.\r
123 + */\r
124 +notmuch_status_t\r
125 +notmuch_database_add_message_with_indexopts (notmuch_database_t *database,\r
126 +                                            const char *filename,\r
127 +                                            notmuch_indexopts_t *indexopts,\r
128 +                                            notmuch_message_t **message);\r
129  \r
130  /**\r
131   * Remove a message filename from the given notmuch database. If the\r
132 diff --git a/test/T070-insert.sh b/test/T070-insert.sh\r
133 index e7ec6a6..557f9d5 100755\r
134 --- a/test/T070-insert.sh\r
135 +++ b/test/T070-insert.sh\r
136 @@ -192,14 +192,14 @@ for code in OUT_OF_MEMORY XAPIAN_EXCEPTION FILE_NOT_EMAIL \\r
137  gen_insert_msg\r
138  cat <<EOF > index-file-$code.gdb\r
139  set breakpoint pending on\r
140 -break notmuch_database_add_message\r
141 +break notmuch_database_add_message_with_indexopts\r
142  commands\r
143  return NOTMUCH_STATUS_$code\r
144  continue\r
145  end\r
146  run\r
147  EOF\r
148 -test_begin_subtest "error exit when add_message returns $code"\r
149 +test_begin_subtest "error exit when add_message_with_indexopts returns $code"\r
150  gdb --batch-silent --return-child-result -x index-file-$code.gdb \\r
151      --args notmuch insert  < $gen_msg_filename\r
152  test_expect_equal $? 1\r
153 -- \r
154 2.8.1\r
155 \r