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 | |
parent | 0eff8e4321d63ef1dce20cceae8314b3628767a4 (diff) | |
download | gsoc2013-evolution-8ea1212d992c564a3a7849a41be9000ce50d0f6b.tar.gz 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')
-rw-r--r-- | mail/ChangeLog | 5 | ||||
-rw-r--r-- | mail/session.c | 42 |
2 files changed, 46 insertions, 1 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 198b2c612d..33f9690fcd 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,10 @@ 2000-02-21 Dan Winship <danw@helixcode.com> + * session.c (session_store_new): Pass a CamelAuthCallback + (evolution_auth_callback) to camel_session_new. + +2000-02-21 Dan Winship <danw@helixcode.com> + * session.c (session_store_new): Update session_store_new to deal with the fact that camel_session_get_store takes a CamelException now. Doesn't actually do anything with the 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); |