Check registration status before joining channels

Do not join channels if any relay for a network is unregistered.
This commit is contained in:
Mark Veidemanis 2020-05-31 13:09:58 +01:00
parent 4f9ca6088b
commit 5c6b626396
2 changed files with 5 additions and 2 deletions

View File

@ -183,9 +183,12 @@ class IRCBot(IRCClient):
increment = 0.7 increment = 0.7
increment += 0.1 increment += 0.1
else: 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): 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.net in main.TempChan.keys():
if self.num in main.TempChan[self.net].keys(): if self.num in main.TempChan[self.net].keys():
self.joinChannels(main.TempChan[self.net][self.num]) self.joinChannels(main.TempChan[self.net][self.num])

View File

@ -12,7 +12,7 @@ def allRelaysActive(net):
for i in main.network[net].relays.keys(): for i in main.network[net].relays.keys():
name = net+str(i) name = net+str(i)
if name in main.IRCPool.keys(): 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 existNum += 1
if existNum == relayNum: if existNum == relayNum:
return True return True