From ed88f237863dc3dd5aec568196b61008df2e9b8c Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 11 Aug 2000 20:27:12 +0000 Subject: Update this for CamelObject (try_inline_pgp): Deal with decrypting here * mail-format.c (destroy_part): Update this for CamelObject (try_inline_pgp): Deal with decrypting here rather than trying to pawn the data off to handle_multipart_encrypted, since it most likely won't be correct (won't have the proper MIME headers inside the encrypted part). (handle_multipart_encrypted): Add code from Nathan Thompson-Amato to re-MIME-parse the decrypted data after decrypting. * mail-crypto.c (mail_crypto_openpgp_{de,en}crypt): Get the password here rather than having it passed in. Remove some dead code. * session.c (mail_request_dialog): Allow this to work in either a sync or an async context. svn path=/trunk/; revision=4751 --- mail/session.c | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) (limited to 'mail/session.c') diff --git a/mail/session.c b/mail/session.c index 086a7c12fc..9f9072e93f 100644 --- a/mail/session.c +++ b/mail/session.c @@ -14,14 +14,6 @@ CamelSession *session; GHashTable *passwords; -/* FIXME: Will this ever be called in a non-async - * manner? Better hope not, cause if that happens - * we deadlock.... - */ - -#define ASYNC_AUTH_CALLBACK - -#ifndef ASYNC_AUTH_CALLBACK static void request_callback (gchar *string, gpointer data) { @@ -32,14 +24,12 @@ request_callback (gchar *string, gpointer data) else *ans = NULL; } -#endif char * -mail_request_dialog (const char *prompt, gboolean secret, const char *key) +mail_request_dialog (const char *prompt, gboolean secret, const char *key, + gboolean async) { -#ifndef ASYNC_AUTH_CALLBACK GtkWidget *dialog; -#endif char *ans; @@ -50,19 +40,18 @@ mail_request_dialog (const char *prompt, gboolean secret, const char *key) if (ans) return g_strdup (ans); -#ifndef ASYNC_AUTH_CALLBACK - /* XXX parent window? */ - dialog = gnome_request_dialog (secret, prompt, NULL, 0, - request_callback, &ans, NULL); - if (!dialog) - return NULL; - if (gnome_dialog_run_and_close (GNOME_DIALOG (dialog)) == -1 || - ans == NULL) - return NULL; -#else - if (!mail_op_get_password ((char *) prompt, secret, &ans)) - return NULL; -#endif + if (!async) { + dialog = gnome_request_dialog (secret, prompt, NULL, 0, + request_callback, &ans, NULL); + if (!dialog) + return NULL; + if (gnome_dialog_run_and_close (GNOME_DIALOG (dialog)) == -1 || + ans == NULL) + return NULL; + } else { + if (!mail_op_get_password ((char *) prompt, secret, &ans)) + return NULL; + } g_hash_table_insert (passwords, g_strdup (key), g_strdup (ans)); return ans; @@ -101,7 +90,7 @@ auth_callback (CamelAuthCallbackMode mode, char *data, gboolean secret, return NULL; } - ans = mail_request_dialog (data, secret, key); + ans = mail_request_dialog (data, secret, key, TRUE); g_free (key); if (!ans) { -- cgit v1.2.3