summaryrefslogtreecommitdiff
path: root/src/plugins/xfer/xfer.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-09-14 20:48:58 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-09-14 20:48:58 +0200
commite62ff286ff4141e276f22b834b09aa72ac509799 (patch)
tree36e5ed573ad53c8e62f57da1b163facf7bf1734e /src/plugins/xfer/xfer.c
parentcb680ef9df94c3e64cd4d217b2eb64e414ad91e1 (diff)
downloadweechat-e62ff286ff4141e276f22b834b09aa72ac509799.zip
xfer: fix crash on `/dcc chat`
Diffstat (limited to 'src/plugins/xfer/xfer.c')
-rw-r--r--src/plugins/xfer/xfer.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c
index aaa13680a..317cd4277 100644
--- a/src/plugins/xfer/xfer.c
+++ b/src/plugins/xfer/xfer.c
@@ -702,7 +702,7 @@ xfer_new (const char *plugin_name, const char *plugin_id,
new_xfer->remote_address_str = strdup ("");
}
- if (XFER_IS_PASSIVE(type))
+ if (XFER_IS_FILE_PASSIVE(type) || (type == XFER_TYPE_CHAT_SEND))
{
rc = getnameinfo ((struct sockaddr *)local_address, local_address_length, str_address,
sizeof (str_address), NULL, 0, NI_NUMERICHOST);
@@ -1102,7 +1102,8 @@ xfer_add_cb (const void *pointer, void *data,
}
}
- if (XFER_IS_RECV(type))
+ if ((type == XFER_TYPE_FILE_RECV_ACTIVE)
+ || (type == XFER_TYPE_FILE_RECV_PASSIVE))
{
filename2 = strdup (filename);
sscanf (weechat_infolist_string (infolist, "size"), "%llu", &file_size);
@@ -1203,7 +1204,7 @@ xfer_add_cb (const void *pointer, void *data,
goto error;
}
}
- if (XFER_IS_PASSIVE(type))
+ if (XFER_IS_FILE_PASSIVE(type) || (type == XFER_TYPE_CHAT_SEND))
{
memset (&bind_addr, 0, sizeof (bind_addr));
@@ -1351,7 +1352,8 @@ xfer_add_cb (const void *pointer, void *data,
}
}
- if (XFER_IS_RECV(type))
+ if ((type == XFER_TYPE_FILE_RECV_ACTIVE)
+ || (type == XFER_TYPE_FILE_RECV_PASSIVE))
{
if (filename2)
{
@@ -1365,14 +1367,19 @@ xfer_add_cb (const void *pointer, void *data,
{
ptr_xfer = xfer_new (plugin_name, plugin_id, type, protocol,
remote_nick, local_nick, charset_modifier,
- short_filename, file_size, proxy, remote_addr,
- remote_addr_length, local_addr, local_addr_length, port, sock, filename2, token);
+ short_filename, file_size, proxy,
+ remote_addr, remote_addr_length,
+ local_addr, local_addr_length,
+ port, sock, filename2, token);
}
else
{
ptr_xfer = xfer_new (plugin_name, plugin_id, type, protocol,
- remote_nick, local_nick, charset_modifier, NULL,
- 0, proxy, NULL, 0, local_addr, local_addr_length, port, sock, NULL, token);
+ remote_nick, local_nick, charset_modifier,
+ NULL, 0, proxy,
+ remote_addr, remote_addr_length,
+ local_addr, local_addr_length,
+ port, sock, NULL, token);
}
if (!ptr_xfer)