diff options
author | Black Hat <bhat@encom.eu.org> | 2018-08-29 20:17:37 +0800 |
---|---|---|
committer | Black Hat <bhat@encom.eu.org> | 2018-08-29 20:17:37 +0800 |
commit | a76e13b7411f7d09fdefca368e085a2e3e885903 (patch) | |
tree | e940522c10b1ad96a216967ba7e143d00fc15342 /lib | |
parent | bc83e269b8f64f5d0e712bf245d05925573e84d9 (diff) | |
download | libquotient-a76e13b7411f7d09fdefca368e085a2e3e885903.tar.gz libquotient-a76e13b7411f7d09fdefca368e085a2e3e885903.zip |
Use QMultiHash.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/room.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
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<User*> usersTyping; - QHash<QString, QList<User*>> eventIdReadUsers; + QMultiHash<QString, User*> eventIdReadUsers; QList<User*> 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<User*> Room::usersAtEventId(const QString& eventId) { if (!d->eventIdReadUsers.contains(eventId)) return QList<User*>(); - return d->eventIdReadUsers[eventId]; + return d->eventIdReadUsers.values(eventId); } int Room::notificationCount() const |