summaryrefslogtreecommitdiff
path: root/src/irc/dcc/dcc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/irc/dcc/dcc.c')
-rw-r--r--src/irc/dcc/dcc.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/irc/dcc/dcc.c b/src/irc/dcc/dcc.c
index b586a51e..37bc7854 100644
--- a/src/irc/dcc/dcc.c
+++ b/src/irc/dcc/dcc.c
@@ -29,6 +29,7 @@
#include "levels.h"
#include "irc-servers.h"
+#include "servers-setup.h"
#include "dcc-chat.h"
#include "dcc-get.h"
@@ -199,7 +200,7 @@ GIOChannel *dcc_listen(GIOChannel *iface, IPADDR *ip, int *port)
int first, last;
if (net_getsockname(iface, ip, NULL) == -1)
- return NULL;
+ return NULL;
/* get first port */
dcc_port = settings_get_str("dcc_port");
@@ -233,6 +234,22 @@ GIOChannel *dcc_listen(GIOChannel *iface, IPADDR *ip, int *port)
return NULL;
}
+/* Connect to specified IP address using the correct own_ip. */
+GIOChannel *dcc_connect_ip(IPADDR *ip, int port)
+{
+ IPADDR *own_ip, temp_ip;
+
+ if (*settings_get_str("dcc_own_ip") == '\0') {
+ own_ip = IPADDR_IS_V6(ip) ? source_host_ip6 : source_host_ip4;
+ } else {
+ /* use the specified interface for connecting */
+ net_host2ip(settings_get_str("dcc_own_ip"), &temp_ip);
+ own_ip = &temp_ip;
+ }
+
+ return net_connect_ip(ip, port, own_ip);
+}
+
/* Server connected - update server for DCC records that have
the same server tag */
static void sig_server_connected(IRC_SERVER_REC *server)