mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 11:16:07 -04:00
Add presence federation stream (#9819)
This commit is contained in:
parent
db70435de7
commit
de0d088adc
6 changed files with 426 additions and 31 deletions
|
@ -290,6 +290,30 @@ class PresenceStream(Stream):
|
|||
)
|
||||
|
||||
|
||||
class PresenceFederationStream(Stream):
|
||||
"""A stream used to send ad hoc presence updates over federation.
|
||||
|
||||
Streams the remote destination and the user ID of the presence state to
|
||||
send.
|
||||
"""
|
||||
|
||||
@attr.s(slots=True, auto_attribs=True)
|
||||
class PresenceFederationStreamRow:
|
||||
destination: str
|
||||
user_id: str
|
||||
|
||||
NAME = "presence_federation"
|
||||
ROW_TYPE = PresenceFederationStreamRow
|
||||
|
||||
def __init__(self, hs: "HomeServer"):
|
||||
federation_queue = hs.get_presence_handler().get_federation_queue()
|
||||
super().__init__(
|
||||
hs.get_instance_name(),
|
||||
federation_queue.get_current_token,
|
||||
federation_queue.get_replication_rows,
|
||||
)
|
||||
|
||||
|
||||
class TypingStream(Stream):
|
||||
TypingStreamRow = namedtuple(
|
||||
"TypingStreamRow", ("room_id", "user_ids") # str # list(str)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue