Set users to offline before exiting Mirage

This commit is contained in:
vslg
2020-07-16 22:19:20 -03:00
committed by miruka
parent 189b325a2b
commit b69cbf9d14
2 changed files with 26 additions and 0 deletions

View File

@@ -198,6 +198,16 @@ class Backend:
))
async def logoff_all(self) -> None:
"""Stop syncing and end all clients registered."""
await asyncio.gather(*[
client.set_presence("offline", save=False)
for client in self.clients.values()
if client._presence != "offline"
])
async def logout_client(self, user_id: str) -> None:
"""Log a `MatrixClient` out and unregister it from our models."""