From 5b2b38ab37fcc891651f43f63c0c13755cd8694f Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Tue, 21 May 2024 21:19:14 +0200 Subject: [PATCH] Add per-network 'vhost' and 'vhostv6' config variables --- src/conf.py | 9 +++++++++ src/drivers/Socket.py | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/conf.py b/src/conf.py index c29f04c87..0544613ab 100644 --- a/src/conf.py +++ b/src/conf.py @@ -419,6 +419,15 @@ def registerNetwork(name, password='', ssl=True, sasl_username='', registry.String('', _("""Determines what user modes the bot will request from the server when it first connects. If empty, defaults to supybot.protocols.irc.umodes"""))) + registerGlobalValue(network, 'vhost', + registry.String('', _("""Determines what vhost the bot will bind to before + connecting a server (IRC, HTTP, ...) via IPv4. If empty, defaults to + supybot.protocols.irc.vhost"""))) + registerGlobalValue(network, 'vhostv6', + registry.String('', _("""Determines what vhost the bot will bind to before + connecting a server (IRC, HTTP, ...) via IPv6. If empty, defaults to + supybot.protocols.irc.vhostv6"""))) + sasl = registerGroup(network, 'sasl') registerGlobalValue(sasl, 'username', registry.String(sasl_username, _("""Determines what SASL username will be used on %s. This should diff --git a/src/drivers/Socket.py b/src/drivers/Socket.py index 23d242153..7b7f1df98 100644 --- a/src/drivers/Socket.py +++ b/src/drivers/Socket.py @@ -312,8 +312,10 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin): address, port=self.currentServer.port, socks_proxy=socks_proxy, - vhost=conf.supybot.protocols.irc.vhost(), - vhostv6=conf.supybot.protocols.irc.vhostv6(), + vhost=self.networkGroup.get('vhost')() + or conf.supybot.protocols.irc.vhost(), + vhostv6=self.networkGroup.get('vhostv6')() + or conf.supybot.protocols.irc.vhostv6(), ) except socket.error as e: drivers.log.connectError(self.currentServer, e)