diff options
author | Timo Sirainen <cras@irssi.org> | 2002-05-26 16:52:36 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-05-26 16:52:36 +0000 |
commit | eddc3d90c6f1defcdaec9311f22aaebe56ff0ada (patch) | |
tree | f50c068697706fe6ff49260e083cccfeed5a7922 /src/irc/dcc | |
parent | b95f6acc4fe6751e781aa8004864040976393e9a (diff) | |
download | irssi-eddc3d90c6f1defcdaec9311f22aaebe56ff0ada.zip |
net_ip2host() and net_host2ip() now treat any IPv6 IPs as 0.0.0.0, if IPv6
support isn't enabled in irssi. Also DCC's human readable IP address is
taken from DCC SEND request directly with IPv6.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2825 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc/dcc')
-rw-r--r-- | src/irc/dcc/dcc-get.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/irc/dcc/dcc-get.c b/src/irc/dcc/dcc-get.c index 381d02b1..d9529553 100644 --- a/src/irc/dcc/dcc-get.c +++ b/src/irc/dcc/dcc-get.c @@ -315,6 +315,7 @@ static void ctcp_msg_dcc_send(IRC_SERVER_REC *server, const char *data, { GET_DCC_REC *dcc; IPADDR ip; + const char *address; char **params, *fname; int paramcount, fileparams; int port, len, quoted = FALSE; @@ -333,7 +334,8 @@ static void ctcp_msg_dcc_send(IRC_SERVER_REC *server, const char *data, fileparams = get_file_params_count(params, paramcount); - dcc_str2ip(params[fileparams], &ip); + address = params[fileparams]; + dcc_str2ip(address, &ip); port = atoi(params[fileparams+1]); size = atol(params[fileparams+2]); @@ -357,8 +359,14 @@ static void ctcp_msg_dcc_send(IRC_SERVER_REC *server, const char *data, dcc = dcc_get_create(server, chat, nick, fname); dcc->target = g_strdup(target); - memcpy(&dcc->addr, &ip, sizeof(ip)); - net_ip2host(&dcc->addr, dcc->addrstr); + memcpy(&dcc->addr, &ip, sizeof(ip)); + if (dcc->addr.family == AF_INET) + net_ip2host(&dcc->addr, dcc->addrstr); + else { + /* with IPv6, show it to us as it was sent */ + strncpy(dcc->addrstr, address, sizeof(dcc->addrstr)-1); + dcc->addrstr[sizeof(dcc->addrstr)-1] = '\0'; + } dcc->port = port; dcc->size = size; dcc->file_quoted = quoted; |