]> jfr.im git - irc/quakenet/qwebirc.git/commitdiff
Merge soczol's patch from https://bitbucket.org/soczol/qwebirc/changeset/450739e6defd
authorChris Porter <redacted>
Sat, 19 Feb 2011 04:42:38 +0000 (04:42 +0000)
committerChris Porter <redacted>
Sat, 19 Feb 2011 04:42:38 +0000 (04:42 +0000)
(with a few changes).

config.py.example
qwebirc/ircclient.py

index 7bdda5d9f02feb56ef025c91e9465b8de3506979..485b0f3a5157aa7fff07bc3b01aa873a68f2d7d8 100644 (file)
@@ -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.
index efda3d4c2a9a37082da1159318bd73884eb15155..f517430fccb5efe12919c5b4487d5c64458ba715 100644 (file)
@@ -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?!