From 60f7a84383de1a1670230931f0c0a626926fba15 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sat, 13 Aug 2022 22:36:18 +0100 Subject: [PATCH] Add helper to get all active relays --- modules/helpers.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/modules/helpers.py b/modules/helpers.py index cd0c510..3c4efdf 100644 --- a/modules/helpers.py +++ b/modules/helpers.py @@ -33,3 +33,19 @@ def is_first_relay(net, num): if not first_relay: return False return first_relay.num == num + + +def get_active_relays(net): + """ + Get all active instances for the network. + :param net: the network + :return: list of active instances + :rtype: list of IRCPool instances + """ + active_nums = chankeep.getActiveRelays(net) + active_insts = [] + for num in active_nums: + name = net + str(num) + if name in main.IRCPool.keys(): + active_insts.append(main.IRCPool[name]) + return active_insts