Re: [PATCH 2/9] Add a lazily-initialized crypto context to notmuch_database_t
authorTomi Ollila <tomi.ollila@iki.fi>
Fri, 11 Dec 2015 21:55:16 +0000 (23:55 +0200)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:50:10 +0000 (14:50 -0700)
7a/38af445ab2aa07d1afd4e98a23601d7be62b79 [new file with mode: 0644]

diff --git a/7a/38af445ab2aa07d1afd4e98a23601d7be62b79 b/7a/38af445ab2aa07d1afd4e98a23601d7be62b79
new file mode 100644 (file)
index 0000000..03f0217
--- /dev/null
@@ -0,0 +1,115 @@
+Return-Path: <tomi.ollila@iki.fi>\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 A4CF76DE0B4B\r
+ for <notmuch@notmuchmail.org>; Fri, 11 Dec 2015 13:55:07 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.702\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.702 tagged_above=-999 required=5 tests=[AWL=0.050, \r
+ SPF_NEUTRAL=0.652] 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 uvIqJFasg67v for <notmuch@notmuchmail.org>;\r
+ Fri, 11 Dec 2015 13:55:05 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 824E96DE005F\r
+ for <notmuch@notmuchmail.org>; Fri, 11 Dec 2015 13:55:05 -0800 (PST)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id 2A0F6100090;\r
+ Fri, 11 Dec 2015 23:55:16 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Daniel Kahn Gillmor <dkg@fifthhorseman.net>,\r
+ Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: Re: [PATCH 2/9] Add a lazily-initialized crypto context to\r
+ notmuch_database_t\r
+In-Reply-To: <1449718786-28000-3-git-send-email-dkg@fifthhorseman.net>\r
+References: <1449718786-28000-1-git-send-email-dkg@fifthhorseman.net>\r
+ <1449718786-28000-3-git-send-email-dkg@fifthhorseman.net>\r
+User-Agent: Notmuch/0.21+32~g73439f8 (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Fri, 11 Dec 2015 23:55:16 +0200\r
+Message-ID: <m27fkk7irf.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\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, 11 Dec 2015 21:55:07 -0000\r
+\r
+On Thu, Dec 10 2015, Daniel Kahn Gillmor <dkg@fifthhorseman.net> wrote:\r
+\r
+> This is in large part a duplicate of parts of crypto.c, but that code\r
+> is in the client (outside the library), and we don't want to entangle\r
+> the libgmime API with the libnotmuch API.\r
+>\r
+> I welcome better proposals for how to share this code explicitly\r
+> between the library and the client.\r
+> ---\r
+>  lib/database-private.h |  1 +\r
+>  lib/database.cc        | 42 ++++++++++++++++++++++++++++++++++++++++++\r
+>  lib/notmuch-private.h  |  8 ++++++++\r
+>  3 files changed, 51 insertions(+)\r
+>\r
+> diff --git a/lib/database-private.h b/lib/database-private.h\r
+> index 3fb10f7..1bf76c5 100644\r
+> --- a/lib/database-private.h\r
+> +++ b/lib/database-private.h\r
+> @@ -171,6 +171,7 @@ struct _notmuch_database {\r
+>       * notmuch_database_new_revision. */\r
+>      unsigned long revision;\r
+>      const char *uuid;\r
+> +    GMimeCryptoContext *gpg_crypto_ctx;\r
+>  \r
+>      Xapian::QueryParser *query_parser;\r
+>      Xapian::TermGenerator *term_gen;\r
+> diff --git a/lib/database.cc b/lib/database.cc\r
+> index 3b342f1..13b0bad 100644\r
+> --- a/lib/database.cc\r
+> +++ b/lib/database.cc\r
+> @@ -995,6 +995,8 @@ notmuch_database_open_verbose (const char *path,\r
+>      notmuch->uuid = talloc_strdup (\r
+>          notmuch, notmuch->xapian_db->get_uuid ().c_str ());\r
+>  \r
+> +    notmuch->gpg_crypto_ctx = NULL;\r
+> +    \r
+>      notmuch->query_parser = new Xapian::QueryParser;\r
+>      notmuch->term_gen = new Xapian::TermGenerator;\r
+>      notmuch->term_gen->set_stemmer (Xapian::Stem ("english"));\r
+> @@ -1090,6 +1092,11 @@ notmuch_database_close (notmuch_database_t *notmuch)\r
+>      delete notmuch->last_mod_range_processor;\r
+>      notmuch->last_mod_range_processor = NULL;\r
+>  \r
+> +    if (notmuch->gpg_crypto_ctx) {\r
+> +    g_object_unref (notmuch->gpg_crypto_ctx);\r
+> +    notmuch->gpg_crypto_ctx = NULL;\r
+> +    }\r
+> +    \r
+>      return status;\r
+>  }\r
+>  \r
+> @@ -2386,6 +2393,41 @@ _notmuch_database_link_message (notmuch_database_t *notmuch,\r
+>      return status;\r
+>  }\r
+>  \r
+> +notmuch_private_status_t\r
+> +_notmuch_database_get_crypto_for_protocol (notmuch_database_t *notmuch,\r
+> +                                       const char *protocol,\r
+> +                                       GMimeCryptoContext **crypto_ctx)\r
+\r
+^^^^ static function ^^^\r
+\r