[RoomList] Get user and Statekey

This commit is contained in:
Christian Pauly 2019-07-29 09:44:55 +02:00
parent 29c677e5ba
commit c94246195f

View file

@ -114,7 +114,7 @@ class RoomList {
sortAndUpdate();
}
void _handleEventUpdate(EventUpdate eventUpdate) {
void _handleEventUpdate(EventUpdate eventUpdate) async {
// Is the event necessary for the chat list? If not, then return
if (!(eventUpdate.type == "timeline" ||
eventUpdate.eventType == "m.room.avatar" ||
@ -134,12 +134,21 @@ class RoomList {
rooms[j].timeCreated) return;*/
if (eventUpdate.type == "timeline") {
User user = await client?.store?.getUser(
matrixID: eventUpdate.content["sender"],
room: Room(id: eventUpdate.roomID, client: client));
User stateKey = null;
if (eventUpdate.content.containsKey("state_key"))
stateKey = await client?.store?.getUser(
matrixID: eventUpdate.content["state_key"],
room: Room(id: eventUpdate.roomID, client: client));
// Update the last message preview
rooms[j].lastEvent = Event(
eventUpdate.content["id"],
User(eventUpdate.content["sender"]),
user ?? User(eventUpdate.content["sender"]),
ChatTime(eventUpdate.content["origin_server_ts"]),
room: rooms[j],
stateKey: stateKey,
content: eventUpdate.content["content"],
environment: eventUpdate.eventType,
status: 2,