aboutsummaryrefslogtreecommitdiffstats
path: root/mail
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
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')
-rw-r--r--mail/ChangeLog17
-rw-r--r--mail/component-factory.c5
-rw-r--r--mail/openpgp-utils.c20
-rw-r--r--mail/openpgp-utils.h3
4 files changed, 25 insertions, 20 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index cf63258d78..69eb5721de 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,11 @@
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().
+
* mail-ops.c (do_send_queue): Remove the X-Evolution header before
we send.
@@ -19,7 +25,8 @@
little things.
(pgp_mime_part_encrypt): Do some canonical CRLF action before
encrypting.
- (pgp_mime_part_sign): Make sure we are the owners of the byte array.
+ (pgp_mime_part_sign): Make sure we are the owners of the byte
+ array.
(pgp_mime_part_verify): Same.
(pgp_mime_part_encrypt): Same.
(pgp_mime_part_decrypt): Same.
@@ -36,10 +43,10 @@
* mail-mt.c (mail_msg_new): Init a cancel field in the message.
(mail_msg_free): Free it.
- (mail_msg_cancel): New function to attempt to cancel an
- operation by id. Impelementation functions can still be
- uncancellable by not registering for cancellation, etc, or do it
- themselves as well.
+ (mail_msg_cancel): New function to attempt to cancel an operation
+ by id. Impelementation functions can still be uncancellable by
+ not registering for cancellation, etc, or do it themselves as
+ well.
* mail-send-recv.c (fetch_mail_filter_folder): set folder_uid's
properly, so we can save it later.
diff --git a/mail/component-factory.c b/mail/component-factory.c
index a88d303215..438f9e61a5 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -40,6 +40,7 @@
#include "mail-ops.h"
#include "mail-local.h"
#include "mail-session.h"
+#include "openpgp-utils.h"
#include <gal/widgets/e-gui-utils.h>
#include "component-factory.h"
@@ -180,7 +181,9 @@ owner_set_cb (EvolutionShellComponent *shell_component,
evolution_dir = g_strdup (evolution_homedir);
mail_session_init ();
mail_config_init ();
-
+
+ openpgp_init (mail_config_get_pgp_path (), mail_config_get_pgp_type ());
+
storages_hash = g_hash_table_new (NULL, NULL);
create_vfolder_storage (shell_component);
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;
}
diff --git a/mail/openpgp-utils.h b/mail/openpgp-utils.h
index 17c5e22ccf..571a1d125c 100644
--- a/mail/openpgp-utils.h
+++ b/mail/openpgp-utils.h
@@ -45,9 +45,8 @@ typedef enum {
PGP_HASH_TYPE_SHA1
} PgpHashType;
-typedef gchar* (*PgpPasswdFunc) (const gchar *prompt, gpointer data);
-void openpgp_init (const gchar *path, PgpType type, PgpPasswdFunc callback, gpointer data);
+void openpgp_init (const gchar *path, PgpType type);
gboolean openpgp_detect (const gchar *text);