changeset 1304:7f4302f6fd64

[gaim-migrate @ 1314] No more port crashy. committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Tue, 19 Dec 2000 03:46:13 +0000
parents 9c34f99af79e
children 374b6482f904
files plugins/irc.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/irc.c	Tue Dec 19 03:28:33 2000 +0000
+++ b/plugins/irc.c	Tue Dec 19 03:46:13 2000 +0000
@@ -978,7 +978,13 @@
 
 	site.sin_family = AF_INET;
 	site.sin_addr.s_addr = *(long *)(host->h_addr);
-	site.sin_port = htons(atoi(user->proto_opt[1]));
+	
+	if (user->proto_opt[1][0])
+		site.sin_port = htons(atoi(user->proto_opt[1]));
+	else {
+		site.sin_port = htons(6667);
+		g_snprintf(user->proto_opt[1], 5, "6667");
+	}
 
 	fd = socket(AF_INET, SOCK_STREAM, 0);
 	if (fd < 0) {
@@ -1064,6 +1070,8 @@
 	if (user->proto_opt[1][0]) {
 		debug_printf("setting text %s\n", user->proto_opt[1]);
 		gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[1]);
+	} else {
+		gtk_entry_set_text(GTK_ENTRY(entry), "6667");
 	}
 	gtk_object_set_user_data(GTK_OBJECT(entry), user);
 	gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user);