Skip to content
Snippets Groups Projects
Commit 569f6a7c authored by Tulir Asokan's avatar Tulir Asokan :cat2:
Browse files

Fix bug where sending doesn't work after logging in before restarting

parent df187ee0
No related branches found
No related tags found
No related merge requests found
...@@ -111,15 +111,15 @@ class User(Client): ...@@ -111,15 +111,15 @@ class User(Client):
return True return True
elif not self._session_data: elif not self._session_data:
return False return False
ok = await self.setSession(self._session_data) and await self.is_logged_in() ok = await self.setSession(self._session_data) and await self.is_logged_in(True)
if ok: if ok:
self.log.info("Loaded session successfully") self.log.info("Loaded session successfully")
self.listen() self.listen()
asyncio.ensure_future(self.post_login(), loop=self.loop) asyncio.ensure_future(self.post_login(), loop=self.loop)
return ok return ok
async def is_logged_in(self) -> bool: async def is_logged_in(self, _override: bool = False) -> bool:
if self._is_logged_in is None: if self._is_logged_in is None or _override:
self._is_logged_in = await self.isLoggedIn() self._is_logged_in = await self.isLoggedIn()
return self._is_logged_in return self._is_logged_in
...@@ -128,6 +128,7 @@ class User(Client): ...@@ -128,6 +128,7 @@ class User(Client):
async def logout(self) -> bool: async def logout(self) -> bool:
ok = await super().logout() ok = await super().logout()
self._session_data = None self._session_data = None
self._is_logged_in = False
self.save(_update_session_data=False) self.save(_update_session_data=False)
return ok return ok
...@@ -177,6 +178,7 @@ class User(Client): ...@@ -177,6 +178,7 @@ class User(Client):
:param email: The email of the client :param email: The email of the client
""" """
self._is_logged_in = True
if self.command_status and self.command_status.get("action", "") == "Login": if self.command_status and self.command_status.get("action", "") == "Login":
await self.az.intent.send_notice(self.command_status["room_id"], await self.az.intent.send_notice(self.command_status["room_id"],
f"Successfully logged in with {email}") f"Successfully logged in with {email}")
......
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