diff options
author | Chris Porter <slug@qwebirc.org> | 2011-02-19 04:42:38 (GMT) |
---|---|---|
committer | Chris Porter <slug@qwebirc.org> | 2011-02-19 04:42:38 (GMT) |
commit | 4406eb56a940e385a5a427e9d1abc9e3a2a1042d (patch) | |
tree | c14d326342fe528b21a5c43dc7112901e9d683ab | |
parent | 72e219f8082d2ea824946d89e331b11a0c31d7f1 (diff) |
Merge soczol's patch from https://bitbucket.org/soczol/qwebirc/changeset/450739e6defd
(with a few changes).
-rw-r--r-- | config.py.example | 8 | ||||
-rw-r--r-- | qwebirc/ircclient.py | 9 |
2 files changed, 15 insertions, 2 deletions
diff --git a/config.py.example b/config.py.example index 7bdda5d..485b0f3 100644 --- a/config.py.example +++ b/config.py.example @@ -34,6 +34,14 @@ REALNAME = "http://moo.com/" # supplied nickname as their ident. IDENT = "webchat" +# OPTION: OUTGOING_IP +# The IP address to bind to when connecting to the IRC server. +# +# This will not change the IP address that qwebirc listens on. +# You will need to call run.py with the --ip/-i option if you +# want that. +#OUTGOING_IP = "127.0.0.1" + # OPTION: WEBIRC_MODE # This option controls how the IP/hostname of the connecting # browser will be sent to IRC. diff --git a/qwebirc/ircclient.py b/qwebirc/ircclient.py index efda3d4..f517430 100644 --- a/qwebirc/ircclient.py +++ b/qwebirc/ircclient.py @@ -146,13 +146,18 @@ class QWebIRCFactory(protocol.ClientFactory): def createIRC(*args, **kwargs): f = QWebIRCFactory(*args, **kwargs) + + tcpkwargs = {} + if hasattr(config, "OUTGOING_IP"): + tcpkwargs["bindAddress"] = (config.OUTGOING_IP, 0) + if CONNECTION_RESOLVER is None: - reactor.connectTCP(config.IRCSERVER, config.IRCPORT, f) + reactor.connectTCP(config.IRCSERVER, config.IRCPORT, f, **tcpkwargs) return f def callback(result): name, port = random.choice(sorted((str(x.payload.target), x.payload.port) for x in result[0])) - reactor.connectTCP(name, port, f) + reactor.connectTCP(name, port, f, **tcpkwargs) def errback(err): f.clientConnectionFailed(None, err) # None?! |