Import the main module properly and fix some oddities in Twisted to prevent it from discarding some data

This commit is contained in:
2018-03-14 20:13:40 +00:00
parent 5b1e3c6fb1
commit d168d69732
33 changed files with 370 additions and 318 deletions

View File

@@ -1,4 +1,4 @@
from core.main import *
import main
class Mod:
def __init__(self, register):
@@ -8,30 +8,30 @@ class Mod:
if authed:
toUnset = False
if length == 2:
if not spl[1] in pool.keys():
if not spl[1] in main.pool.keys():
failure("Name does not exist: %s" % spl[1])
return
optionMap = ["Viewing options for %s" % spl[1]]
for i in pool[spl[1]].keys():
optionMap.append(" %s: %s" % (i, pool[spl[1]][i]))
for i in main.pool[spl[1]].keys():
optionMap.append(" %s: %s" % (i, main.pool[spl[1]][i]))
info("\n".join(optionMap))
return
elif length == 3:
if not spl[1] in pool.keys():
if not spl[1] in main.pool.keys():
failure("Name does not exist: %s" % spl[1])
return
if not spl[2] in pool[spl[1]].keys():
if not spl[2] in main.pool[spl[1]].keys():
failure("No such key: %s" % spl[2])
return
info("%s: %s" % (spl[2], pool[spl[1]][spl[2]]))
info("%s: %s" % (spl[2], main.pool[spl[1]][spl[2]]))
return
elif length == 4:
if not spl[1] in pool.keys():
if not spl[1] in main.pool.keys():
failure("Name does not exist: %s" % spl[1])
return
if not spl[2] in pool[spl[1]].keys():
if not spl[2] in main.pool[spl[1]].keys():
failure("No such key: %s" % spl[2])
return
@@ -39,7 +39,7 @@ class Mod:
if not spl[3] in ["ssl", "plain"]:
failure("Protocol must be ssl or plain, not %s" % spl[3])
return
if spl[3] == pool[spl[1]][spl[2]]:
if spl[3] == main.pool[spl[1]][spl[2]]:
failure("Value already exists: %s" % spl[3])
return
@@ -72,10 +72,10 @@ class Mod:
if spl[2] == "autojoin":
spl[3] = spl[3].split(",")
pool[spl[1]][spl[2]] = spl[3]
if spl[1] in IRCPool.keys():
IRCPool[spl[1]].refresh()
saveConf("pool")
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: