Take a snapshot of the state of the room before performing updates

This commit is contained in:
Mark Haines 2014-08-22 17:00:10 +01:00
parent d12a7c3939
commit 1379dcae6f
6 changed files with 162 additions and 58 deletions

View file

@ -127,6 +127,13 @@ class MemoryDataStore(object):
self.current_state = {}
self.events = []
Snapshot = namedtuple("Snapshot", "room_id user_id membership_state")
def snapshot_room(self, room_id, user_id, state_type=None, state_key=None):
return self.Snapshot(
room_id, user_id, self.get_room_member(user_id, room_id)
)
def register(self, user_id, token, password_hash):
if user_id in self.tokens_to_users.values():
raise StoreError(400, "User in use.")