From 91885170f19944e41d19dfd9820a18ef9a5297ca Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sun, 31 May 2020 13:09:58 +0100 Subject: [PATCH] Check registration status before joining channels Do not join channels if any relay for a network is unregistered. --- core/bot.py | 5 ++++- modules/chankeep.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/bot.py b/core/bot.py index 90b5baf..90bf653 100644 --- a/core/bot.py +++ b/core/bot.py @@ -183,9 +183,12 @@ class IRCBot(IRCClient): increment = 0.7 increment += 0.1 else: - error("%s - %i - Cannot join channel we are already on - %s" % (self.net, self.num, i)) + error("%s - Cannot join channel we are already on: %s - %i" % (i, self.net, self.num)) def checkChannels(self): + if not chankeep.allRelaysActive(self.net): + debug("Skipping channel check as we have inactive relays: %s - %i" % (self.net, self.num)) + return if self.net in main.TempChan.keys(): if self.num in main.TempChan[self.net].keys(): self.joinChannels(main.TempChan[self.net][self.num]) diff --git a/modules/chankeep.py b/modules/chankeep.py index 83edcef..9c9aac3 100644 --- a/modules/chankeep.py +++ b/modules/chankeep.py @@ -12,7 +12,7 @@ def allRelaysActive(net): for i in main.network[net].relays.keys(): name = net+str(i) if name in main.IRCPool.keys(): - if main.IRCPool[name].isconnected: + if main.IRCPool[name].isconnected and main.network[net].relays[i]["registered"]: existNum += 1 if existNum == relayNum: return True