From a76e13b7411f7d09fdefca368e085a2e3e885903 Mon Sep 17 00:00:00 2001 From: Black Hat Date: Wed, 29 Aug 2018 20:17:37 +0800 Subject: Use QMultiHash. --- lib/room.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/room.cpp b/lib/room.cpp index bb15760a..90306b23 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -103,7 +103,7 @@ class Room::Private int notificationCount = 0; members_map_t membersMap; QList usersTyping; - QHash> eventIdReadUsers; + QMultiHash eventIdReadUsers; QList membersLeft; int unreadMessages = 0; bool displayed = false; @@ -377,8 +377,8 @@ void Room::Private::setLastReadEvent(User* u, QString eventId) auto& storedId = lastReadEventIds[u]; if (storedId == eventId) return; - eventIdReadUsers[storedId].removeOne(u); - eventIdReadUsers[eventId].append(u); + eventIdReadUsers.remove(storedId, u); + eventIdReadUsers.insert(eventId, u); swap(storedId, eventId); emit q->lastReadEventChanged(u); if (isLocalUser(u)) @@ -641,7 +641,7 @@ QString Room::readMarkerEventId() const QList Room::usersAtEventId(const QString& eventId) { if (!d->eventIdReadUsers.contains(eventId)) return QList(); - return d->eventIdReadUsers[eventId]; + return d->eventIdReadUsers.values(eventId); } int Room::notificationCount() const -- cgit v1.2.3