changeset 6344:f63da9023c99

[gaim-migrate @ 6843] Empty proxy information should no longer be able to be set. They get turned into NULLs, as they should. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Thu, 31 Jul 2003 01:57:19 +0000
parents 46355beb6c30
children f637c4271a53
files src/gtkaccount.c
diffstat 1 files changed, 27 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkaccount.c	Wed Jul 30 15:18:51 2003 +0000
+++ b/src/gtkaccount.c	Thu Jul 31 01:57:19 2003 +0000
@@ -1034,32 +1034,48 @@
 		gaim_account_set_proxy_info(dialog->account, NULL);
 	}
 	else {
-		const char *port_str;
-
 		proxy_info = gaim_account_get_proxy_info(dialog->account);
 
+		/* Create the proxy info if it doesn't exist. */
 		if (proxy_info == NULL) {
 			proxy_info = gaim_proxy_info_new();
 			gaim_account_set_proxy_info(dialog->account, proxy_info);
 		}
 
+		/* Set the proxy info type. */
 		gaim_proxy_info_set_type(proxy_info, dialog->new_proxy_type);
 
-		gaim_proxy_info_set_host(proxy_info,
-				gtk_entry_get_text(GTK_ENTRY(dialog->proxy_host_entry)));
+		/* Host */
+		value = gtk_entry_get_text(GTK_ENTRY(dialog->proxy_host_entry));
 
-		port_str = gtk_entry_get_text(GTK_ENTRY(dialog->proxy_port_entry));
+		if (*value != '\0')
+			gaim_proxy_info_set_host(proxy_info, value);
+		else
+			gaim_proxy_info_set_host(proxy_info, NULL);
 
-		if (port_str != NULL)
-			gaim_proxy_info_set_port(proxy_info, atoi(port_str));
+		/* Port */
+		value = gtk_entry_get_text(GTK_ENTRY(dialog->proxy_port_entry));
+
+		if (*value != '\0')
+			gaim_proxy_info_set_port(proxy_info, atoi(value));
 		else
 			gaim_proxy_info_set_port(proxy_info, 0);
 
-		gaim_proxy_info_set_username(proxy_info,
-				gtk_entry_get_text(GTK_ENTRY(dialog->proxy_user_entry)));
+		/* Username */
+		value = gtk_entry_get_text(GTK_ENTRY(dialog->proxy_user_entry));
+
+		if (*value != '\0')
+			gaim_proxy_info_set_username(proxy_info, value);
+		else
+			gaim_proxy_info_set_username(proxy_info, NULL);
 
-		gaim_proxy_info_set_password(proxy_info,
-				gtk_entry_get_text(GTK_ENTRY(dialog->proxy_pass_entry)));
+		/* Password */
+		value = gtk_entry_get_text(GTK_ENTRY(dialog->proxy_pass_entry));
+
+		if (*value != '\0')
+			gaim_proxy_info_set_password(proxy_info, value);
+		else
+			gaim_proxy_info_set_password(proxy_info, NULL);
 	}
 
 	/* Adds the account to the list, or modify the existing entry. */