Implement API for authentication management actions

This commit is contained in:
2022-08-14 12:43:33 +01:00
parent 0b20a05b19
commit f7d390da32
5 changed files with 99 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
import main
from modules import chankeep
from utils.logging.debug import debug
# from utils.logging.debug import debug
def get_first_relay(net):
@@ -53,3 +54,19 @@ def get_active_relays(net):
if name in main.IRCPool.keys():
active_insts.append(main.IRCPool[name])
return active_insts
def get_connected_relays(net):
"""
Get all connected instances for the network.
:param net: the network
:return: list of active instances
:rtype: list of IRCPool instances
"""
active_nums = chankeep.getConnectedRelays(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