summary refs log tree commit diff
path: root/synapse/api/events/room.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-08-15 10:26:35 +0100
committerErik Johnston <erik@matrix.org>2014-08-15 10:26:35 +0100
commit5002efa31bb57a92b87b9d7319641d9b5a2a6047 (patch)
tree48a7c9561b43f807c14332505486c7d6129b830a /synapse/api/events/room.py
parentFix up typos and correct sql queries (diff)
downloadsynapse-5002efa31bb57a92b87b9d7319641d9b5a2a6047.tar.xz
Reimplement the get public rooms api to work with new DB schema
Diffstat (limited to 'synapse/api/events/room.py')
-rw-r--r--synapse/api/events/room.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/synapse/api/events/room.py b/synapse/api/events/room.py
index f3df849af2..8136d495d5 100644
--- a/synapse/api/events/room.py
+++ b/synapse/api/events/room.py
@@ -19,14 +19,37 @@ from . import SynapseEvent
 class RoomTopicEvent(SynapseEvent):
     TYPE = "m.room.topic"
 
+    internal_keys = SynapseEvent.internal_keys + [
+        "topic",
+    ]
+
     def __init__(self, **kwargs):
         kwargs["state_key"] = ""
+        if "topic" in kwargs["content"]:
+            kwargs["topic"] = kwargs["content"]["topic"]
         super(RoomTopicEvent, self).__init__(**kwargs)
 
     def get_content_template(self):
         return {"topic": u"string"}
 
 
+class RoomNameEvent(SynapseEvent):
+    TYPE = "m.room.name"
+
+    internal_keys = SynapseEvent.internal_keys + [
+        "name",
+    ]
+
+    def __init__(self, **kwargs):
+        kwargs["state_key"] = ""
+        if "name" in kwargs["content"]:
+            kwargs["name"] = kwargs["content"]["name"]
+        super(RoomNameEvent, self).__init__(**kwargs)
+
+    def get_content_template(self):
+        return {"name": u"string"}
+
+
 class RoomMemberEvent(SynapseEvent):
     TYPE = "m.room.member"