From 74b65bfc5f3c58005e3892b314e73cfde32355f6 Mon Sep 17 00:00:00 2001
From: erikjohnston The available presence router callbacks are: First introduced in Synapse v1.42.0register_presence_router_callbacks
Callbacks
+get_users_for_states
async def get_users_for_states(
state_updates: Iterable["synapse.api.UserPresenceState"],
) -> Dict[str, Set["synapse.api.UserPresenceState"]]
@@ -199,7 +200,11 @@ be used to instruct the server to forward that presence state to specific users.
must return a dictionary that maps from Matrix user IDs (which can be local or remote) to the
UserPresenceState
changes that they should be forwarded.
Synapse will then attempt to send the specified presence updates to each user when possible.
+If multiple modules implement this callback, Synapse merges all the dictionaries returned +by the callbacks. If multiple callbacks return a dictionary containing the same key, +Synapse concatenates the sets associated with this key from each dictionary.
get_interested_users
First introduced in Synapse v1.42.0
async def get_interested_users(
user_id: str
) -> Union[Set[str], "synapse.module_api.PRESENCE_ALL_USERS"]
@@ -213,6 +218,11 @@ should return the Matrix user IDs of the users whose presence state they are all
query. The returned users can be local or remote.
Alternatively the callback can return synapse.module_api.PRESENCE_ALL_USERS
to indicate that the user should receive updates from all known users.
+If multiple modules implement this callback, they will be considered in order. Synapse
+calls each callback one by one, and use a concatenation of all the set
s returned by the
+callbacks. If one callback returns synapse.module_api.PRESENCE_ALL_USERS
, Synapse uses
+this value instead. If this happens, Synapse does not call any of the subsequent
+implementations of this callback.
Example
The example below is a module that implements both presence router callbacks, and ensures
that @alice:example.org
receives all presence updates from @bob:example.com
and
--
cgit 1.5.1