summary refs log tree commit diff
path: root/synapse/handlers/message.py
diff options
context:
space:
mode:
authorDavid Baker <dbkr@users.noreply.github.com>2017-09-27 11:31:00 +0100
committerGitHub <noreply@github.com>2017-09-27 11:31:00 +0100
commit74e494b0101c5ff2bf406c6487f6c36dd67eca49 (patch)
treee2599991593707e460fafd1456655585a0148b82 /synapse/handlers/message.py
parentpep8 (diff)
parentDon't test is spam_checker not None (diff)
downloadsynapse-74e494b0101c5ff2bf406c6487f6c36dd67eca49.tar.xz
Merge pull request #2474 from matrix-org/dbkr/spam_check_module
Make the spam checker a module
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r--synapse/handlers/message.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index da18bf23db..37f0a2772a 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -12,7 +12,6 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-from synapse.events import spamcheck
 from twisted.internet import defer
 
 from synapse.api.constants import EventTypes, Membership
@@ -58,6 +57,8 @@ class MessageHandler(BaseHandler):
 
         self.action_generator = hs.get_action_generator()
 
+        self.spam_checker = hs.get_spam_checker()
+
     @defer.inlineCallbacks
     def purge_history(self, room_id, event_id):
         event = yield self.store.get_event(event_id)
@@ -322,7 +323,7 @@ class MessageHandler(BaseHandler):
             txn_id=txn_id
         )
 
-        if spamcheck.check_event_for_spam(event):
+        if self.spam_checker.check_event_for_spam(event):
             raise SynapseError(
                 403, "Spam is not permitted here", Codes.FORBIDDEN
             )