2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2003 Hiroyuki Yamamoto & the Sylpheed-Claws team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 #include "prefs_common.h"
33 #include "alertpanel.h"
34 #include "passphrase.h"
37 static void idle_function_for_gpgme(void)
39 while (gtk_events_pending())
43 static void sgpgme_disable_all(void)
45 /* FIXME: set a flag, so that we don't bother the user with failed
49 GpgmeSigStat sgpgme_verify_signature(GpgmeCtx ctx, GpgmeData sig,
54 if (gpgme_op_verify(ctx, sig, plain, &status) != GPGME_No_Error)
55 return GPGME_SIG_STAT_ERROR;
60 SignatureStatus sgpgme_sigstat_gpgme_to_privacy(GpgmeSigStat status)
63 case GPGME_SIG_STAT_GOOD:
65 case GPGME_SIG_STAT_GOOD_EXP:
66 case GPGME_SIG_STAT_GOOD_EXPKEY:
67 case GPGME_SIG_STAT_DIFF:
68 return SIGNATURE_WARN;
69 case GPGME_SIG_STAT_BAD:
70 return SIGNATURE_INVALID;
71 case GPGME_SIG_STAT_NOKEY:
72 case GPGME_SIG_STAT_NOSIG:
73 case GPGME_SIG_STAT_ERROR:
74 return SIGNATURE_CHECK_FAILED;
75 case GPGME_SIG_STAT_NONE:
76 return SIGNATURE_UNCHECKED;
78 return SIGNATURE_CHECK_FAILED;
83 if (gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP) !=
84 GPGME_No_Error) { /* Also does some gpgme init */
86 debug_print("gpgme_engine_version:\n%s\n",
87 gpgme_get_engine_info());
89 if (prefs_common.gpg_warning) {
92 val = alertpanel_message_with_disable
94 _("GnuPG is not installed properly, or needs to be upgraded.\n"
95 "OpenPGP support disabled."));
96 if (val & G_ALERTDISABLE)
97 prefs_common.gpg_warning = FALSE;
101 gpgme_register_idle(idle_function_for_gpgme);
106 gpgmegtk_free_passphrase();
109 #endif /* USE_GPGME */