From 68c861abaabcf5724dff2ef56814920ca2e866c1 Mon Sep 17 00:00:00 2001 From: DMRobertson Date: Wed, 16 Feb 2022 12:26:14 +0000 Subject: [PATCH] deploy: 73fc4887834b33afaf23ff48a68772f8ef9b924c --- develop/modules/spam_checker_callbacks.html | 42 ++++++++++++++------- develop/print.html | 42 ++++++++++++++------- develop/searchindex.js | 2 +- develop/searchindex.json | 2 +- 4 files changed, 58 insertions(+), 30 deletions(-) diff --git a/develop/modules/spam_checker_callbacks.html b/develop/modules/spam_checker_callbacks.html index a05d1d86a2..c20d27d114 100644 --- a/develop/modules/spam_checker_callbacks.html +++ b/develop/modules/spam_checker_callbacks.html @@ -192,10 +192,14 @@ Synapse instances. Spam checker callbacks can be registered using the module API

First introduced in Synapse v1.37.0

async def check_event_for_spam(event: "synapse.events.EventBase") -> Union[bool, str]
 
-

Called when receiving an event from a client or via federation. The module can return -either a bool to indicate whether the event must be rejected because of spam, or a str -to indicate the event must be rejected because of spam and to give a rejection reason to -forward to clients.

+

Called when receiving an event from a client or via federation. The callback must return +either:

+

If multiple modules implement this callback, they will be considered in order. If a callback returns False, Synapse falls through to the next one. The value of the first callback that does not return False will be used. If this happens, Synapse will not call @@ -205,7 +209,9 @@ any of the subsequent implementations of this callback.

async def user_may_join_room(user: str, room: str, is_invited: bool) -> bool
 

Called when a user is trying to join a room. The module must return a bool to indicate -whether the user can join the room. The user is represented by their Matrix user ID (e.g. +whether the user can join the room. Return False to prevent the user from joining the +room; otherwise return True to permit the joining.

+

The user is represented by their Matrix user ID (e.g. @alice:example.com) and the room is represented by its Matrix ID (e.g. !room:example.com). The module is also given a boolean to indicate whether the user currently has a pending invite in the room.

@@ -221,7 +227,8 @@ any of the subsequent implementations of this callback.

Called when processing an invitation. The module must return a bool indicating whether the inviter can invite the invitee to the given room. Both inviter and invitee are -represented by their Matrix user ID (e.g. @alice:example.com).

+represented by their Matrix user ID (e.g. @alice:example.com). Return False to prevent +the invitation; otherwise return True to permit it.

If multiple modules implement this callback, they will be considered in order. If a callback returns True, Synapse falls through to the next one. The value of the first callback that does not return True will be used. If this happens, Synapse will not call @@ -237,7 +244,8 @@ any of the subsequent implementations of this callback.

Called when processing an invitation using a third-party identifier (also called a 3PID, e.g. an email address or a phone number). The module must return a bool indicating -whether the inviter can invite the invitee to the given room.

+whether the inviter can invite the invitee to the given room. Return False to prevent +the invitation; otherwise return True to permit it.

The inviter is represented by their Matrix user ID (e.g. @alice:example.com), and the invitee is represented by its medium (e.g. "email") and its address (e.g. alice@example.com). See the Matrix specification @@ -262,7 +270,8 @@ any of the subsequent implementations of this callback.

async def user_may_create_room(user: str) -> bool
 

Called when processing a room creation request. The module must return a bool indicating -whether the given user (represented by their Matrix user ID) is allowed to create a room.

+whether the given user (represented by their Matrix user ID) is allowed to create a room. +Return False to prevent room creation; otherwise return True to permit it.

If multiple modules implement this callback, they will be considered in order. If a callback returns True, Synapse falls through to the next one. The value of the first callback that does not return True will be used. If this happens, Synapse will not call @@ -273,7 +282,8 @@ any of the subsequent implementations of this callback.

Called when trying to associate an alias with an existing room. The module must return a bool indicating whether the given user (represented by their Matrix user ID) is allowed -to set the given alias.

+to set the given alias. Return False to prevent the alias creation; otherwise return +True to permit it.

If multiple modules implement this callback, they will be considered in order. If a callback returns True, Synapse falls through to the next one. The value of the first callback that does not return True will be used. If this happens, Synapse will not call @@ -284,7 +294,8 @@ any of the subsequent implementations of this callback.

Called when trying to publish a room to the homeserver's public rooms directory. The module must return a bool indicating whether the given user (represented by their -Matrix user ID) is allowed to publish the given room.

+Matrix user ID) is allowed to publish the given room. Return False to prevent the +room from being published; otherwise return True to permit its publication.

If multiple modules implement this callback, they will be considered in order. If a callback returns True, Synapse falls through to the next one. The value of the first callback that does not return True will be used. If this happens, Synapse will not call @@ -294,8 +305,10 @@ any of the subsequent implementations of this callback.

async def check_username_for_spam(user_profile: Dict[str, str]) -> bool
 

Called when computing search results in the user directory. The module must return a -bool indicating whether the given user profile can appear in search results. The profile -is represented as a dictionary with the following keys:

+bool indicating whether the given user should be excluded from user directory +searches. Return True to indicate that the user is spammy and exclude them from +search results; otherwise return False.

+

The profile is represented as a dictionary with the following keys: