|
@@ -19,6 +19,11 @@ either a `bool` to indicate whether the event must be rejected because of spam,
|
|
|
to indicate the event must be rejected because of spam and to give a rejection reason to
|
|
|
forward to clients.
|
|
|
|
|
|
+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
|
|
|
+any of the subsequent implementations of this callback.
|
|
|
+
|
|
|
### `user_may_join_room`
|
|
|
|
|
|
```python
|
|
@@ -34,6 +39,11 @@ currently has a pending invite in the room.
|
|
|
This callback isn't called if the join is performed by a server administrator, or in the
|
|
|
context of a room creation.
|
|
|
|
|
|
+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
|
|
|
+any of the subsequent implementations of this callback.
|
|
|
+
|
|
|
### `user_may_invite`
|
|
|
|
|
|
```python
|
|
@@ -44,6 +54,11 @@ Called when processing an invitation. The module must return a `bool` indicating
|
|
|
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`).
|
|
|
|
|
|
+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
|
|
|
+any of the subsequent implementations of this callback.
|
|
|
+
|
|
|
### `user_may_send_3pid_invite`
|
|
|
|
|
|
```python
|
|
@@ -79,6 +94,11 @@ await user_may_send_3pid_invite(
|
|
|
**Note**: If the third-party identifier is already associated with a matrix user ID,
|
|
|
[`user_may_invite`](#user_may_invite) will be used instead.
|
|
|
|
|
|
+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
|
|
|
+any of the subsequent implementations of this callback.
|
|
|
+
|
|
|
### `user_may_create_room`
|
|
|
|
|
|
```python
|
|
@@ -88,6 +108,11 @@ 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.
|
|
|
|
|
|
+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
|
|
|
+any of the subsequent implementations of this callback.
|
|
|
+
|
|
|
### `user_may_create_room_with_invites`
|
|
|
|
|
|
```python
|
|
@@ -117,6 +142,11 @@ corresponding list(s) will be empty.
|
|
|
since no invites are sent when cloning a room. To cover this case, modules also need to
|
|
|
implement `user_may_create_room`.
|
|
|
|
|
|
+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
|
|
|
+any of the subsequent implementations of this callback.
|
|
|
+
|
|
|
### `user_may_create_room_alias`
|
|
|
|
|
|
```python
|
|
@@ -127,6 +157,11 @@ Called when trying to associate an alias with an existing room. The module must
|
|
|
`bool` indicating whether the given user (represented by their Matrix user ID) is allowed
|
|
|
to set the given alias.
|
|
|
|
|
|
+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
|
|
|
+any of the subsequent implementations of this callback.
|
|
|
+
|
|
|
### `user_may_publish_room`
|
|
|
|
|
|
```python
|
|
@@ -137,6 +172,11 @@ Called when trying to publish a room to the homeserver's public rooms directory.
|
|
|
module must return a `bool` indicating whether the given user (represented by their
|
|
|
Matrix user ID) is allowed to publish the given room.
|
|
|
|
|
|
+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
|
|
|
+any of the subsequent implementations of this callback.
|
|
|
+
|
|
|
### `check_username_for_spam`
|
|
|
|
|
|
```python
|
|
@@ -154,6 +194,11 @@ is represented as a dictionary with the following keys:
|
|
|
The module is given a copy of the original dictionary, so modifying it from within the
|
|
|
module cannot modify a user's profile when included in user directory search results.
|
|
|
|
|
|
+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
|
|
|
+any of the subsequent implementations of this callback.
|
|
|
+
|
|
|
### `check_registration_for_spam`
|
|
|
|
|
|
```python
|
|
@@ -179,6 +224,12 @@ The arguments passed to this callback are:
|
|
|
used during the registration process.
|
|
|
* `auth_provider_id`: The identifier of the SSO authentication provider, if any.
|
|
|
|
|
|
+If multiple modules implement this callback, they will be considered in order. If a
|
|
|
+callback returns `RegistrationBehaviour.ALLOW`, Synapse falls through to the next one.
|
|
|
+The value of the first callback that does not return `RegistrationBehaviour.ALLOW` will
|
|
|
+be used. If this happens, Synapse will not call any of the subsequent implementations of
|
|
|
+this callback.
|
|
|
+
|
|
|
### `check_media_file_for_spam`
|
|
|
|
|
|
```python
|
|
@@ -191,6 +242,11 @@ async def check_media_file_for_spam(
|
|
|
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.
|
|
|
|
|
|
+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
|
|
|
+any of the subsequent implementations of this callback.
|
|
|
+
|
|
|
## Example
|
|
|
|
|
|
The example below is a module that implements the spam checker callback
|