mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 15:34:48 -04:00
Send device list updates to application services (MSC3202) - part 1 (#11881)
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
This commit is contained in:
parent
2fc15ac718
commit
d8d0271977
15 changed files with 490 additions and 82 deletions
|
@ -25,6 +25,7 @@ from typing import (
|
|||
Match,
|
||||
MutableMapping,
|
||||
Optional,
|
||||
Set,
|
||||
Tuple,
|
||||
Type,
|
||||
TypeVar,
|
||||
|
@ -748,6 +749,30 @@ class ReadReceipt:
|
|||
data: JsonDict
|
||||
|
||||
|
||||
@attr.s(slots=True, frozen=True, auto_attribs=True)
|
||||
class DeviceListUpdates:
|
||||
"""
|
||||
An object containing a diff of information regarding other users' device lists, intended for
|
||||
a recipient to carry out device list tracking.
|
||||
|
||||
Attributes:
|
||||
changed: A set of users whose device lists have changed recently.
|
||||
left: A set of users who the recipient no longer needs to track the device lists of.
|
||||
Typically when those users no longer share any end-to-end encryption enabled rooms.
|
||||
"""
|
||||
|
||||
# We need to use a factory here, otherwise `set` is not evaluated at
|
||||
# object instantiation, but instead at class definition instantiation.
|
||||
# The latter happening only once, thus always giving you the same sets
|
||||
# across multiple DeviceListUpdates instances.
|
||||
# Also see: don't define mutable default arguments.
|
||||
changed: Set[str] = attr.ib(factory=set)
|
||||
left: Set[str] = attr.ib(factory=set)
|
||||
|
||||
def __bool__(self) -> bool:
|
||||
return bool(self.changed or self.left)
|
||||
|
||||
|
||||
def get_verify_key_from_cross_signing_key(key_info):
|
||||
"""Get the key ID and signedjson verify key from a cross-signing key dict
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue