mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-05-06 14:25:00 -04:00
Add basic implementation of local device list changes
This commit is contained in:
parent
ba8e144554
commit
2367c5568c
14 changed files with 348 additions and 39 deletions
|
@ -115,6 +115,7 @@ class SyncResult(collections.namedtuple("SyncResult", [
|
|||
"invited", # InvitedSyncResult for each invited room.
|
||||
"archived", # ArchivedSyncResult for each archived room.
|
||||
"to_device", # List of direct messages for the device.
|
||||
"device_lists", # List of user_ids whose devices have chanegd
|
||||
])):
|
||||
__slots__ = []
|
||||
|
||||
|
@ -143,6 +144,7 @@ class SyncHandler(object):
|
|||
self.clock = hs.get_clock()
|
||||
self.response_cache = ResponseCache(hs)
|
||||
self.state = hs.get_state_handler()
|
||||
self.device_handler = hs.get_device_handler()
|
||||
|
||||
def wait_for_sync_for_user(self, sync_config, since_token=None, timeout=0,
|
||||
full_state=False):
|
||||
|
@ -544,6 +546,16 @@ class SyncHandler(object):
|
|||
|
||||
yield self._generate_sync_entry_for_to_device(sync_result_builder)
|
||||
|
||||
if since_token and since_token.device_list_key:
|
||||
user_id = sync_config.user.to_string()
|
||||
rooms = yield self.store.get_rooms_for_user(user_id)
|
||||
joined_room_ids = set(r.room_id for r in rooms)
|
||||
device_lists = yield self.device_handler.get_device_list_changes(
|
||||
user_id, joined_room_ids, since_token.device_list_key
|
||||
)
|
||||
else:
|
||||
device_lists = []
|
||||
|
||||
defer.returnValue(SyncResult(
|
||||
presence=sync_result_builder.presence,
|
||||
account_data=sync_result_builder.account_data,
|
||||
|
@ -551,6 +563,7 @@ class SyncHandler(object):
|
|||
invited=sync_result_builder.invited,
|
||||
archived=sync_result_builder.archived,
|
||||
to_device=sync_result_builder.to_device,
|
||||
device_lists=device_lists,
|
||||
next_batch=sync_result_builder.now_token,
|
||||
))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue