From 7e57798f4d699eed550301ca7b7db6fb0da5d47d Mon Sep 17 00:00:00 2001 From: James Lu Date: Fri, 2 Oct 2015 23:07:57 -0700 Subject: [PATCH] core: refresh various serverdata attributes on REHASH --- classes.py | 9 +++++++-- plugins/commands.py | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/classes.py b/classes.py index d37e06e..955a190 100644 --- a/classes.py +++ b/classes.py @@ -21,6 +21,11 @@ class ProtocolError(Exception): class Irc(): def initVars(self): + self.sid = self.serverdata["sid"] + self.botdata = self.conf['bot'] + self.pingfreq = self.serverdata.get('pingfreq') or 30 + self.pingtimeout = self.pingfreq * 2 + self.connected.clear() self.aborted.clear() self.pseudoclient = None @@ -88,10 +93,10 @@ class Irc(): self.pingTimer = None def connect(self): - ip = self.serverdata["ip"] - port = self.serverdata["port"] while True: self.initVars() + ip = self.serverdata["ip"] + port = self.serverdata["port"] checks_ok = True try: self.socket = socket.socket() diff --git a/plugins/commands.py b/plugins/commands.py index d828feb..9af2637 100644 --- a/plugins/commands.py +++ b/plugins/commands.py @@ -341,6 +341,7 @@ def rehash(irc, source, args): del world.networkobjects[network] else: ircobj.conf = new_conf + ircobj.serverdata = new_conf['servers'][network] for network, sdata in new_conf['servers'].items(): # New server was added. Connect them if not already connected. if network not in world.networkobjects: