diff options
author | Dan Winship <danw@src.gnome.org> | 2000-02-22 03:56:49 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-02-22 03:56:49 +0800 |
commit | 8ea1212d992c564a3a7849a41be9000ce50d0f6b (patch) | |
tree | ebc891496db9d1ad04a43153bd79f2b068902c07 /mail/session.c | |
parent | 0eff8e4321d63ef1dce20cceae8314b3628767a4 (diff) | |
download | gsoc2013-evolution-8ea1212d992c564a3a7849a41be9000ce50d0f6b.tar gsoc2013-evolution-8ea1212d992c564a3a7849a41be9000ce50d0f6b.tar.gz gsoc2013-evolution-8ea1212d992c564a3a7849a41be9000ce50d0f6b.tar.bz2 gsoc2013-evolution-8ea1212d992c564a3a7849a41be9000ce50d0f6b.tar.lz gsoc2013-evolution-8ea1212d992c564a3a7849a41be9000ce50d0f6b.tar.xz gsoc2013-evolution-8ea1212d992c564a3a7849a41be9000ce50d0f6b.tar.zst gsoc2013-evolution-8ea1212d992c564a3a7849a41be9000ce50d0f6b.zip |
Add "authenticator" to CamelSession and update things to use it.
svn path=/trunk/; revision=1890
Diffstat (limited to 'mail/session.c')
-rw-r--r-- | mail/session.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/mail/session.c b/mail/session.c index e0390c380f..a97b70ed26 100644 --- a/mail/session.c +++ b/mail/session.c @@ -7,6 +7,7 @@ * (C) 2000 Helix Code, Inc. http://www.helixcode.com */ #include <config.h> +#include <gnome.h> #include "session.h" #include "e-util/e-setup.h" #include "camel/camel.h" @@ -14,6 +15,45 @@ SessionStore *default_session; static void +request_callback (gchar *string, gpointer data) +{ + char **ans = data; + + if (string) + *ans = g_strdup(string); + else + *ans = NULL; +} + +static char * +evolution_auth_callback (char *prompt, gboolean secret, + CamelService *service, char *item, + CamelException *ex) +{ + GtkWidget *dialog; + char *ans; + + /* XXX look up stored passwords */ + + /* XXX parent window? */ + dialog = gnome_request_dialog (secret, prompt, NULL, 0, + request_callback, &ans, NULL); + if (!dialog) { + camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, + "Could not create dialog box."); + return NULL; + } + if (gnome_dialog_run_and_close (GNOME_DIALOG (dialog)) == -1 || + ans == NULL) { + camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, + "User cancelled query."); + return NULL; + } + + return ans; +} + +static void session_providers_init (void) { camel_provider_register_as_module (CAMEL_PROVIDERDIR "/libcamelmbox.so"); @@ -25,7 +65,7 @@ session_store_new (const char *uri) SessionStore *ss = g_new (SessionStore, 1); CamelException *ex; - ss->session = camel_session_new (); + ss->session = camel_session_new (evolution_auth_callback); ex = camel_exception_new (); ss->store = camel_session_get_store (ss->session, uri, ex); camel_exception_free (ex); |