diff options
author | Erik Johnston <erik@matrix.org> | 2014-12-10 17:59:47 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2014-12-10 17:59:47 +0000 |
commit | b245ee34ed70854d0802921feb13822cd07996fa (patch) | |
tree | 74073c07720f39d15e3f56cfc1864797341669f1 /synapse/handlers/message.py | |
parent | Add new event graphing tool (diff) | |
download | synapse-b245ee34ed70854d0802921feb13822cd07996fa.tar.xz |
Add some basic event validation
Diffstat (limited to '')
-rw-r--r-- | synapse/handlers/message.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 9043b945e4..f92b01a50f 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -19,6 +19,9 @@ from synapse.api.constants import EventTypes, Membership from synapse.api.errors import RoomError from synapse.streams.config import PaginationConfig from synapse.util.logcontext import PreserveLoggingContext + +from synapse.events.validator import EventValidator + from ._base import BaseHandler import logging @@ -33,6 +36,7 @@ class MessageHandler(BaseHandler): self.hs = hs self.clock = hs.get_clock() self.event_factory = hs.get_event_factory() + self.validator = EventValidator() @defer.inlineCallbacks def get_message(self, msg_id=None, room_id=None, sender_id=None, @@ -137,6 +141,8 @@ class MessageHandler(BaseHandler): def handle_event(self, event_dict): builder = self.event_builder_factory.new(event_dict) + self.validator.validate(builder) + if builder.type == EventTypes.Member: membership = builder.content.get("membership", None) if membership == Membership.JOIN: @@ -152,8 +158,6 @@ class MessageHandler(BaseHandler): builder=builder, ) - # TODO: self.validator.validate(event) - if event.type == EventTypes.Member: member_handler = self.hs.get_handlers().room_member_handler yield member_handler.change_membership(event, context) |