From e4c7294c676fc420f9034735b15a1a1cf61a1792 Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Sun, 7 Jul 2019 14:37:52 -0700 Subject: [PATCH] Start autocrypt gpgme Add a basic init function. Bump up the required gpgme version to 1.8.0 if autocrypt is enabled. Co-authored-by: Richard Russon --- Makefile.autosetup | 1 + autocrypt/autocrypt.c | 10 +++------- autocrypt/autocrypt_gpgme.c | 33 +++++++++++++++++++++++++++++++++ autocrypt/autocrypt_private.h | 2 ++ 4 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 autocrypt/autocrypt_gpgme.c diff --git a/Makefile.autosetup b/Makefile.autosetup index f3ade9630..b33cda8c8 100644 --- a/Makefile.autosetup +++ b/Makefile.autosetup @@ -98,6 +98,7 @@ ALLOBJS+= $(NEOMUTTOBJS) LIBAUTOCRYPT= libautocrypt.a LIBAUTOCRYPTOBJS= autocrypt/autocrypt.o \ autocrypt/autocrypt_db.o \ + autocrypt/autocrypt_gpgme.o \ autocrypt/autocrypt_schema.o CLEANFILES+= $(LIBAUTOCRYPT) $(LIBAUTOCRYPTOBJS) MUTTLIBS+= $(LIBAUTOCRYPT) diff --git a/autocrypt/autocrypt.c b/autocrypt/autocrypt.c index fa8ff9187..d9f3b99be 100644 --- a/autocrypt/autocrypt.c +++ b/autocrypt/autocrypt.c @@ -70,15 +70,12 @@ int mutt_autocrypt_init(int can_create) if (autocrypt_dir_init(can_create)) goto bail; + if (mutt_autocrypt_gpgme_init()) + goto bail; + if (mutt_autocrypt_db_init(can_create)) goto bail; - /* mutt_autocrypt_gpgme_init() - * - init gpgme - * - create key if doesn't exist - * - perhaps should query account table and if empty do that? - */ - mutt_debug(LL_DEBUG1, "In mutt_autocrypt_init()\n"); return 0; bail: @@ -90,5 +87,4 @@ bail: void mutt_autocrypt_cleanup(void) { mutt_autocrypt_db_close(); - mutt_debug(LL_DEBUG1, "In mutt_autocrypt_cleanup()\n"); } diff --git a/autocrypt/autocrypt_gpgme.c b/autocrypt/autocrypt_gpgme.c new file mode 100644 index 000000000..e9381da94 --- /dev/null +++ b/autocrypt/autocrypt_gpgme.c @@ -0,0 +1,33 @@ +/** + * @file + * XXX + * + * @authors + * Copyright (C) 2019 Kevin J. McCarthy + * + * @copyright + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#include "config.h" +#include "autocrypt_private.h" +#include "mutt.h" +#include "autocrypt.h" +#include "ncrypt/crypt_gpgme.h" + +int mutt_autocrypt_gpgme_init(void) +{ + pgp_gpgme_init(); + return 0; +} diff --git a/autocrypt/autocrypt_private.h b/autocrypt/autocrypt_private.h index 56a45aa8b..f43a996a5 100644 --- a/autocrypt/autocrypt_private.h +++ b/autocrypt/autocrypt_private.h @@ -29,4 +29,6 @@ void mutt_autocrypt_db_close(void); int mutt_autocrypt_schema_init(void); int mutt_autocrypt_schema_update(void); +int mutt_autocrypt_gpgme_init(void); + #endif /* MUTT_AUTOCRYPT_AUTOCRYPT_PRIVATE_H */ -- 2.40.0