diff options
author | Erik Johnston <erikj@jki.re> | 2017-02-01 13:25:26 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-01 13:25:26 +0000 |
commit | bd84387ac6da3b755ca10643a331b24d0a588f99 (patch) | |
tree | 66ba24284aef9cd644e22ed4271bfa6c0ddedbed /synapse/handlers | |
parent | Merge pull request #1870 from matrix-org/erikj/cache_get_all_new_events (diff) | |
parent | Comment (diff) | |
download | synapse-bd84387ac6da3b755ca10643a331b24d0a588f99.tar.xz |
Merge pull request #1869 from matrix-org/erikj/device_list_stream
Implement /keys/changes
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/device.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/synapse/handlers/device.py b/synapse/handlers/device.py index 7245d14fab..4a28d95967 100644 --- a/synapse/handlers/device.py +++ b/synapse/handlers/device.py @@ -221,6 +221,22 @@ class DeviceHandler(BaseHandler): self.federation_sender.send_device_messages(host) @defer.inlineCallbacks + def get_user_ids_changed(self, user_id, from_device_key): + rooms = yield self.store.get_rooms_for_user(user_id) + room_ids = set(r.room_id for r in rooms) + + user_ids_changed = set() + changed = yield self.store.get_user_whose_devices_changed( + from_device_key + ) + for other_user_id in changed: + other_rooms = yield self.store.get_rooms_for_user(other_user_id) + if room_ids.intersection(e.room_id for e in other_rooms): + user_ids_changed.add(other_user_id) + + defer.returnValue(user_ids_changed) + + @defer.inlineCallbacks def _incoming_device_list_update(self, origin, edu_content): user_id = edu_content["user_id"] device_id = edu_content["device_id"] |