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 Default:
def __init__(self, register):
@@ -9,18 +9,18 @@ class Default:
toUnset = False
if length == 1:
optionMap = ["Viewing defaults"]
for i in config["Default"].keys():
optionMap.append("%s: %s" % (i, config["Default"][i]))
for i in main.config["Default"].keys():
optionMap.append("%s: %s" % (i, main.config["Default"][i]))
info("\n".join(optionMap))
return
elif length == 2:
if not spl[1] in config["Default"].keys():
if not spl[1] in main.config["Default"].keys():
failure("No such key: %s" % spl[1])
return
info("%s: %s" % (spl[1], config["Default"][spl[1]]))
info("%s: %s" % (spl[1], main.config["Default"][spl[1]]))
return
elif length == 3:
if not spl[1] in config["Default"].keys():
if not spl[1] in main.config["Default"].keys():
failure("No such key: %s" % spl[1])
return
@@ -48,7 +48,7 @@ class Default:
failure("Protocol must be ssl or plain, not %s" % spl[2])
return
if spl[2] == config["Default"][spl[1]]:
if spl[2] == main.config["Default"][spl[1]]:
failure("Value already exists: %s" % spl[2])
return
@@ -58,7 +58,7 @@ class Default:
failure("Authtype must be sp or ns, not %s" % spl[2])
return
if spl[1] == "enabled":
failure("Use the ConnectOnCreate config parameter to set this")
failure("Use the ConnectOnCreate main.config parameter to set this")
return
if spl[1] == "autojoin":
if not toUnset:
@@ -66,8 +66,8 @@ class Default:
else:
spl[2] = []
config["Default"][spl[1]] = spl[2]
saveConf("config")
main.config["Default"][spl[1]] = spl[2]
main.saveConf("main.config")
if toUnset:
success("Successfully unset key %s" % spl[1])
else: