From 8895ffdc1cc95110ec0eb2c71e427257d652aec5 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Thu, 1 Jan 2004 20:09:35 +0000 Subject: [PATCH] Should fix bugs #858964 #862544. --- plugins/DCC.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/DCC.py b/plugins/DCC.py index 03d0b8b3e..2da4c6b47 100644 --- a/plugins/DCC.py +++ b/plugins/DCC.py @@ -41,6 +41,7 @@ import socket import textwrap import threading +import conf import utils import world import ircmsgs @@ -70,7 +71,17 @@ class DCC(callbacks.Privmsg): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.settimeout(60) host = ircutils.hostFromHostmask(irc.prefix) - ip = socket.gethostbyname(host) + if conf.externalIP is not None: + ip = conf.externalIP + else: + try: + ip = socket.gethostbyname(host) + except socket.error, e: + s = 'Error trying to determine the external IP ' \ + 'address of this machine via the host %s: %s' + self.log.warning(s, host, e) + irc.reply(msg, conf.replyError) + return i = ircutils.dccIP(ip) sock.bind((host, 0)) port = sock.getsockname()[1]