diff --git a/lib/src/Store.dart b/lib/src/Store.dart index 367ef9ce..236b79d9 100644 --- a/lib/src/Store.dart +++ b/lib/src/Store.dart @@ -203,10 +203,17 @@ class Store { /// Stores an UserUpdate object in the database. Must be called inside of /// [transaction]. Future storeUserEventUpdate(UserUpdate userUpdate) { - txn.rawInsert("INSERT OR REPLACE INTO AccountData VALUES(?, ?)", [ - userUpdate.eventType, - json.encode(userUpdate.content["content"]), - ]); + if (userUpdate.type == "account_data") + txn.rawInsert("INSERT OR REPLACE INTO AccountData VALUES(?, ?)", [ + userUpdate.eventType, + json.encode(userUpdate.content["content"]), + ]); + else if (userUpdate.type == "presence") + txn.rawInsert("INSERT OR REPLACE INTO Presence VALUES(?, ?)", [ + userUpdate.eventType, + userUpdate.content["sender"], + json.encode(userUpdate.content["content"]), + ]); return null; }