summary refs log tree commit diff
path: root/synapse/handlers/room.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-09-01 13:44:19 +0100
committerErik Johnston <erik@matrix.org>2014-09-01 14:39:09 +0100
commit865469f233aa37d3fa0de9a77dfb6bc597c569d7 (patch)
tree2bbd9037e0ac535369c0eb8485f8610ba28d700c /synapse/handlers/room.py
parentMerge branch 'develop' of github.com:matrix-org/synapse into room_config (diff)
downloadsynapse-865469f233aa37d3fa0de9a77dfb6bc597c569d7.tar.xz
Implement power level lists, default power levels and send_evnet_level/add_state_level events.
Diffstat (limited to 'synapse/handlers/room.py')
-rw-r--r--synapse/handlers/room.py31
1 files changed, 22 insertions, 9 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index 11afd34ae2..dace364eae 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -21,7 +21,8 @@ from synapse.api.constants import Membership, JoinRules
 from synapse.api.errors import StoreError, SynapseError
 from synapse.api.events.room import (
     RoomMemberEvent, RoomCreateEvent, RoomPowerLevelsEvent,
-    RoomJoinRulesEvent, RoomDefaultLevelEvent,
+    RoomJoinRulesEvent, RoomAddStateLevelEvent,
+    RoomSendEventLevelEvent,
 )
 from synapse.util import stringutils
 from ._base import BaseRoomHandler
@@ -152,7 +153,7 @@ class RoomCreationHandler(BaseRoomHandler):
 
         creation_event = self.event_factory.create_event(
             etype=RoomCreateEvent.TYPE,
-            content={"creator": creator.to_string()},
+            content={"creator": creator.to_string(), "default": 0},
             **event_keys
         )
 
@@ -162,12 +163,6 @@ class RoomCreationHandler(BaseRoomHandler):
             **event_keys
         )
 
-        default_level_event = self.event_factory.create_event(
-            etype=RoomDefaultLevelEvent.TYPE,
-            content={"default_level": 0},
-            **event_keys
-        )
-
         join_rule = JoinRules.PUBLIC if is_public else JoinRules.INVITE
         join_rules_event = self.event_factory.create_event(
             etype=RoomJoinRulesEvent.TYPE,
@@ -175,7 +170,25 @@ class RoomCreationHandler(BaseRoomHandler):
             **event_keys
         )
 
-        return [creation_event, power_levels_event, default_level_event, join_rules_event]
+        add_state_event = self.event_factory.create_event(
+            etype=RoomAddStateLevelEvent.TYPE,
+            content={"level": 10},
+            **event_keys
+        )
+
+        send_event = self.event_factory.create_event(
+            etype=RoomSendEventLevelEvent.TYPE,
+            content={"level": 0},
+            **event_keys
+        )
+
+        return [
+            creation_event,
+            power_levels_event,
+            join_rules_event,
+            add_state_event,
+            send_event,
+        ]
 
 
 class RoomMemberHandler(BaseRoomHandler):