summary refs log tree commit diff
path: root/synapse/handlers/message.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-12-04 15:50:01 +0000
committerErik Johnston <erik@matrix.org>2014-12-04 15:50:01 +0000
commitc31dba86ec40853f27c70ae13409ca3332052cc1 (patch)
treeab5a11519590c3c8e2211aedd2b441a7ccc759d5 /synapse/handlers/message.py
parentBegin converting things to use the new Event structure (diff)
downloadsynapse-c31dba86ec40853f27c70ae13409ca3332052cc1.tar.xz
Convert rest and handlers to use new event structure
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r--synapse/handlers/message.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index 269d6622e1..485d8e8179 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -15,7 +15,7 @@
 
 from twisted.internet import defer
 
-from synapse.api.constants import Membership
+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
@@ -134,6 +134,27 @@ class MessageHandler(BaseHandler):
         defer.returnValue(chunk)
 
     @defer.inlineCallbacks
+    def handle_event(self, event_dict):
+        builder = self.event_builder_factory.new(event_dict)
+
+        event, context = yield self._create_new_client_event(
+            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)
+        else:
+            yield self.handle_new_client_event(
+                event=event,
+                context=context,
+            )
+
+        defer.returnValue(event)
+
+    @defer.inlineCallbacks
     def store_room_data(self, event=None):
         """ Stores data for a room.