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