mirror of
				https://github.com/matrix-org/synapse.git
				synced 2025-10-31 16:21:56 +01:00 
			
		
		
		
	Add count of one time keys to sync stream
This commit is contained in:
		
							parent
							
								
									ab4ee2e524
								
							
						
					
					
						commit
						b4f59c7e27
					
				| @ -117,6 +117,8 @@ class SyncResult(collections.namedtuple("SyncResult", [ | |||||||
|     "archived",  # ArchivedSyncResult for each archived room. |     "archived",  # ArchivedSyncResult for each archived room. | ||||||
|     "to_device",  # List of direct messages for the device. |     "to_device",  # List of direct messages for the device. | ||||||
|     "device_lists",  # List of user_ids whose devices have chanegd |     "device_lists",  # List of user_ids whose devices have chanegd | ||||||
|  |     "device_one_time_keys_count",  # Dict of algorithm to count for one time keys | ||||||
|  |                                    # for this device | ||||||
| ])): | ])): | ||||||
|     __slots__ = [] |     __slots__ = [] | ||||||
| 
 | 
 | ||||||
| @ -550,6 +552,14 @@ class SyncHandler(object): | |||||||
|             sync_result_builder |             sync_result_builder | ||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
|  |         device_id = sync_config.device_id | ||||||
|  |         one_time_key_counts = {} | ||||||
|  |         if device_id: | ||||||
|  |             user_id = sync_config.user.to_string() | ||||||
|  |             one_time_key_counts = yield self.store.count_e2e_one_time_keys( | ||||||
|  |                 user_id, device_id | ||||||
|  |             ) | ||||||
|  | 
 | ||||||
|         defer.returnValue(SyncResult( |         defer.returnValue(SyncResult( | ||||||
|             presence=sync_result_builder.presence, |             presence=sync_result_builder.presence, | ||||||
|             account_data=sync_result_builder.account_data, |             account_data=sync_result_builder.account_data, | ||||||
| @ -558,6 +568,7 @@ class SyncHandler(object): | |||||||
|             archived=sync_result_builder.archived, |             archived=sync_result_builder.archived, | ||||||
|             to_device=sync_result_builder.to_device, |             to_device=sync_result_builder.to_device, | ||||||
|             device_lists=device_lists, |             device_lists=device_lists, | ||||||
|  |             device_one_time_keys_count=one_time_key_counts, | ||||||
|             next_batch=sync_result_builder.now_token, |             next_batch=sync_result_builder.now_token, | ||||||
|         )) |         )) | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -192,6 +192,7 @@ class SyncRestServlet(RestServlet): | |||||||
|                 "invite": invited, |                 "invite": invited, | ||||||
|                 "leave": archived, |                 "leave": archived, | ||||||
|             }, |             }, | ||||||
|  |             "device_one_time_keys_count": sync_result.device_one_time_keys_count, | ||||||
|             "next_batch": sync_result.next_batch.to_string(), |             "next_batch": sync_result.next_batch.to_string(), | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user