Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 0f7d78d

Browse files
committed
update documentation for reject_federated_spam_event
Signed-off-by: jesopo <[email protected]>
1 parent fc09de4 commit 0f7d78d

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

docs/modules/spam_checker_callbacks.md

+17
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,23 @@ callback returns `False`, Synapse falls through to the next one. The value of th
249249
callback that does not return `False` will be used. If this happens, Synapse will not call
250250
any of the subsequent implementations of this callback.
251251

252+
### `reject_federated_spam_event`
253+
254+
_First introduced in Synapse v1.?.?_
255+
256+
```python
257+
async def reject_federated_spam_event(event: "synapse.events.EventBase") -> bool
258+
```
259+
260+
Called when checking whether a remote server can federate an event with us. **Returning
261+
`True` from this function will split-brain our view of a room's DAG, and thus you
262+
shouldn't use this callback unless you know what you are doing.**
263+
264+
If multiple modules implement this callback, they will be considered in order. If a
265+
callback returns `False`, Synapse falls through to the next one. The value of the first
266+
callback that does not return `False` will be used. If this happens, Synapse will not call
267+
any of the subsequent implementations of this callback.
268+
252269
## Example
253270

254271
The example below is a module that implements the spam checker callback

docs/spam_checker.md

+5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ well as some specific methods:
3232
* `check_username_for_spam`
3333
* `check_registration_for_spam`
3434
* `check_media_file_for_spam`
35+
* `reject_federated_spam_event`
3536

3637
The details of each of these methods (as well as their inputs and outputs)
3738
are documented in the `synapse.events.spamcheck.SpamChecker` class.
@@ -86,6 +87,10 @@ class ExampleSpamChecker:
8687

8788
async def check_media_file_for_spam(self, file_wrapper, file_info):
8889
return False # allow all media
90+
91+
92+
async def reject_federated_spam_event(self, foo):
93+
return False # don't hard-reject any federated events
8994
```
9095

9196
## Configuration

0 commit comments

Comments
 (0)