From e9592a7289f9e5d394aacd8fee23adfc5f22ce16 Mon Sep 17 00:00:00 2001 From: miruka Date: Mon, 6 May 2019 23:27:31 -0400 Subject: [PATCH] Query other users's device keys --- TODO.md | 2 ++ harmonyqml/backend/client.py | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/TODO.md b/TODO.md index d9662055..132f3e38 100644 --- a/TODO.md +++ b/TODO.md @@ -11,6 +11,7 @@ - `MessageDelegate.qml:63: TypeError: 'reloadPreviousItem' not a function` - UI + - "the tree arrows could be smaller" - Improve SidePane appearance when at min width - Accounts delegates background - Server selection @@ -38,6 +39,7 @@ - Client improvements - Initial sync filter and lazy load, see weechat-matrix `_handle_login()` + - See also `handle_response()`'s `keys_query` request - HTTP/2 - `retry_after_ms` when rate-limited - Direct chats category diff --git a/harmonyqml/backend/client.py b/harmonyqml/backend/client.py index ae7b6d0d..13072584 100644 --- a/harmonyqml/backend/client.py +++ b/harmonyqml/backend/client.py @@ -81,6 +81,18 @@ class Client(QObject): return self.nio.user_id + @futurize(pyqt=False) + def _keys_upload(self) -> None: + print("uploading key") + self.net.talk(self.nio.keys_upload) + + + @futurize(max_instances=1, pyqt=False) + def _keys_query(self) -> None: + print("querying keys") + self.net.talk(self.nio.keys_query) + + @pyqtSlot(str, result="QVariant") @pyqtSlot(str, str, result="QVariant") @futurize() @@ -108,12 +120,6 @@ class Client(QObject): 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": @@ -144,6 +150,9 @@ class Client(QObject): if self.nio.should_upload_keys: self._keys_upload() + if self.nio.should_query_keys: + self._keys_query() + for room_id, room_info in response.rooms.invite.items(): for ev in room_info.invite_state: member_ev = isinstance(ev, nio.InviteMemberEvent)