Skip to content
Snippets Groups Projects
Commit d9d6fbb0 authored by Paul "LeoNerd" Evans's avatar Paul "LeoNerd" Evans
Browse files

Safer handling of incoming presence EDUs that may or maynot contain 'presence' or 'state'

parent 7b56a7a3
No related branches found
No related tags found
No related merge requests found
...@@ -655,10 +655,20 @@ class PresenceHandler(BaseHandler): ...@@ -655,10 +655,20 @@ class PresenceHandler(BaseHandler):
state = dict(push) state = dict(push)
del state["user_id"] del state["user_id"]
# Legacy handling if "presence" in state:
if "presence" not in state: # all is OK
pass
elif "state" in state:
# Legacy handling
state["presence"] = state["state"] state["presence"] = state["state"]
del state["state"] else:
logger.warning("Received a presence 'push' EDU from %s without"
+ " either a 'presence' or 'state' key", origin
)
continue
if "state" in state:
del state["state"]
if "last_active_ago" in state: if "last_active_ago" in state:
state["last_active"] = int( state["last_active"] = int(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment