diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-09-12 23:10:20 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-12 23:10:20 +0900 |
commit | b5b0d8438bdf3cb8b37f311e8047ef6883f858c2 (patch) | |
tree | 633a6e8fe8a244b44b510b608ec3103431a0e042 /lib | |
parent | 2a1596c16baad77fc80391c66694101f91028deb (diff) | |
parent | 1e78ca6b9c09cb16677ab3db1656085adbd4901b (diff) | |
download | libquotient-b5b0d8438bdf3cb8b37f311e8047ef6883f858c2.tar.gz libquotient-b5b0d8438bdf3cb8b37f311e8047ef6883f858c2.zip |
Merge pull request #239 from encombhat/master
Add readUser for RoomEvent
Diffstat (limited to 'lib')
-rw-r--r-- | lib/room.cpp | 8 | ||||
-rw-r--r-- | lib/room.h | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/room.cpp b/lib/room.cpp index 18b06b7d..869a81c8 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -103,6 +103,7 @@ class Room::Private int notificationCount = 0; members_map_t membersMap; QList<User*> usersTyping; + QMultiHash<QString, User*> eventIdReadUsers; QList<User*> membersLeft; int unreadMessages = 0; bool displayed = false; @@ -375,8 +376,11 @@ void Room::Private::setLastReadEvent(User* u, QString eventId) auto& storedId = lastReadEventIds[u]; if (storedId == eventId) return; + eventIdReadUsers.remove(storedId, u); + eventIdReadUsers.insert(eventId, u); swap(storedId, eventId); emit q->lastReadEventChanged(u); + emit q->readMarkerForUserMoved(u, eventId, storedId); if (isLocalUser(u)) { if (storedId != serverReadMarker) @@ -635,6 +639,10 @@ QString Room::readMarkerEventId() const return d->lastReadEventIds.value(localUser()); } +QList<User*> Room::usersAtEventId(const QString& eventId) { + return d->eventIdReadUsers.values(eventId); +} + int Room::notificationCount() const { return d->notificationCount; @@ -202,6 +202,7 @@ namespace QMatrixClient rev_iter_t readMarker(const User* user) const; rev_iter_t readMarker() const; QString readMarkerEventId() const; + QList<User*> usersAtEventId(const QString& eventId); /** * \brief Mark the event with uptoEventId as read * @@ -384,6 +385,7 @@ namespace QMatrixClient void lastDisplayedEventChanged(); void lastReadEventChanged(User* user); void readMarkerMoved(QString fromEventId, QString toEventId); + void readMarkerForUserMoved(User* user, QString fromEventId, QString toEventId); void unreadMessagesChanged(Room* room); void accountDataAboutToChange(QString type); |