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
This commit is contained in:
Dan Winship
2000-06-09 22:01:50 +00:00
parent 2aefadf282
commit aeb515ebe6
2 changed files with 38 additions and 19 deletions

View File

@ -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.

View File

@ -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;
}