diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-04-30 04:19:32 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-04-30 04:19:32 +0800 |
commit | 8f07a288b4cec7df3d5bcefd43158061a8073886 (patch) | |
tree | 39b9e272528533725b8eccfe56cf0639c0b5a365 /mail/mail-account-gui.c | |
parent | c38efb6c5009e2a2c3d4cf689aa56ce8453d3ad5 (diff) | |
download | gsoc2013-evolution-8f07a288b4cec7df3d5bcefd43158061a8073886.tar gsoc2013-evolution-8f07a288b4cec7df3d5bcefd43158061a8073886.tar.gz gsoc2013-evolution-8f07a288b4cec7df3d5bcefd43158061a8073886.tar.bz2 gsoc2013-evolution-8f07a288b4cec7df3d5bcefd43158061a8073886.tar.lz gsoc2013-evolution-8f07a288b4cec7df3d5bcefd43158061a8073886.tar.xz gsoc2013-evolution-8f07a288b4cec7df3d5bcefd43158061a8073886.tar.zst gsoc2013-evolution-8f07a288b4cec7df3d5bcefd43158061a8073886.zip |
Strip leading/trailing whitespace from the username because users
2002-04-29 Jeffrey Stedfast <fejj@ximian.com>
* mail-account-gui.c (save_service): Strip leading/trailing
whitespace from the username because users sometimes accidently
add extra spaces here and there. Fixes bug #24009 (along with a
number of other "bugs").
(mail_account_gui_auto_detect_extra_conf): Use a CamelURL instead
of a GHashTable *settings. Also parse out the port # from the
hostname.
svn path=/trunk/; revision=16633
Diffstat (limited to 'mail/mail-account-gui.c')
-rw-r--r-- | mail/mail-account-gui.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c index 833e6d9c3a..756fbd2c67 100644 --- a/mail/mail-account-gui.c +++ b/mail/mail-account-gui.c @@ -213,8 +213,9 @@ mail_account_gui_auto_detect_extra_conf (MailAccountGui *gui) { MailAccountGuiService *service = &gui->source; CamelProvider *prov = service->provider; - GHashTable *settings, *auto_detected; + GHashTable *auto_detected; GtkWidget *path; + CamelURL *url; char *text; if (!prov) @@ -226,27 +227,40 @@ mail_account_gui_auto_detect_extra_conf (MailAccountGui *gui) else path = NULL; - settings = g_hash_table_new (g_str_hash, g_str_equal); + url = g_new0 (CamelURL, 1); + camel_url_set_protocol (url, prov->protocol); + if (CAMEL_PROVIDER_ALLOWS (prov, CAMEL_URL_PART_HOST)) { - text = gtk_entry_get_text (service->hostname); - if (text) - g_hash_table_insert (settings, "hostname", text); + text = g_strdup (gtk_entry_get_text (service->hostname)); + if (*text) { + char *port; + + port = strchr (text, ':'); + if (port) { + *port++ = '\0'; + camel_url_set_port (url, atoi (port)); + } + + camel_url_set_host (url, text); + } + g_free (text); } if (CAMEL_PROVIDER_ALLOWS (prov, CAMEL_URL_PART_USER)) { - text = gtk_entry_get_text (service->username); - if (text) - g_hash_table_insert (settings, "username", text); + text = g_strdup (gtk_entry_get_text (service->username)); + g_strstrip (text); + camel_url_set_user (url, text); + g_free (text); } if (path && CAMEL_PROVIDER_ALLOWS (prov, CAMEL_URL_PART_PATH)) { text = gtk_entry_get_text (service->path); - if (text) - g_hash_table_insert (settings, "path", text); + if (text && *text) + camel_url_set_path (url, text); } - camel_provider_auto_detect (prov, settings, &auto_detected, NULL); - g_hash_table_destroy (settings); + camel_provider_auto_detect (prov, url, &auto_detected, NULL); + camel_url_free (url); if (auto_detected) { CamelProviderConfEntry *entries; |