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