[Store] Handle presences in store
This commit is contained in:
parent
8b8232d2ba
commit
83d747f5f5
|
@ -203,10 +203,17 @@ class Store {
|
||||||
/// Stores an UserUpdate object in the database. Must be called inside of
|
/// Stores an UserUpdate object in the database. Must be called inside of
|
||||||
/// [transaction].
|
/// [transaction].
|
||||||
Future<void> storeUserEventUpdate(UserUpdate userUpdate) {
|
Future<void> storeUserEventUpdate(UserUpdate userUpdate) {
|
||||||
|
if (userUpdate.type == "account_data")
|
||||||
txn.rawInsert("INSERT OR REPLACE INTO AccountData VALUES(?, ?)", [
|
txn.rawInsert("INSERT OR REPLACE INTO AccountData VALUES(?, ?)", [
|
||||||
userUpdate.eventType,
|
userUpdate.eventType,
|
||||||
json.encode(userUpdate.content["content"]),
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue