summary refs log tree commit diff
path: root/synapse/federation
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2017-09-26 19:20:23 +0100
committerDavid Baker <dave@matrix.org>2017-09-26 19:20:23 +0100
commit6cd5fcd5366cfef4959d107e818d0e20d78aa483 (patch)
tree4cc7a369317898d4eac75d7cd960ab3a34c78105 /synapse/federation
parentMerge pull request #2473 from matrix-org/dbkr/factor_out_module_loading (diff)
downloadsynapse-6cd5fcd5366cfef4959d107e818d0e20d78aa483.tar.xz
Make the spam checker a module
Diffstat (limited to 'synapse/federation')
-rw-r--r--synapse/federation/federation_base.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/synapse/federation/federation_base.py b/synapse/federation/federation_base.py
index babd9ea078..a0f5d40eb3 100644
--- a/synapse/federation/federation_base.py
+++ b/synapse/federation/federation_base.py
@@ -16,7 +16,6 @@ import logging
 
 from synapse.api.errors import SynapseError
 from synapse.crypto.event_signing import check_event_content_hash
-from synapse.events import spamcheck
 from synapse.events.utils import prune_event
 from synapse.util import unwrapFirstError, logcontext
 from twisted.internet import defer
@@ -26,7 +25,7 @@ logger = logging.getLogger(__name__)
 
 class FederationBase(object):
     def __init__(self, hs):
-        pass
+        self.spam_checker = hs.get_spam_checker()
 
     @defer.inlineCallbacks
     def _check_sigs_and_hash_and_fetch(self, origin, pdus, outlier=False,
@@ -144,7 +143,7 @@ class FederationBase(object):
                     )
                     return redacted
 
-                if spamcheck.check_event_for_spam(pdu):
+                if self.spam_checker.check_event_for_spam(pdu):
                     logger.warn(
                         "Event contains spam, redacting %s: %s",
                         pdu.event_id, pdu.get_pdu_json()