--- /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 D05306DE0952\r
+ for <notmuch@notmuchmail.org>; Fri, 8 Jul 2016 03:13:39 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.09\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.09 tagged_above=-999 required=5 tests=[AWL=0.090]\r
+ 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 Cyatvs2H0w6s for <notmuch@notmuchmail.org>;\r
+ Fri, 8 Jul 2016 03:13:32 -0700 (PDT)\r
+Received: from che.mayfirst.org (che.mayfirst.org [162.247.75.118])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 9180F6DE02AD\r
+ for <notmuch@notmuchmail.org>; Fri, 8 Jul 2016 03:13:09 -0700 (PDT)\r
+Received: from fifthhorseman.net (unknown [88.128.80.54])\r
+ by che.mayfirst.org (Postfix) with ESMTPSA id 4C751F99C\r
+ for <notmuch@notmuchmail.org>; Fri, 8 Jul 2016 06:13:06 -0400 (EDT)\r
+Received: by fifthhorseman.net (Postfix, from userid 1000)\r
+ id B3CBB214AE; Fri, 8 Jul 2016 11:27:34 +0200 (CEST)\r
+From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH v4 10/16] Add n_d_add_message_with_indexopts (extension of\r
+ n_d_add_message)\r
+Date: Fri, 8 Jul 2016 11:27:21 +0200\r
+Message-Id: <1467970047-8013-11-git-send-email-dkg@fifthhorseman.net>\r
+X-Mailer: git-send-email 2.8.1\r
+In-Reply-To: <1467970047-8013-1-git-send-email-dkg@fifthhorseman.net>\r
+References: <1467970047-8013-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: Fri, 08 Jul 2016 10:13:39 -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 4e01f12..92507b8 100644\r
+--- a/lib/database.cc\r
++++ b/lib/database.cc\r
+@@ -2417,16 +2417,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
+@@ -2576,6 +2576,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 b92d969..66b3503 100644\r
+--- a/lib/notmuch.h\r
++++ b/lib/notmuch.h\r
+@@ -605,6 +605,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.8.1\r
+\r