2018-02-23 22:05:40 +00:00
|
|
|
from core.main import *
|
|
|
|
from utils.logging.log import *
|
|
|
|
from utils.logging.send import *
|
|
|
|
|
|
|
|
def parseCommand(addr, authed, data):
|
|
|
|
#call command modules with: (addr, authed, data, spl, success, failure, info, incUsage, length)
|
|
|
|
spl = data.split()
|
|
|
|
if addr in connections.keys():
|
|
|
|
obj = connections[addr]
|
|
|
|
else:
|
|
|
|
warn("Got connection object with no instance in the address pool")
|
|
|
|
return
|
|
|
|
|
|
|
|
success = lambda data: sendSuccess(addr, data)
|
|
|
|
failure = lambda data: sendFailure(addr, data)
|
|
|
|
info = lambda data: sendInfo(addr, data)
|
|
|
|
|
|
|
|
incUsage = lambda mode: incorrectUsage(addr, mode)
|
|
|
|
length = len(spl)
|
|
|
|
if len(spl) > 0:
|
|
|
|
cmd = spl[0]
|
|
|
|
else:
|
|
|
|
failure("No text was sent")
|
|
|
|
return
|
|
|
|
for i in CommandMap.keys():
|
2018-02-23 23:26:21 +00:00
|
|
|
if spl[0] == i:
|
2018-02-23 22:05:40 +00:00
|
|
|
CommandMap[i](addr, authed, data, obj, spl, success, failure, info, incUsage, length)
|
|
|
|
return
|
|
|
|
incUsage(None)
|
|
|
|
return
|