aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-06-10 06:01:50 +0800
committerDan Winship <danw@src.gnome.org>2000-06-10 06:01:50 +0800
commitaeb515ebe698cc33ab7b539a5b768ef53b01c0d9 (patch)
treef29f04e95ca9895352263ee9f1a026f379f76408 /mail
parent2aefadf282648010e9403e4a7f643fe78dc6df53 (diff)
downloadgsoc2013-evolution-aeb515ebe698cc33ab7b539a5b768ef53b01c0d9.tar
gsoc2013-evolution-aeb515ebe698cc33ab7b539a5b768ef53b01c0d9.tar.gz
gsoc2013-evolution-aeb515ebe698cc33ab7b539a5b768ef53b01c0d9.tar.bz2
gsoc2013-evolution-aeb515ebe698cc33ab7b539a5b768ef53b01c0d9.tar.lz
gsoc2013-evolution-aeb515ebe698cc33ab7b539a5b768ef53b01c0d9.tar.xz
gsoc2013-evolution-aeb515ebe698cc33ab7b539a5b768ef53b01c0d9.tar.zst
gsoc2013-evolution-aeb515ebe698cc33ab7b539a5b768ef53b01c0d9.zip
Update for CamelAuthCallback changes. (Uncache passwords when asked to.)
* session.c (evolution_auth_callback): Update for CamelAuthCallback changes. (Uncache passwords when asked to.) svn path=/trunk/; revision=3497
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog3
-rw-r--r--mail/session.c54
2 files changed, 38 insertions, 19 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 23d524cdf3..8b99e3b128 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,8 @@
2000-06-09 Dan Winship <danw@helixcode.com>
+ * session.c (evolution_auth_callback): Update for
+ CamelAuthCallback changes. (Uncache passwords when asked to.)
+
* mail-ops.c (fetch_mail): close and expunge the source folder
after copying it to a local folder.
diff --git a/mail/session.c b/mail/session.c
index c9dbb0b1ae..259a087377 100644
--- a/mail/session.c
+++ b/mail/session.c
@@ -1,5 +1,5 @@
/*
- * session.c: handles the session infomration and resource manipulation
+ * session.c: handles the session information and resource manipulation
*
* Author:
* Miguel de Icaza (miguel@gnu.org)
@@ -26,28 +26,48 @@ request_callback (gchar *string, gpointer data)
}
static char *
-evolution_auth_callback (char *prompt, gboolean secret,
- CamelService *service, char *item,
+evolution_auth_callback (CamelAuthCallbackMode mode, char *data,
+ gboolean secret, CamelService *service, char *item,
CamelException *ex)
{
GtkWidget *dialog;
- char *key = NULL, *ans;
+ char *key, *ans;
- if (service && item) {
- key = g_strdup_printf ("%s:%s", camel_url_to_string (service->url, FALSE), item);
+ if (!passwords)
+ passwords = g_hash_table_new (g_str_hash, g_str_equal);
- if (passwords) {
- ans = g_hash_table_lookup (passwords, key);
- if (ans) {
+ key = g_strdup_printf ("%s:%s",
+ camel_url_to_string (service->url, FALSE),
+ item);
+
+ if (mode == CAMEL_AUTHENTICATOR_TELL) {
+ if (!data) {
+ g_hash_table_remove (passwords, key);
+ g_free (key);
+ } else {
+ gpointer old_key, old_data;
+
+ if (g_hash_table_lookup_extended (passwords, key,
+ &old_key,
+ &old_data)) {
+ g_hash_table_insert (passwords, old_key, data);
+ g_free (old_data);
g_free (key);
- return g_strdup (ans);
- }
- } else
- passwords = g_hash_table_new (g_str_hash, g_str_equal);
+ } else
+ g_hash_table_insert (passwords, key, data);
+ }
+
+ return NULL;
+ }
+
+ ans = g_hash_table_lookup (passwords, key);
+ if (ans) {
+ g_free (key);
+ return g_strdup (ans);
}
/* XXX parent window? */
- dialog = gnome_request_dialog (secret, prompt, NULL, 0,
+ dialog = gnome_request_dialog (secret, data, NULL, 0,
request_callback, &ans, NULL);
if (!dialog) {
camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
@@ -63,11 +83,7 @@ evolution_auth_callback (char *prompt, gboolean secret,
return NULL;
}
- if (service && item)
- g_hash_table_insert (passwords, key, g_strdup (ans));
- else
- g_free (key);
-
+ g_hash_table_insert (passwords, key, g_strdup (ans));
return ans;
}