changeset 12753:ddae10386677

[gaim-migrate @ 15100] Always add an IP address in the Via Header. committer: Tailor Script <tailor@pidgin.im>
author Thomas Butter <tbutter>
date Sat, 07 Jan 2006 18:23:50 +0000
parents 91424393b70b
children d37adb7af391
files src/protocols/simple/simple.c
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/simple/simple.c	Sat Jan 07 16:32:18 2006 +0000
+++ b/src/protocols/simple/simple.c	Sat Jan 07 18:23:50 2006 +0000
@@ -537,9 +537,11 @@
 		gaim_debug(GAIM_DEBUG_MISC, "simple", "header %s", auth);
 	}
 
-	if(!sip->ip || !strcmp(sip->ip,"0.0.0.0")) { /* if there was no known ip retry now */
-		g_free(sip->ip);
-		sip->ip = g_strdup(gaim_network_get_public_ip());
+	if(!sip->ip || !strcmp(sip->ip,"0.0.0.0") || !strcmp(sip->ip,"127.0.0.1")) { /* if there was no known ip retry now */
+                if(gaim_network_get_public_ip()) {
+                        g_free(sip->ip);
+                        sip->ip = g_strdup(gaim_network_get_public_ip());
+                }
 	}
 	buf = g_strdup_printf("%s %s SIP/2.0\r\n"
 			"Via: SIP/2.0/%s %s:%d;branch=%s\r\n"
@@ -1262,6 +1264,7 @@
 			return;
 		}
 
+		sip->listenport = gaim_network_get_port_from_fd(sip->fd);
 		sip->listenfd = sip->fd;
 
 		sip->listenpa = gaim_input_add(sip->fd, GAIM_INPUT_READ, simple_udp_process, sip->gc);
@@ -1269,7 +1272,7 @@
 		sip->serveraddr.sin_port = htons(port);
 
 		sip->serveraddr.sin_addr.s_addr = ((struct in_addr*)h->h_addr)->s_addr;
-		sip->ip = g_strdup(gaim_network_get_my_ip(sip->listenfd));
+		sip->ip = g_strdup(gaim_network_get_my_ip(-1));
 		sip->resendtimeout = gaim_timeout_add(2500, (GSourceFunc)resend_timeout, sip);
 		do_register(sip);
 	}