# HG changeset patch # User Thomas Butter # Date 1136658230 0 # Node ID ddae103866771c641d7e32ad282f9730a539df1d # Parent 91424393b70b6857ca0ebee8bafd86f4dee3a59a [gaim-migrate @ 15100] Always add an IP address in the Via Header. committer: Tailor Script diff -r 91424393b70b -r ddae10386677 src/protocols/simple/simple.c --- 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); }