From 99a779567bde67b8994af25d13bfd6f6e48fea04 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 17 Jan 2001 20:11:36 +0000 Subject: Handle NULL source and, while we're at it, transport URLs. Apparently 2001-01-17 Jeffrey Stedfast * mail-account-editor.c (construct): Handle NULL source and, while we're at it, transport URLs. Apparently camel_url_new() and/or camel-url_free() don't handle NULL input well. * mail-accounts.c (load_accounts): Handle NULL source URLs. svn path=/trunk/; revision=7595 --- mail/ChangeLog | 8 ++++++++ mail/mail-account-editor.c | 18 ++++++++++++++---- mail/mail-accounts.c | 14 ++++++++++---- mail/mail-config-druid.c | 3 +++ 4 files changed, 35 insertions(+), 8 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 2549cb3841..77dce568ab 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,11 @@ +2001-01-17 Jeffrey Stedfast + + * mail-account-editor.c (construct): Handle NULL source and, while + we're at it, transport URLs. Apparently camel_url_new() and/or + camel-url_free() don't handle NULL input well. + + * mail-accounts.c (load_accounts): Handle NULL source URLs. + 2001-01-17 Jeffrey Stedfast * mail-account-editor.c (construct): Oops. "url && url->host" diff --git a/mail/mail-account-editor.c b/mail/mail-account-editor.c index a75ae27a64..5a08db93a8 100644 --- a/mail/mail-account-editor.c +++ b/mail/mail-account-editor.c @@ -645,7 +645,11 @@ construct (MailAccountEditor *editor, const MailConfigAccount *account) gtk_entry_set_text (GTK_ENTRY (entry), account->id->signature); /* Servers */ - url = camel_url_new (account->source->url, NULL); + if (account->source->url) + url = camel_url_new (account->source->url, NULL); + else + url = NULL; + editor->source_type = glade_xml_get_widget (gui, "txtSourceType"); if (GTK_IS_LABEL (editor->source_type)) gtk_label_set_text (GTK_LABEL (editor->source_type), url ? url->protocol : _("None")); @@ -675,10 +679,15 @@ construct (MailAccountEditor *editor, const MailConfigAccount *account) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->keep_on_server), account->source->keep_on_server); source_check (editor, url); source_auth_init (editor, url); - camel_url_free (url); + if (url) + camel_url_free (url); /* Transport */ - url = camel_url_new (account->transport->url, NULL); + if (account->transport->url) + url = camel_url_new (account->transport->url, NULL); + else + url = NULL; + editor->transport_type = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuTransportType")); editor->transport_host = GTK_ENTRY (glade_xml_get_widget (gui, "txtTransportHost")); gtk_entry_set_text (editor->transport_host, url && url->host ? url->host : ""); @@ -693,7 +702,8 @@ construct (MailAccountEditor *editor, const MailConfigAccount *account) if (editor->transport_ssl) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->transport_ssl), account->transport->use_ssl); transport_type_init (editor, url); - camel_url_free (url); + if (url) + camel_url_free (url); editor->account = account; } diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c index a5baecdc2f..965454da8b 100644 --- a/mail/mail-accounts.c +++ b/mail/mail-accounts.c @@ -105,11 +105,17 @@ load_accounts (MailAccountsDialog *dialog) account = node->data; - url = camel_url_new (account->source->url, NULL); + if (account->source->url) + url = camel_url_new (account->source->url, NULL); + else + url = NULL; + text[0] = g_strdup (account->name); - text[1] = g_strdup_printf ("%s%s", url->protocol, - account->default_account ? " (default)" : ""); - camel_url_free (url); + text[1] = g_strdup_printf ("%s%s", url && url->protocol ? url->protocol : _("None"), + account->default_account ? _(" (default)") : ""); + + if (url) + camel_url_free (url); gtk_clist_append (dialog->mail_accounts, text); g_free (text[0]); diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c index ba9537593e..62a4144970 100644 --- a/mail/mail-config-druid.c +++ b/mail/mail-config-druid.c @@ -207,12 +207,15 @@ druid_finish (GnomeDruidPage *page, gpointer arg1, gpointer user_data) if (str) { /* cache the password and rewrite the url without the password part */ url = camel_url_new (str, NULL); + g_free (str); source->url = camel_url_to_string (url, FALSE); if (source->save_passwd && url->passwd) { mail_session_set_password (source->url, url->passwd); mail_session_remember_password (source->url); } camel_url_free (url); + } else { + source->url = NULL; } /* construct the transport */ -- cgit v1.2.3