You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.4 KiB
Python

import main
class ListCommand:
def __init__(self, *args):
self.list(*args)
def list(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length):
if authed:
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
if not i + "1" in main.IRCPool.keys():
info("No IRC instance: %s - 1" % i)
continue
main.IRCPool[i + "1"].list()
success("Requested list with first instance of %s" % i)
return
elif length == 2:
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
if not spl[1] + "1" in main.IRCPool.keys():
failure("No IRC instance: %s - 1" % spl[1])
return
main.IRCPool[spl[1] + "1"].list()
success("Requested list with first instance of %s" % spl[1])
return
else:
incUsage("list")
return
else:
incUsage(None)