aboutsummaryrefslogtreecommitdiffstats
path: root/mail/openpgp-utils.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-01-22 12:11:14 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-01-22 12:11:14 +0800
commitc223f52d1d70d9662b4110bdb6a5426213fd6a51 (patch)
treecee14acf38cac3bb3c01907aba8571d741b94f57 /mail/openpgp-utils.c
parent05601a3f73ccbe8671c17cda07391b066ae52761 (diff)
downloadgsoc2013-evolution-c223f52d1d70d9662b4110bdb6a5426213fd6a51.tar
gsoc2013-evolution-c223f52d1d70d9662b4110bdb6a5426213fd6a51.tar.gz
gsoc2013-evolution-c223f52d1d70d9662b4110bdb6a5426213fd6a51.tar.bz2
gsoc2013-evolution-c223f52d1d70d9662b4110bdb6a5426213fd6a51.tar.lz
gsoc2013-evolution-c223f52d1d70d9662b4110bdb6a5426213fd6a51.tar.xz
gsoc2013-evolution-c223f52d1d70d9662b4110bdb6a5426213fd6a51.tar.zst
gsoc2013-evolution-c223f52d1d70d9662b4110bdb6a5426213fd6a51.zip
Initialize OpenPGP.
2001-01-21 Jeffrey Stedfast <fejj@ximian.com> * component-factory.c (owner_set_cb): Initialize OpenPGP. * openpgp-utils.c (openpgp_init): No longer takes a passphrase callback, we'll just use the mail-session one. Makes life simpler. (pgp_get_passphrase): Use mail_session_request_dialog(). svn path=/trunk/; revision=7694
Diffstat (limited to 'mail/openpgp-utils.c')
-rw-r--r--mail/openpgp-utils.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/mail/openpgp-utils.c b/mail/openpgp-utils.c
index 290562d55a..43252a890a 100644
--- a/mail/openpgp-utils.c
+++ b/mail/openpgp-utils.c
@@ -28,6 +28,7 @@
#include <gnome.h> /* for _() macro */
#include "openpgp-utils.h"
+#include "mail-session.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -51,14 +52,12 @@
static const gchar *pgp_path = NULL;
static PgpType pgp_type = PGP_TYPE_NONE;
-static PgpPasswdFunc pgp_passwd_func = NULL;
-static gpointer pgp_data = NULL;
static gchar *
pgp_get_passphrase (const gchar *userid)
{
- gchar *passphrase, *prompt, *type;
+ gchar *passphrase, *prompt, *type = NULL;
switch (pgp_type) {
case PGP_TYPE_GPG:
@@ -71,17 +70,18 @@ pgp_get_passphrase (const gchar *userid)
type = "PGP2.x";
break;
default:
- type = "";
+ g_assert_not_reached ();
}
-
+
if (userid)
prompt = g_strdup_printf (_("Please enter your %s passphrase for %s"),
type, userid);
else
prompt = g_strdup_printf (_("Please enter your %s passphrase"),
type);
-
- passphrase = pgp_passwd_func (prompt, pgp_data);
+
+ /* User the userid as a key if possible, else be generic and use the type */
+ passphrase = mail_session_request_dialog (prompt, TRUE, userid ? userid : type, FALSE);
g_free (prompt);
return passphrase;
@@ -92,18 +92,14 @@ pgp_get_passphrase (const gchar *userid)
* openpgp_init:
* @path: path to pgp
* @type: pgp program type
- * @callback: function to query for a passphrase
- * @data: user data
*
* Initializes pgp variables
**/
void
-openpgp_init (const gchar *path, PgpType type, PgpPasswdFunc callback, gpointer data)
+openpgp_init (const gchar *path, PgpType type)
{
pgp_path = path;
pgp_type = type;
- pgp_passwd_func = callback;
- pgp_data = data;
}