diff options
author | Timo Sirainen <cras@irssi.org> | 2001-05-22 00:16:38 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-05-22 00:16:38 +0000 |
commit | da9d55f4032e2c3fbe2af5b8c61c559ea56fd383 (patch) | |
tree | a38391bd279ccc76a25980b4dcb85bce5c4abbf5 | |
parent | 62dc0e36eba4afb94821aef68ebe84019ed55797 (diff) | |
download | irssi-da9d55f4032e2c3fbe2af5b8c61c559ea56fd383.zip |
/SET dcc_own_ip for specifying own IP to use in DCC requests
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1512 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r-- | src/irc/dcc/dcc.c | 8 | ||||
-rw-r--r-- | src/irc/dcc/dcc.h | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/irc/dcc/dcc.c b/src/irc/dcc/dcc.c index c0d87a07..16c35be0 100644 --- a/src/irc/dcc/dcc.c +++ b/src/irc/dcc/dcc.c @@ -152,8 +152,15 @@ DCC_REC *dcc_find_request(int type, const char *nick, const char *arg) void dcc_ip2str(IPADDR *ip, char *host) { + IPADDR temp_ip; unsigned long addr; + if (*settings_get_str("dcc_own_ip") != '\0') { + /* overridden IP address */ + net_host2ip(settings_get_str("dcc_own_ip"), &temp_ip); + ip = &temp_ip; + } + if (IPADDR_IS_V6(ip)) { /* IPv6 */ net_ip2host(ip, host); @@ -420,6 +427,7 @@ void irc_dcc_init(void) settings_add_int("dcc", "dcc_port", 0); settings_add_int("dcc", "dcc_timeout", 300); + settings_add_str("dcc", "dcc_own_ip", ""); signal_add("server connected", (SIGNAL_FUNC) sig_server_connected); signal_add("server disconnected", (SIGNAL_FUNC) sig_server_disconnected); diff --git a/src/irc/dcc/dcc.h b/src/irc/dcc/dcc.h index bd30ae48..31c945b1 100644 --- a/src/irc/dcc/dcc.h +++ b/src/irc/dcc/dcc.h @@ -43,7 +43,8 @@ DCC_REC *dcc_find_request_latest(int type); 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 */ + `str' must be at least MAX_IP_LEN bytes. + If /SET dcc_own_ip is set, dcc_ip2str() always returns it. */ void dcc_ip2str(IPADDR *ip, char *str); void dcc_str2ip(const char *str, IPADDR *ip); |