2019-10-12 20:05:55 +00:00
|
|
|
import main
|
|
|
|
|
2022-07-21 12:39:41 +00:00
|
|
|
|
2019-10-12 20:05:55 +00:00
|
|
|
class ListCommand:
|
|
|
|
def __init__(self, *args):
|
|
|
|
self.list(*args)
|
|
|
|
|
2022-07-21 12:40:01 +00:00
|
|
|
def list(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length):
|
2019-10-12 20:05:55 +00:00
|
|
|
if authed:
|
2020-05-31 12:08:00 +00:00
|
|
|
if length == 1:
|
|
|
|
for i in main.network.keys():
|
|
|
|
if not 1 in main.network[i].relays.keys():
|
|
|
|
info("Network has no first instance: %s" % i)
|
|
|
|
continue
|
2022-07-21 12:39:41 +00:00
|
|
|
if not i + "1" in main.IRCPool.keys():
|
2020-05-31 12:08:00 +00:00
|
|
|
info("No IRC instance: %s - 1" % i)
|
|
|
|
continue
|
2022-07-21 12:39:41 +00:00
|
|
|
main.IRCPool[i + "1"].list()
|
2020-05-31 12:08:00 +00:00
|
|
|
success("Requested list with first instance of %s" % i)
|
|
|
|
return
|
|
|
|
elif length == 2:
|
2019-10-12 20:05:55 +00:00
|
|
|
if not spl[1] in main.network.keys():
|
|
|
|
failure("No such network: %s" % spl[1])
|
|
|
|
return
|
|
|
|
if not 1 in main.network[spl[1]].relays.keys():
|
|
|
|
failure("Network has no first instance")
|
|
|
|
return
|
2022-07-21 12:39:41 +00:00
|
|
|
if not spl[1] + "1" in main.IRCPool.keys():
|
2019-10-12 20:05:55 +00:00
|
|
|
failure("No IRC instance: %s - 1" % spl[1])
|
|
|
|
return
|
2022-07-21 12:39:41 +00:00
|
|
|
main.IRCPool[spl[1] + "1"].list()
|
2019-10-12 20:05:55 +00:00
|
|
|
success("Requested list with first instance of %s" % spl[1])
|
|
|
|
return
|
|
|
|
else:
|
|
|
|
incUsage("list")
|
|
|
|
return
|
|
|
|
else:
|
|
|
|
incUsage(None)
|