--- irssi-0.8.10/src/irc/dcc/dcc.c 2005-10-19 03:13:31.000000000 +0100 +++ irssi-0.8.10+byte/src/irc/dcc/dcc.c 2006-05-02 19:49:48.000000000 +0100 @@ -241,32 +241,32 @@ return NULL; } -/* Connect to specified IP address using the correct own_ip. */ +/* Connect to specified IP address using the correct ip. */ GIOChannel *dcc_connect_ip(IPADDR *ip, int port) { - IPADDR *own_ip, temp_ip; - const char *own_ip_str; + IPADDR *use_ip, temp_ip; + const char *use_ip_str; GIOChannel *handle; - own_ip_str = settings_get_str("dcc_own_ip"); - own_ip = NULL; - if (*own_ip_str != '\0') { + use_ip_str = settings_get_str("dcc_use_ip"); + use_ip = NULL; + if (*use_ip_str != '\0') { /* use the specified interface for connecting */ - net_host2ip(own_ip_str, &temp_ip); + net_host2ip(use_ip_str, &temp_ip); if (IPADDR_IS_V6(ip) == IPADDR_IS_V6(&temp_ip)) - own_ip = &temp_ip; + use_ip = &temp_ip; } - if (own_ip == NULL) - own_ip = IPADDR_IS_V6(ip) ? source_host_ip6 : source_host_ip4; + if (use_ip == NULL) + use_ip = IPADDR_IS_V6(ip) ? source_host_ip6 : source_host_ip4; - handle = net_connect_ip(ip, port, own_ip); - if (handle == NULL && errno == EADDRNOTAVAIL && own_ip != NULL) { - /* dcc_own_ip is external address */ - own_ip = IPADDR_IS_V6(ip) ? source_host_ip6 : source_host_ip4; - handle = net_connect_ip(ip, port, own_ip); + handle = net_connect_ip(ip, port, use_ip); + if (handle == NULL && errno == EADDRNOTAVAIL && use_ip != NULL) { + /* dcc_use_ip is external address */ + use_ip = IPADDR_IS_V6(ip) ? source_host_ip6 : source_host_ip4; + handle = net_connect_ip(ip, port, use_ip); } return handle; } @@ -536,8 +536,9 @@ dcc_timeouttag = g_timeout_add(1000, (GSourceFunc) dcc_timeout_func, NULL); settings_add_str("dcc", "dcc_port", "0"); settings_add_time("dcc", "dcc_timeout", "5min"); + settings_add_str("dcc", "dcc_use_ip", ""); settings_add_str("dcc", "dcc_own_ip", ""); signal_add("event connected", (SIGNAL_FUNC) sig_connected); signal_add("server disconnected", (SIGNAL_FUNC) sig_server_disconnected); --- irssi-0.8.10/src/irc/dcc/dcc.h 2005-10-19 03:13:31.000000000 +0100 +++ irssi-0.8.10+byte/src/irc/dcc/dcc.h 2006-05-02 19:54:21.000000000 +0100 @@ -46,9 +46,9 @@ DCC_REC *dcc_find_request(int type, const char *nick, const char *arg); /* IP <-> string for DCC CTCP messages. `str' must be at least MAX_IP_LEN bytes. - If /SET dcc_own_ip is set, dcc_ip2str() always returns it. */ + If /SET dcc_use_ip is set, dcc_ip2str() always returns it. */ void dcc_ip2str(IPADDR *ip, char *str); void dcc_str2ip(const char *str, IPADDR *ip); /* Start listening for incoming connections */