aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar klea2026-05-01 14:45:47 +0000
committerGravatar klea2026-05-01 14:54:35 +0000
commit8ce44439fe403fc7a81c741c331a7b8bbee1794b (patch)
tree0afe91a7491eeb1f8e0d4d502b5fea502627ada5
parentTrim spaces from CAP responses (diff)
signature
Allow having certain irc config changes without reconnect
-rw-r--r--http2irc.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/http2irc.py b/http2irc.py
index da47dc2..a73f23d 100644
--- a/http2irc.py
+++ b/http2irc.py
@@ -871,7 +871,16 @@ class IRCClient:
self._protocol = None
def update_config(self, config):
- needReconnect = self.config['irc'] != config['irc']
+ ircSectionReconnectNeededKeys = [
+ 'host', 'port', # If we're connecting to different server
+ 'ssl', # Using or no longer using SSL,
+ 'family', # Via a different protocol
+ 'nick', # TODO: Changing nick could be implemented without reconnects
+ 'real', # Might be able to work without reconnects on certain IRCds.
+ 'certfile', 'certkeyfile' # If using different certificate.
+ ]
+ needReconnect = any(self.config['irc'][key] != config['irc'][key] for key in ircSectionReconnectNeededKeys)
+
self.config = config
if self._transport: # if currently connected:
if needReconnect:
@@ -879,6 +888,8 @@ class IRCClient:
else:
self.channels = {map_['ircchannel'] for map_ in config['maps'].values()}
self._protocol.update_channels(self.channels)
+ self._protocol.config = config
+
def _get_ssl_context(self):
ctx = SSL_CONTEXTS[self.config['irc']['ssl']]