You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
942 B
Python
26 lines
942 B
Python
7 years ago
|
import main
|
||
2 years ago
|
from utils.logging.log import warn
|
||
2 years ago
|
from utils.logging.send import incorrectUsage, sendFailure, sendInfo, sendSuccess
|
||
7 years ago
|
|
||
2 years ago
|
|
||
7 years ago
|
def parseCommand(addr, authed, data):
|
||
2 years ago
|
# call command modules with: (addr, authed, data, spl, success, failure, info, incUsage, length)
|
||
7 years ago
|
spl = data.split()
|
||
7 years ago
|
if addr in main.connections.keys():
|
||
|
obj = main.connections[addr]
|
||
7 years ago
|
else:
|
||
|
warn("Got connection object with no instance in the address pool")
|
||
|
return
|
||
|
|
||
2 years ago
|
success = lambda data: sendSuccess(addr, data) # noqa: E731
|
||
|
failure = lambda data: sendFailure(addr, data) # noqa: E731
|
||
|
info = lambda data: sendInfo(addr, data) # noqa: E731
|
||
7 years ago
|
|
||
2 years ago
|
incUsage = lambda mode: incorrectUsage(addr, mode) # noqa: E731
|
||
7 years ago
|
length = len(spl)
|
||
6 years ago
|
if spl[0] in main.CommandMap.keys():
|
||
2 years ago
|
main.CommandMap[spl[0]](addr, authed, data, obj, spl, success, failure, info, incUsage, length)
|
||
6 years ago
|
return
|
||
7 years ago
|
incUsage(None)
|
||
|
return
|