1 files changed, 5 insertions, 3 deletions
diff --git a/synapse/federation/federation_server.py b/synapse/federation/federation_server.py
index 64e99292ec..d7740eb3b4 100644
--- a/synapse/federation/federation_server.py
+++ b/synapse/federation/federation_server.py
@@ -130,7 +130,7 @@ class FederationServer(FederationBase):
super().__init__(hs)
self.handler = hs.get_federation_handler()
- self._spam_checker = hs.get_spam_checker()
+ self._spam_checker_module_callbacks = hs.get_module_api_callbacks().spam_checker
self._federation_event_handler = hs.get_federation_event_handler()
self.state = hs.get_state_handler()
self._event_auth_handler = hs.get_event_auth_handler()
@@ -1129,7 +1129,7 @@ class FederationServer(FederationBase):
logger.warning("event id %s: %s", pdu.event_id, e)
raise FederationError("ERROR", 403, str(e), affected=pdu.event_id)
- if await self._spam_checker.should_drop_federated_event(pdu):
+ if await self._spam_checker_module_callbacks.should_drop_federated_event(pdu):
logger.warning(
"Unstaged federated event contains spam, dropping %s", pdu.event_id
)
@@ -1174,7 +1174,9 @@ class FederationServer(FederationBase):
origin, event = next
- if await self._spam_checker.should_drop_federated_event(event):
+ if await self._spam_checker_module_callbacks.should_drop_federated_event(
+ event
+ ):
logger.warning(
"Staged federated event contains spam, dropping %s",
event.event_id,
|