From 68c861abaabcf5724dff2ef56814920ca2e866c1 Mon Sep 17 00:00:00 2001
From: DMRobertson First introduced in Synapse v1.37.0 Called when receiving an event from a client or via federation. The module can return
-either a 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 Called when a user is trying to join a room. The module must return a The user is represented by their Matrix user ID (e.g.
-async def check_event_for_spam(event: "synapse.events.EventBase") -> Union[bool, str]
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.
+
True
, to indicate that the event is spammy, but not provide further details; orFalse
, to indicate that the event is not considered spammy.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
@@ -7959,7 +7963,9 @@ any of the subsequent implementations of this callback.async def user_may_join_room(user: str, room: str, is_invited: bool) -> bool
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.@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.
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
).
@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
@@ -7991,7 +7998,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.
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
@@ -8016,7 +8024,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.
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
@@ -8027,7 +8036,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.
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
@@ -8038,7 +8048,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.
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
@@ -8048,8 +8059,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:
user_id
: The Matrix ID for this user.display_name
: The user's display name.Called when storing a local or remote file. The module must return a boolean indicating -whether the given file can be stored in the homeserver's media store.
+Called when storing a local or remote file. The module must return a bool
indicating
+whether the given file should be excluded from the homeserver's media store. Return
+True
to prevent this file from being stored; otherwise return False
.
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
--
cgit 1.5.1