aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-account-editor.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2001-01-10 01:21:34 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-01-10 01:21:34 +0800
commit2b1d1fdc36a85c3cd3b18cd1d24ef36e35d36504 (patch)
tree07f48e2c5b52316bc94f85104f53d28a3ea7c5ba /mail/mail-account-editor.c
parent5e1b1bf7cbe2070ba0187b3b6a4941394e585e4c (diff)
downloadgsoc2013-evolution-2b1d1fdc36a85c3cd3b18cd1d24ef36e35d36504.tar
gsoc2013-evolution-2b1d1fdc36a85c3cd3b18cd1d24ef36e35d36504.tar.gz
gsoc2013-evolution-2b1d1fdc36a85c3cd3b18cd1d24ef36e35d36504.tar.bz2
gsoc2013-evolution-2b1d1fdc36a85c3cd3b18cd1d24ef36e35d36504.tar.lz
gsoc2013-evolution-2b1d1fdc36a85c3cd3b18cd1d24ef36e35d36504.tar.xz
gsoc2013-evolution-2b1d1fdc36a85c3cd3b18cd1d24ef36e35d36504.tar.zst
gsoc2013-evolution-2b1d1fdc36a85c3cd3b18cd1d24ef36e35d36504.zip
New function to set the password for a given url.
2001-01-09 Jeffrey Stedfast <fejj@helixcode.com> * session.c (mail_session_set_password): New function to set the password for a given url. * mail-config-druid.c (druid_finish): Don't save the password in the source url, instead insert it into the save-password hash. (mail_config_druid_get_source_url): Check to make sure the authmech isn't "", if it is then don't set the authmech. * mail-account-editor.c (apply_changes): Don't save the password in the source url, instead insert it into the save-password hash. Also check to make sure we don't set an empty string as the authmech for the source or transport. * mail-accounts.c (mail_default): After reloading the accounts, reselect the previously selected account. (mail_delete): Same. * mail-config-druid.c (druid_cancel): Fixed segfault bug. svn path=/trunk/; revision=7319
Diffstat (limited to 'mail/mail-account-editor.c')
-rw-r--r--mail/mail-account-editor.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/mail/mail-account-editor.c b/mail/mail-account-editor.c
index a17fc389ad..89ad447b46 100644
--- a/mail/mail-account-editor.c
+++ b/mail/mail-account-editor.c
@@ -21,13 +21,12 @@
*/
#include "mail-account-editor.h"
+#include "mail-session.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <camel/camel-url.h>
-extern CamelSession *session;
-
static void mail_account_editor_class_init (MailAccountEditorClass *class);
static void mail_account_editor_init (MailAccountEditor *editor);
static void mail_account_editor_finalise (GtkObject *obj);
@@ -108,7 +107,7 @@ static gboolean
apply_changes (MailAccountEditor *editor)
{
MailConfigAccount *account;
- char *host, *pport;
+ char *host, *pport, *auth;
CamelURL *url;
int port;
@@ -144,7 +143,8 @@ apply_changes (MailAccountEditor *editor)
url->passwd = g_strdup (gtk_entry_get_text (editor->source_passwd));
g_free (url->authmech);
- url->authmech = g_strdup (gtk_object_get_data (GTK_OBJECT (editor), "source_authmech"));
+ auth = gtk_object_get_data (GTK_OBJECT (editor), "source_authmech");
+ url->authmech = auth && *auth ? g_strdup (auth) : NULL;
g_free (url->host);
host = g_strdup (gtk_entry_get_text (editor->source_host));
@@ -167,16 +167,26 @@ apply_changes (MailAccountEditor *editor)
return FALSE;
}
+ if (account->source->save_passwd) {
+ char *string;
+
+ string = camel_url_to_string (url, FALSE);
+ mail_session_set_password (string, url->passwd);
+ mail_session_remember_password (string);
+ g_free (string);
+ }
+
/* now that we know this url works, set it */
g_free (account->source->url);
- account->source->url = camel_url_to_string (url, account->source->save_passwd);
+ account->source->url = camel_url_to_string (url, FALSE);
camel_url_free (url);
/* transport */
url = camel_url_new (account->transport->url, NULL);
g_free (url->authmech);
- url->authmech = g_strdup (gtk_object_get_data (GTK_OBJECT (editor), "transport_authmech"));
+ auth = gtk_object_get_data (GTK_OBJECT (editor), "transport_authmech");
+ url->authmech = auth && *auth ? g_strdup (auth) : NULL;
g_free (url->host);
host = g_strdup (gtk_entry_get_text (editor->transport_host));