From 25eebe534e5fd4fe5ecd2947dde386549c3313ec Mon Sep 17 00:00:00 2001 From: erikjohnston Date: Tue, 31 May 2022 13:48:55 +0000 Subject: deploy: 3594f6c1f340f12bfcb2fec9e99ac108a714b508 --- develop/modules/spam_checker_callbacks.html | 32 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'develop/modules') diff --git a/develop/modules/spam_checker_callbacks.html b/develop/modules/spam_checker_callbacks.html index 8d483bcc61..dcaaa798c4 100644 --- a/develop/modules/spam_checker_callbacks.html +++ b/develop/modules/spam_checker_callbacks.html @@ -153,28 +153,26 @@ Synapse instances. Spam checker callbacks can be registered using the module API

Callbacks

The available spam checker callbacks are:

check_event_for_spam

-

First introduced in Synapse v1.37.0 -Signature extended to support Allow and Code in Synapse v1.60.0 -Boolean and string return value types deprecated in Synapse v1.60.0

-
async def check_event_for_spam(event: "synapse.module_api.EventBase") -> Union["synapse.module_api.ALLOW", "synapse.module_api.error.Codes", str, bool]
+

First introduced in Synapse v1.37.0

+

Changed in Synapse v1.60.0: synapse.module_api.NOT_SPAM and synapse.module_api.errors.Codes can be returned by this callback. Returning a boolean or a string is now deprecated.

+
async def check_event_for_spam(event: "synapse.module_api.EventBase") -> Union["synapse.module_api.NOT_SPAM", "synapse.module_api.errors.Codes", str, bool]
 
-

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

+

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

    -
  • synapse.module_api.ALLOW, to allow the operation. Other callbacks -may still decide to reject it.
  • -
  • synapse.api.Codes to reject the operation with an error code. In case -of doubt, synapse.api.error.Codes.FORBIDDEN is a good error code.
  • -
  • (deprecated) a str to reject the operation and specify an error message. Note that clients +
  • synapse.module_api.NOT_SPAM, to allow the operation. Other callbacks may still +decide to reject it.
  • +
  • synapse.module_api.errors.Codes to reject the operation with an error code. In case +of doubt, synapse.module_api.errors.Codes.FORBIDDEN is a good error code.
  • +
  • (deprecated) a non-Codes str to reject the operation and specify an error message. Note that clients typically will not localize the error message to the user's preferred locale.
  • -
  • (deprecated) on False, behave as ALLOW. Deprecated as confusing, as some -callbacks in expect True to allow and others True to reject.
  • -
  • (deprecated) on True, behave as synapse.api.error.Codes.FORBIDDEN. Deprecated as confusing, as -some callbacks in expect True to allow and others True to reject.
  • +
  • (deprecated) False, which is the same as returning synapse.module_api.NOT_SPAM.
  • +
  • (deprecated) True, which is the same as returning synapse.module_api.errors.Codes.FORBIDDEN.

If multiple modules implement this callback, they will be considered in order. If a -callback returns synapse.module_api.ALLOW, Synapse falls through to the next one. The value of the -first callback that does not return synapse.module_api.ALLOW will be used. If this happens, Synapse -will not call any of the subsequent implementations of this callback.

+callback returns synapse.module_api.NOT_SPAM, Synapse falls through to the next one. +The value of the first callback that does not return synapse.module_api.NOT_SPAM will +be used. If this happens, Synapse will not call any of the subsequent implementations of +this callback.

user_may_join_room

First introduced in Synapse v1.37.0

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