From 74b65bfc5f3c58005e3892b314e73cfde32355f6 Mon Sep 17 00:00:00 2001 From: erikjohnston Date: Tue, 2 Nov 2021 14:27:50 +0000 Subject: deploy: 2d44ee6868805d4ff23489a8dd6b4072ff358663 --- latest/modules/presence_router_callbacks.html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'latest/modules/presence_router_callbacks.html') diff --git a/latest/modules/presence_router_callbacks.html b/latest/modules/presence_router_callbacks.html index 77cd0275f2..43251d6828 100644 --- a/latest/modules/presence_router_callbacks.html +++ b/latest/modules/presence_router_callbacks.html @@ -99,7 +99,7 @@ @@ -189,6 +189,7 @@ registered using the module API's register_presence_router_callbacksCallbacks

The available presence router callbacks are:

get_users_for_states

+

First introduced in Synapse v1.42.0

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 sets 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