<<< Date Index >>>     <<< Thread Index >>>

[PATCH] crypt-gpgme: actually init gpgme



# HG changeset patch
# User Roman Kagan <rkagan@xxxxxxx>
# Date 1290506473 -10800
# Node ID 938f0706311a6ab599d29d35447f0c70972fe7cf
# Parent  01731fb1884ea0e1eaf9008ea9c70804b66f2363
crypt-gpgme: actually init gpgme

Recent versions of gpgme (at least the one packaged with Fedora 14,
gpgme-1.2.0), requires proper initialization of the library before use.

The initialization is done via gpgme_check_version(), and gpgme_set_locale() is
recommended right afterwards, too (see gpgme manual for details).

Otherwise gpgme_init() fails with "Not operational" error, which makes mutt
immediately quit.

diff --git a/crypt-gpgme.c b/crypt-gpgme.c
--- a/crypt-gpgme.c
+++ b/crypt-gpgme.c
@@ -4191,6 +4191,12 @@
       if (mutt_any_key_to_continue (NULL) == -1)
        mutt_exit(1);
     }
+
+  gpgme_check_version (NULL);
+  gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
+#ifdef LC_MESSAGES
+  gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL));
+#endif
 }
 
 void pgp_gpgme_init (void)