diff --git a/ChangeLog b/ChangeLog index 20cb81f96..0f5579e5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,14 @@ WeeChat ChangeLog ================= Sébastien Helleu -v0.3.9-dev, 2012-08-22 +v0.3.9-dev, 2012-08-25 Version 0.3.9 (under dev!) -------------------------- +* core: fix IP address returned by hook_connect (return IP really used, not + first IP for hostname) * core: display spaces at the end of messages in chat area (bug #37024) * core: fix infinite loop in display when chat area has width of 1 with a bar displayed on the right (nicklist by default) (bug #37089) diff --git a/src/core/wee-network.c b/src/core/wee-network.c index 6b2480243..a37be51d3 100644 --- a/src/core/wee-network.c +++ b/src/core/wee-network.c @@ -657,6 +657,8 @@ network_connect_child (struct t_hook *hook_connect) status_str[1] = '\0'; + ptr_address = NULL; + ptr_proxy = NULL; if (HOOK_CONNECT(hook_connect, proxy) && HOOK_CONNECT(hook_connect, proxy)[0]) @@ -930,6 +932,26 @@ network_connect_child (struct t_hook *hook_connect) ptr_res->ai_addr, ptr_res->ai_addrlen)) { status_str[0] = '0' + WEECHAT_HOOK_CONNECT_OK; + if (HOOK_CONNECT(hook_connect, ipv6)) + { + if (inet_ntop (AF_INET6, + &((struct sockaddr_in6 *)(ptr_res->ai_addr))->sin6_addr, + ipv6_address, + INET6_ADDRSTRLEN)) + { + ptr_address = ipv6_address; + } + } + else + { + if (inet_ntop (AF_INET, + &((struct sockaddr_in *)(ptr_res->ai_addr))->sin_addr, + ipv4_address, + INET_ADDRSTRLEN)) + { + ptr_address = ipv4_address; + } + } break; } else @@ -940,27 +962,6 @@ network_connect_child (struct t_hook *hook_connect) if (status_str[0] == '0' + WEECHAT_HOOK_CONNECT_OK) { status_with_string = NULL; - ptr_address = NULL; - if (HOOK_CONNECT(hook_connect, ipv6)) - { - if (inet_ntop (AF_INET6, - &((struct sockaddr_in6 *)(res->ai_addr))->sin6_addr, - ipv6_address, - INET6_ADDRSTRLEN)) - { - ptr_address = ipv6_address; - } - } - else - { - if (inet_ntop (AF_INET, - &((struct sockaddr_in *)(res->ai_addr))->sin_addr, - ipv4_address, - INET_ADDRSTRLEN)) - { - ptr_address = ipv4_address; - } - } if (ptr_address) { length = strlen (status_str) + 5 + strlen (ptr_address) + 1;