Upload E2E keys to server if needed
This commit is contained in:
parent
15da828c70
commit
5ff82471fc
1
TODO.md
1
TODO.md
@ -37,6 +37,7 @@
|
||||
- Status message and presence
|
||||
|
||||
- Client improvements
|
||||
- Initial sync filter and lazy load, see weechat-matrix `_handle_login()`
|
||||
- HTTP/2
|
||||
- `retry_after_ms` when rate-limited
|
||||
- Direct chats category
|
||||
|
@ -87,6 +87,10 @@ class Client(QObject):
|
||||
def login(self, password: str, device_name: str = "") -> "Client":
|
||||
response = self.net.talk(self.nio.login, password, device_name)
|
||||
self.nio_sync.receive_response(response)
|
||||
|
||||
if not self.nio.olm_account_shared:
|
||||
self._keys_upload()
|
||||
|
||||
return self
|
||||
|
||||
|
||||
@ -97,9 +101,19 @@ class Client(QObject):
|
||||
response = nio.LoginResponse(user_id, device_id, token)
|
||||
self.nio.receive_response(response)
|
||||
self.nio_sync.receive_response(response)
|
||||
|
||||
if not self.nio.olm_account_shared:
|
||||
self._keys_upload()
|
||||
|
||||
return self
|
||||
|
||||
|
||||
@futurize(pyqt=False)
|
||||
def _keys_upload(self) -> None:
|
||||
print("uploading key")
|
||||
self.net.talk(self.nio.keys_upload)
|
||||
|
||||
|
||||
@pyqtSlot(result="QVariant")
|
||||
@futurize()
|
||||
def logout(self) -> "Client":
|
||||
@ -127,6 +141,9 @@ class Client(QObject):
|
||||
def _on_sync(self, response: nio.SyncResponse) -> None:
|
||||
self.nio.receive_response(response)
|
||||
|
||||
if self.nio.should_upload_keys:
|
||||
self._keys_upload()
|
||||
|
||||
for room_id, room_info in response.rooms.invite.items():
|
||||
for ev in room_info.invite_state:
|
||||
member_ev = isinstance(ev, nio.InviteMemberEvent)
|
||||
|
Loading…
Reference in New Issue
Block a user