summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2017-10-03 14:28:12 +0100
committerDavid Baker <dave@matrix.org>2017-10-03 14:28:12 +0100
commit537088e7dceff8af4b283e11e46d7df7e2f38065 (patch)
treee9c16841e2fe4afce9c4ec5e7505d2002fa70b63 /synapse
parentSkip spam check for admin users (diff)
downloadsynapse-537088e7dceff8af4b283e11e46d7df7e2f38065.tar.xz
Actually write warpper function
Diffstat (limited to 'synapse')
-rw-r--r--synapse/events/spamcheck.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/synapse/events/spamcheck.py b/synapse/events/spamcheck.py
index e739f105b2..605261f4b5 100644
--- a/synapse/events/spamcheck.py
+++ b/synapse/events/spamcheck.py
@@ -45,3 +45,19 @@ class SpamChecker(object):
             return False
 
         return self.spam_checker.check_event_for_spam(event)
+
+    def user_may_invite(self, userid):
+        """Checks if a given user may send an invite
+
+        If this method returns false, the invite will be rejected.
+
+        Args:
+            userid (string): The sender's user ID
+
+        Returns:
+            bool: True if the user may send an invite, otherwise False
+        """
+        if self.spam_checker is None:
+            return True
+
+        return self.spam_checker.user_may_invite(userid)