Renovate the module system and implement adding and resuming pool instances using the new relay/alias/network system
This commit is contained in:
@@ -2,12 +2,11 @@ import main
|
||||
from yaml import dump
|
||||
|
||||
class Mod:
|
||||
def __init__(self, register):
|
||||
register("mod", self.mod)
|
||||
def __init__(self, *args):
|
||||
self.mod(*args)
|
||||
|
||||
def mod(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length):
|
||||
if authed:
|
||||
toUnset = False
|
||||
if length == 2:
|
||||
if not spl[1] in main.pool.keys():
|
||||
failure("Name does not exist: %s" % spl[1])
|
||||
@@ -33,51 +32,17 @@ class Mod:
|
||||
failure("No such key: %s" % spl[2])
|
||||
return
|
||||
|
||||
if spl[2] == "protocol":
|
||||
if not spl[3] in ["ssl", "plain"]:
|
||||
failure("Protocol must be ssl or plain, not %s" % spl[3])
|
||||
return
|
||||
if spl[3] == main.pool[spl[1]][spl[2]]:
|
||||
failure("Value already exists: %s" % spl[3])
|
||||
return
|
||||
|
||||
if spl[3].lower() in ["none", "nil"]:
|
||||
spl[3] = None
|
||||
toUnset = True
|
||||
|
||||
if spl[2] in ["port", "timeout", "maxdelay"]:
|
||||
try:
|
||||
spl[3] = int(spl[3])
|
||||
except:
|
||||
failure("Value must be an integer, not %s" % spl[3])
|
||||
return
|
||||
|
||||
if spl[2] in ["initialdelay", "factor", "jitter"]:
|
||||
try:
|
||||
spl[3] = float(spl[3])
|
||||
except:
|
||||
failure("Value must be a floating point integer, not %s" % spl[3])
|
||||
return
|
||||
|
||||
if spl[2] == "authtype":
|
||||
if not toUnset:
|
||||
if not spl[3] in ["sp", "ns"]:
|
||||
failure("Authtype must be sp or ns, not %s" % spl[3])
|
||||
return
|
||||
if spl[2] == "enabled":
|
||||
failure("Use the enable and disable commands to manage this")
|
||||
return
|
||||
if spl[2] == "autojoin":
|
||||
spl[3] = spl[3].split(",")
|
||||
|
||||
main.pool[spl[1]][spl[2]] = spl[3]
|
||||
if spl[1] in main.IRCPool.keys():
|
||||
main.IRCPool[spl[1]].refresh()
|
||||
main.saveConf("pool")
|
||||
if toUnset:
|
||||
success("Successfully unset key %s on %s" % (spl[2], spl[1]))
|
||||
else:
|
||||
success("Successfully set key %s to %s on %s" % (spl[2], spl[3], spl[1]))
|
||||
success("Successfully set key %s to %s on %s" % (spl[2], spl[3], spl[1]))
|
||||
return
|
||||
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user