Add more comments and remove obsolete code

This commit is contained in:
2019-12-07 16:35:29 +00:00
parent 9c4ea94ebd
commit 778690ae3a
4 changed files with 30 additions and 43 deletions

23
main.py
View File

@@ -6,6 +6,7 @@ from os import urandom
from utils.logging.log import *
# List of errors ZNC can give us
ZNCErrors = ["Error:",
"Unable to load",
"does not exist",
@@ -28,17 +29,32 @@ filemap = {
"network": ["network.dat", "network list", "pickle"]
}
# Connections to the plain-text interface
connections = {}
# Connections to the JSON interface
relayConnections = {}
# Mapping of network names to Protocol (IRCClient) instances
IRCPool = {}
# Mapping of network names to Reactor instances
# Needed for calling .disconnect()
ReactorPool = {}
# Mapping of network names to Factory instances
# Needed for calling .stopTrying()
FactoryPool = {}
# Temporary store for channels allocated after a LIST
# Will get purged as the instances fire up and pop() from
# their respective keys in here
TempChan = {}
MonitorPool = []
# Mapping of command names to their functions
CommandMap = {}
# Incremented by 1 for each event reaching modules.counters.event()
# and cloned into lastMinuteSample every minute
runningSample = 0
lastMinuteSample = 0
@@ -46,6 +62,7 @@ lastMinuteSample = 0
hashKey = urandom(16)
lastEvents = {}
# Get networks that are currently online and dedupliate
def liveNets():
networks = set()
for i in IRCPool.keys():
@@ -67,7 +84,7 @@ def loadConf(var):
with open(configPath+filemap[var][0], "r") as f:
globals()[var] = json.load(f)
if var == "alias":
# This is a hack to convert all the keys into integers since JSON
# This is a workaround to convert all the keys into integers since JSON
# turns them into strings...
# Dammit Jason!
global alias