Some cleanup of the OOBhandler and communication with GMCP.

This commit is contained in:
Griatch 2015-02-14 20:12:09 +01:00
parent 08525f11ee
commit cc39aff62c
2 changed files with 8 additions and 3 deletions

View file

@ -375,12 +375,14 @@ def oob_list(oobhandler, session, mode, *args, **kwargs):
CMD_MAP = {"oob_error": oob_error, # will get error messages
"return_field_report": oob_return_field_report,
"return_attribute_report": oob_return_attribute_report,
# MSDP
"REPEAT": oob_repeat,
"UNREPEAT": oob_unrepeat,
"SEND": oob_send,
"ECHO": oob_echo,
"REPORT": oob_report,
"UNREPORT": oob_unreport,
"LIST": oob_list
"LIST": oob_list,
# GMCP
}

View file

@ -221,12 +221,15 @@ class TelnetOOB(object):
print "decode_gmcp:", data
if data:
splits = data.split(" ", 1)
splits = data.split(None, 1)
cmdname = splits[0]
if len(splits) < 2:
self.protocol.data_in(oob=(cmdname, (), {}))
elif splits[1]:
struct = json.loads(json.dumps(splits[1]))
try:
struct = json.loads(splits[1])
except ValueError:
struct = splits[1]
args, kwargs = (), {}
if hasattr(struct, "__iter__"):
if isinstance(struct, dict):