aboutsummaryrefslogtreecommitdiffstats
path: root/mail/session.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/session.c')
-rw-r--r--mail/session.c42
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);