summary refs log tree commit diff
path: root/synapse/handlers/message.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2014-09-30 17:55:06 +0100
committerMark Haines <mark.haines@matrix.org>2014-09-30 17:55:06 +0100
commit9605593d11b67199a98ed25f121a2af2e1c9587a (patch)
treedc57897bfcbd1591fa0dfb219e376353584654e9 /synapse/handlers/message.py
parentSYN-75 Verify signatures on server to server transactions (diff)
parentpyflakes cleanup (diff)
downloadsynapse-9605593d11b67199a98ed25f121a2af2e1c9587a.tar.xz
Merge branch 'develop' into server2server_signing
Conflicts:
	synapse/storage/__init__.py
	tests/rest/test_presence.py
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r--synapse/handlers/message.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index 14fae689f2..317ef2c80c 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -233,6 +233,22 @@ class MessageHandler(BaseHandler):
         yield self._on_new_room_event(event, snapshot)
 
     @defer.inlineCallbacks
+    def get_state_events(self, user_id, room_id):
+        """Retrieve all state events for a given room.
+
+        Args:
+            user_id(str): The user requesting state events.
+            room_id(str): The room ID to get all state events from.
+        Returns:
+            A list of dicts representing state events. [{}, {}, {}]
+        """
+        yield self.auth.check_joined_room(room_id, user_id)
+
+        # TODO: This is duplicating logic from snapshot_all_rooms
+        current_state = yield self.store.get_current_state(room_id)
+        defer.returnValue([self.hs.serialize_event(c) for c in current_state])
+
+    @defer.inlineCallbacks
     def snapshot_all_rooms(self, user_id=None, pagin_config=None,
                            feedback=False):
         """Retrieve a snapshot of all rooms the user is invited or has joined.