From 20d75e9716787d69a0104f776fade3bafe623772 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sun, 10 Feb 2019 00:03:14 +0000 Subject: [PATCH] Send request to RESUME a session AFTER we have a new token (resume.py) --- modules/resume.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/resume.py b/modules/resume.py index f464a531..37e921f0 100644 --- a/modules/resume.py +++ b/modules/resume.py @@ -11,15 +11,12 @@ class Module(ModuleManager.BaseModule): @utils.hook("received.cap.ls") def on_cap_ls(self, event): nickname, token = self._get_token(event["server"]) - if CAP in event["capabilities"] and (not nickname or not token): + if CAP in event["capabilities"]: event["server"].queue_capability(CAP) @utils.hook("received.cap.ack") def on_cap_ack(self, event): - nickname, token = self._get_token(event["server"]) - if CAP in event["capabilities"] and nickname and token: - event["server"].send("RESUME %s %s" % (nickname, token)) - event["server"].cap_started = False + event["server"].wait_for_capability("resume") @utils.hook("received.resume") def on_resume(self, event): @@ -30,6 +27,11 @@ class Module(ModuleManager.BaseModule): elif event["args"][0] == "TOKEN": event["server"].connection_params.args["new-resume-token" ] = event["args"][1] + nickname, token = self._get_token(event["server"]) + + if nickname and token: + event["server"].send("RESUME %s %s" % (nickname, token)) + event["server"].capability_done("resume") @utils.hook("received.numeric.001") def on_connect(self, event):