--- /dev/null
+Return-Path: <dkg@fifthhorseman.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 470296DE1BB2\r
+ for <notmuch@notmuchmail.org>; Tue, 19 Jan 2016 18:53:29 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.023\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.023 tagged_above=-999 required=5\r
+ tests=[AWL=-0.023] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id cbVrmHriodYZ for <notmuch@notmuchmail.org>;\r
+ Tue, 19 Jan 2016 18:53:27 -0800 (PST)\r
+Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 671516DE1601\r
+ for <notmuch@notmuchmail.org>; Tue, 19 Jan 2016 18:53:16 -0800 (PST)\r
+Received: from fifthhorseman.net (unknown [38.109.115.130])\r
+ by che.mayfirst.org (Postfix) with ESMTPSA id CD2E9F991\r
+ for <notmuch@notmuchmail.org>; Tue, 19 Jan 2016 21:53:13 -0500 (EST)\r
+Received: by fifthhorseman.net (Postfix, from userid 1000)\r
+ id F0CA1207E3; Tue, 19 Jan 2016 18:53:10 -0800 (PST)\r
+From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH v2 10/16] Add n_d_add_message_with_indexopts (extension of\r
+ n_d_add_message)\r
+Date: Tue, 19 Jan 2016 21:52:43 -0500\r
+Message-Id: <1453258369-7366-11-git-send-email-dkg@fifthhorseman.net>\r
+X-Mailer: git-send-email 2.7.0.rc3\r
+In-Reply-To: <1453258369-7366-1-git-send-email-dkg@fifthhorseman.net>\r
+References: <1453258369-7366-1-git-send-email-dkg@fifthhorseman.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 20 Jan 2016 02:53:29 -0000\r
+\r
+Expose the ability to ask for index options via the library interface.\r
+This _add_message_with_indexopts function is now a generalized form of\r
+the older _add_message. It lets you specify parameters and\r
+configurations that can affect the indexing, like indexing encrypted\r
+messages in the clear should the user choose to do so.\r
+\r
+We also adjust the tests so that we test the extended function\r
+returning bad values (since the non-extended function just calls the\r
+extended one).\r
+---\r
+ lib/database.cc | 20 ++++++++++++++++----\r
+ lib/notmuch.h | 14 ++++++++++++++\r
+ test/T070-insert.sh | 4 ++--\r
+ 3 files changed, 32 insertions(+), 6 deletions(-)\r
+\r
+diff --git a/lib/database.cc b/lib/database.cc\r
+index 7d88f69..990b0b1 100644\r
+--- a/lib/database.cc\r
++++ b/lib/database.cc\r
+@@ -2393,16 +2393,16 @@ _notmuch_database_link_message (notmuch_database_t *notmuch,\r
+ }\r
+ \r
+ notmuch_status_t\r
+-notmuch_database_add_message (notmuch_database_t *notmuch,\r
+- const char *filename,\r
+- notmuch_message_t **message_ret)\r
++notmuch_database_add_message_with_indexopts (notmuch_database_t *notmuch,\r
++ const char *filename,\r
++ notmuch_indexopts_t *indexopts,\r
++ notmuch_message_t **message_ret)\r
+ {\r
+ notmuch_message_file_t *message_file;\r
+ notmuch_message_t *message = NULL;\r
+ notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS, ret2;\r
+ notmuch_private_status_t private_status;\r
+ notmuch_bool_t is_ghost = false;\r
+- notmuch_indexopts_t *indexopts = NULL;\r
+ \r
+ const char *date, *header;\r
+ const char *from, *to, *subject;\r
+@@ -2552,6 +2552,18 @@ notmuch_database_add_message (notmuch_database_t *notmuch,\r
+ return ret;\r
+ }\r
+ \r
++\r
++notmuch_status_t\r
++notmuch_database_add_message (notmuch_database_t *notmuch,\r
++ const char *filename,\r
++ notmuch_message_t **message_ret)\r
++{\r
++ return notmuch_database_add_message_with_indexopts (notmuch, filename,\r
++ NULL,\r
++ message_ret);\r
++ \r
++}\r
++\r
+ notmuch_status_t\r
+ notmuch_database_remove_message (notmuch_database_t *notmuch,\r
+ const char *filename)\r
+diff --git a/lib/notmuch.h b/lib/notmuch.h\r
+index 3679c54..854a451 100644\r
+--- a/lib/notmuch.h\r
++++ b/lib/notmuch.h\r
+@@ -588,6 +588,20 @@ notmuch_status_t\r
+ notmuch_database_add_message (notmuch_database_t *database,\r
+ const char *filename,\r
+ notmuch_message_t **message);\r
++/**\r
++ * Add a new message to the given notmuch database or associate an\r
++ * additional filename with an existing message using specified\r
++ * options.\r
++ * \r
++ * This does the same thing as notmuch_database_add_message except\r
++ * that it passes a pre-configured set of indexing options to indicate\r
++ * how the specific message should be indexed.\r
++ */\r
++notmuch_status_t\r
++notmuch_database_add_message_with_indexopts (notmuch_database_t *database,\r
++ const char *filename,\r
++ notmuch_indexopts_t *indexopts,\r
++ notmuch_message_t **message);\r
+ \r
+ /**\r
+ * Remove a message filename from the given notmuch database. If the\r
+diff --git a/test/T070-insert.sh b/test/T070-insert.sh\r
+index e7ec6a6..557f9d5 100755\r
+--- a/test/T070-insert.sh\r
++++ b/test/T070-insert.sh\r
+@@ -192,14 +192,14 @@ for code in OUT_OF_MEMORY XAPIAN_EXCEPTION FILE_NOT_EMAIL \\r
+ gen_insert_msg\r
+ cat <<EOF > index-file-$code.gdb\r
+ set breakpoint pending on\r
+-break notmuch_database_add_message\r
++break notmuch_database_add_message_with_indexopts\r
+ commands\r
+ return NOTMUCH_STATUS_$code\r
+ continue\r
+ end\r
+ run\r
+ EOF\r
+-test_begin_subtest "error exit when add_message returns $code"\r
++test_begin_subtest "error exit when add_message_with_indexopts returns $code"\r
+ gdb --batch-silent --return-child-result -x index-file-$code.gdb \\r
+ --args notmuch insert < $gen_msg_filename\r
+ test_expect_equal $? 1\r
+-- \r
+2.7.0.rc3\r
+\r