Only completely prevent CAP END when we get RESUME SUCCESS (resume.py)

This commit is contained in:
jesopo 2019-02-17 12:48:22 +00:00
parent be495344d4
commit 107205d29a

View file

@ -32,12 +32,17 @@ class Module(ModuleManager.BaseModule):
@utils.hook("received.resume")
def on_resume(self, event):
cap_done = False
if event["args"][0] == "SUCCESS":
resume_channels = event["server"].get_setting("resume-channels", [])
self.log.info("Successfully resumed session", [])
event["server"].cap_started = False
cap_done = True
elif event["args"][0] == "ERR":
self.log.info("Failed to resume session: %s", [event["args"][1]])
cap_done = True
elif event["args"][0] == "TOKEN":
token = self._get_token(event["server"])
@ -48,9 +53,12 @@ class Module(ModuleManager.BaseModule):
event["server"].send("RESUME %s%s" %
(token, " %s" % timestamp if timestamp else ""))
event["server"].cap_started = False
else:
cap_done = True
if cap_done:
event["server"].capability_done("resume")
event["server"].capability_done("resume")
@utils.hook("received.001")
def on_connect(self, event):