Enable rate limiting for all events

This commit is contained in:
Erik Johnston 2014-12-16 16:10:17 +00:00
parent 23da4a4051
commit f06161a307

View File

@ -154,6 +154,11 @@ class MessageHandler(BaseHandler):
self.validator.validate_new(builder) self.validator.validate_new(builder)
self.ratelimit(builder.user_id)
# TODO(paul): Why does 'event' not have a 'user' object?
user = self.hs.parse_userid(builder.user_id)
assert self.hs.is_mine(user), "User must be our own: %s" % (user,)
if builder.type == EventTypes.Member: if builder.type == EventTypes.Member:
membership = builder.content.get("membership", None) membership = builder.content.get("membership", None)
if membership == Membership.JOIN: if membership == Membership.JOIN: