--- /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 A2A536DE1B43\r
+ for <notmuch@notmuchmail.org>; Sun, 31 Jan 2016 12:40:17 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\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 zc9c-uLr8hqw for <notmuch@notmuchmail.org>;\r
+ Sun, 31 Jan 2016 12:40:15 -0800 (PST)\r
+Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 730CE6DE19DE\r
+ for <notmuch@notmuchmail.org>; Sun, 31 Jan 2016 12:40:09 -0800 (PST)\r
+Received: from fifthhorseman.net (ip-64-134-185-108.public.wayport.net\r
+ [64.134.185.108])\r
+ by che.mayfirst.org (Postfix) with ESMTPSA id 57D5DF99B\r
+ for <notmuch@notmuchmail.org>; Sun, 31 Jan 2016 15:40:06 -0500 (EST)\r
+Received: by fifthhorseman.net (Postfix, from userid 1000)\r
+ id 4654620E96; Sun, 31 Jan 2016 15:40:06 -0500 (EST)\r
+From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH v3 07/16] create a notmuch_indexopts_t index options object\r
+Date: Sun, 31 Jan 2016 15:39:52 -0500\r
+Message-Id: <1454272801-23623-8-git-send-email-dkg@fifthhorseman.net>\r
+X-Mailer: git-send-email 2.7.0.rc3\r
+In-Reply-To: <1454272801-23623-1-git-send-email-dkg@fifthhorseman.net>\r
+References: <1454272801-23623-1-git-send-email-dkg@fifthhorseman.net>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=UTF-8\r
+Content-Transfer-Encoding: 8bit\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: Sun, 31 Jan 2016 20:40:17 -0000\r
+\r
+This is currently mostly a wrapper around _notmuch_crypto_t that keeps\r
+its internals private and doesn't expose any of the GMime API.\r
+However, non-crypto indexing options might also be added later to\r
+indexopts (e.g. filters or other transformations).\r
+---\r
+ lib/Makefile.local | 1 +\r
+ lib/indexopts.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++\r
+ lib/notmuch-private.h | 7 +++++\r
+ lib/notmuch.h | 63 ++++++++++++++++++++++++++++++++++++++++++++\r
+ 4 files changed, 143 insertions(+)\r
+ create mode 100644 lib/indexopts.c\r
+\r
+diff --git a/lib/Makefile.local b/lib/Makefile.local\r
+index 3a07090..1652b1b 100644\r
+--- a/lib/Makefile.local\r
++++ b/lib/Makefile.local\r
+@@ -39,6 +39,7 @@ libnotmuch_c_srcs = \\r
+ $(dir)/message-file.c \\r
+ $(dir)/messages.c \\r
+ $(dir)/sha1.c \\r
++ $(dir)/indexopts.c \\r
+ $(dir)/tags.c\r
+ \r
+ libnotmuch_cxx_srcs = \\r
+diff --git a/lib/indexopts.c b/lib/indexopts.c\r
+new file mode 100644\r
+index 0000000..da36e2b\r
+--- /dev/null\r
++++ b/lib/indexopts.c\r
+@@ -0,0 +1,72 @@\r
++/* indexopts.c - options for indexing messages\r
++ *\r
++ * Copyright © 2015 Daniel Kahn Gillmor\r
++ *\r
++ * This program is free software: you can redistribute it and/or modify\r
++ * it under the terms of the GNU General Public License as published by\r
++ * the Free Software Foundation, either version 3 of the License, or\r
++ * (at your option) any later version.\r
++ *\r
++ * This program is distributed in the hope that it will be useful,\r
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
++ * GNU General Public License for more details.\r
++ *\r
++ * You should have received a copy of the GNU General Public License\r
++ * along with this program. If not, see http://www.gnu.org/licenses/ .\r
++ *\r
++ * Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
++ */\r
++\r
++#include "notmuch-private.h"\r
++\r
++notmuch_indexopts_t *\r
++notmuch_indexopts_create ()\r
++{\r
++ notmuch_indexopts_t *ret;\r
++ \r
++ ret = talloc_zero (NULL, notmuch_indexopts_t);\r
++\r
++ return ret;\r
++}\r
++\r
++notmuch_status_t\r
++notmuch_indexopts_set_try_decrypt (notmuch_indexopts_t *indexopts,\r
++ notmuch_bool_t try_decrypt)\r
++{\r
++ if (!indexopts)\r
++ return NOTMUCH_STATUS_NULL_POINTER;\r
++ indexopts->crypto.decrypt = try_decrypt;\r
++ return NOTMUCH_STATUS_SUCCESS;\r
++}\r
++\r
++notmuch_bool_t\r
++notmuch_indexopts_get_try_decrypt (const notmuch_indexopts_t *indexopts)\r
++{\r
++ if (!indexopts)\r
++ return FALSE;\r
++ return indexopts->crypto.decrypt;\r
++}\r
++\r
++notmuch_status_t\r
++notmuch_indexopts_set_gpg_path (notmuch_indexopts_t *indexopts,\r
++ const char *gpg_path)\r
++{\r
++ if (!indexopts)\r
++ return NOTMUCH_STATUS_NULL_POINTER;\r
++ return _notmuch_crypto_set_gpg_path (&(indexopts->crypto), gpg_path);\r
++}\r
++\r
++const char*\r
++notmuch_indexopts_get_gpg_path (const notmuch_indexopts_t *indexopts)\r
++{\r
++ if (!indexopts)\r
++ return NULL;\r
++ return _notmuch_crypto_get_gpg_path (&(indexopts->crypto));\r
++}\r
++\r
++void\r
++notmuch_indexopts_destroy (notmuch_indexopts_t *indexopts)\r
++{\r
++ talloc_free (indexopts);\r
++}\r
+diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h\r
+index 5dd4770..e9c1e8a 100644\r
+--- a/lib/notmuch-private.h\r
++++ b/lib/notmuch-private.h\r
+@@ -51,6 +51,7 @@ NOTMUCH_BEGIN_DECLS\r
+ #include "xutil.h"\r
+ #include "error_util.h"\r
+ #include "string-util.h"\r
++#include "crypto.h"\r
+ \r
+ #pragma GCC visibility push(hidden)\r
+ \r
+@@ -544,6 +545,12 @@ _notmuch_thread_create (void *ctx,\r
+ notmuch_exclude_t omit_exclude,\r
+ notmuch_sort_t sort);\r
+ \r
++/* indexopts.c */\r
++\r
++typedef struct _notmuch_indexopts {\r
++ _notmuch_crypto_t crypto;\r
++} notmuch_indexopts_t;\r
++\r
+ NOTMUCH_END_DECLS\r
+ \r
+ #ifdef __cplusplus\r
+diff --git a/lib/notmuch.h b/lib/notmuch.h\r
+index 00002f1..3679c54 100644\r
+--- a/lib/notmuch.h\r
++++ b/lib/notmuch.h\r
+@@ -214,6 +214,7 @@ typedef struct _notmuch_message notmuch_message_t;\r
+ typedef struct _notmuch_tags notmuch_tags_t;\r
+ typedef struct _notmuch_directory notmuch_directory_t;\r
+ typedef struct _notmuch_filenames notmuch_filenames_t;\r
++typedef struct _notmuch_indexopts notmuch_indexopts_t;\r
+ #endif /* __DOXYGEN__ */\r
+ \r
+ /**\r
+@@ -1846,6 +1847,68 @@ notmuch_filenames_move_to_next (notmuch_filenames_t *filenames);\r
+ void\r
+ notmuch_filenames_destroy (notmuch_filenames_t *filenames);\r
+ \r
++/**\r
++ * Create a notmuch_indexopts_t object.\r
++ *\r
++ * This object describes options on how indexing can happen when a\r
++ * message is added to the index.\r
++ */\r
++notmuch_indexopts_t *\r
++notmuch_indexopts_create ();\r
++\r
++/**\r
++ * Specify whether to decrypt encrypted parts while indexing.\r
++ * \r
++ * Be aware that the index is likely sufficient to reconstruct the\r
++ * cleartext of the message itself, so please ensure that the notmuch\r
++ * message index is adequately protected. DO NOT SET THIS FLAG TO TRUE\r
++ * without considering the security of your index.\r
++ *\r
++ */\r
++notmuch_status_t\r
++notmuch_indexopts_set_try_decrypt (notmuch_indexopts_t *indexopts,\r
++ notmuch_bool_t try_decrypt);\r
++\r
++/**\r
++ * Return whether to decrypt encrypted parts while indexing.\r
++ * see notmuch_indexopts_set_try_decrypt.\r
++ */\r
++notmuch_bool_t\r
++notmuch_indexopts_get_try_decrypt (const notmuch_indexopts_t *indexopts);\r
++\r
++/**\r
++ * Specify the name (or name and path) of the gpg executable, in case\r
++ * GnuPG needs to be used during indexing. The default should usually\r
++ * be fine.\r
++ * \r
++ * Passing NULL to this will reset it to the default.\r
++ * \r
++ * Return value:\r
++ *\r
++ * NOTMUCH_STATUS_SUCCESS: the path was accepted and will be used.\r
++ * \r
++ * NOTMUCH_STATUS_FILE_ERROR: the path given either wasn't found or\r
++ * wasn't executable.\r
++ */\r
++notmuch_status_t\r
++notmuch_indexopts_set_gpg_path (notmuch_indexopts_t *indexopts,\r
++ const char *gpg_path);\r
++\r
++/**\r
++ * Return the name (possibly including path) of the gpg executable to\r
++ * be used in case GnuPG needs to be used during indexing.\r
++ * \r
++ * see notmuch_indexopts_set_gpg_path\r
++ */\r
++const char*\r
++notmuch_indexopts_get_gpg_path (const notmuch_indexopts_t *indexopts);\r
++\r
++/**\r
++ * Destroy a notmuch_indexopts_t object.\r
++ */\r
++void\r
++notmuch_indexopts_destroy (notmuch_indexopts_t *options);\r
++\r
+ /* @} */\r
+ \r
+ NOTMUCH_END_DECLS\r
+-- \r
+2.7.0.rc3\r
+\r