summary refs log tree commit diff
path: root/synapse/handlers/account_data.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-12-01 18:41:32 +0000
committerMark Haines <mark.haines@matrix.org>2015-12-01 18:41:32 +0000
commit95f30ecd1f90cd143c908589b600742148491c15 (patch)
tree8752ad58e1eae5963adc83093111a096cb76cf7f /synapse/handlers/account_data.py
parentMerge pull request #400 from matrix-org/daniel/versioning (diff)
downloadsynapse-95f30ecd1f90cd143c908589b600742148491c15.tar.xz
Add API for setting account_data globaly or on a per room basis
Diffstat (limited to 'synapse/handlers/account_data.py')
-rw-r--r--synapse/handlers/account_data.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/synapse/handlers/account_data.py b/synapse/handlers/account_data.py
index 1d35d3b7dc..fe773bee9b 100644
--- a/synapse/handlers/account_data.py
+++ b/synapse/handlers/account_data.py
@@ -29,9 +29,10 @@ class AccountDataEventSource(object):
         last_stream_id = from_key
 
         current_stream_id = yield self.store.get_max_account_data_stream_id()
-        tags = yield self.store.get_updated_tags(user_id, last_stream_id)
 
         results = []
+        tags = yield self.store.get_updated_tags(user_id, last_stream_id)
+
         for room_id, room_tags in tags.items():
             results.append({
                 "type": "m.tag",
@@ -39,6 +40,24 @@ class AccountDataEventSource(object):
                 "room_id": room_id,
             })
 
+        account_data, room_account_data = (
+            yield self.store.get_updated_account_data_for_user(user_id, last_stream_id)
+        )
+
+        for account_data_type, content in account_data.items():
+            results.append({
+                "type": account_data_type,
+                "content": content,
+            })
+
+        for room_id, account_data in room_account_data.items():
+            for account_data_type, content in account_data.items():
+                results.append({
+                    "type": account_data_type,
+                    "content": content,
+                    "room_id": room_id,
+                })
+
         defer.returnValue((results, current_stream_id))
 
     @defer.inlineCallbacks