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,32 +1,34 @@
from core.main import *
import main
from string import digits
#from utils.logging.log import *
def setWho(network, newObjects):
network = "".join([x for x in network if not x in digits])
if not network in wholist.keys():
wholist[network] = {}
if not network in main.wholist.keys():
main.wholist[network] = {}
for i in newObjects.keys():
wholist[network][i] = newObjects[i]
main.wholist[network][i] = newObjects[i]
return
def setWhoSingle(network, nick, ident, host):
network = "".join([x for x in network if not x in digits])
if network in wholist.keys():
if nick in wholist[network].keys():
wholist[network][nick][1] = ident
wholist[network][nick][2] = host
if network in main.wholist.keys():
if nick in main.wholist[network].keys():
main.wholist[network][nick][1] = ident
main.wholist[network][nick][2] = host
else:
wholist[network][nick] = [nick, ident, host, None, None, None]
main.wholist[network][nick] = [nick, ident, host, None, None, None]
else:
main.wholist[network] = {nick: [nick, ident, host, None, None, None]}
def getWho(nick):
result = {}
for i in wholist.keys():
for x in wholist[i].keys():
for i in main.wholist.keys():
for x in main.wholist[i].keys():
if nick.lower() == x.lower():
if not i in result.keys():
result[i] = []
result[i].append(wholist[i][x])
result[i].append(main.wholist[i][x])
return result