diff options
-rw-r--r-- | lib/room.cpp | 10 | ||||
-rw-r--r-- | lib/room.h | 16 |
2 files changed, 24 insertions, 2 deletions
diff --git a/lib/room.cpp b/lib/room.cpp index ee76a85c..273a5753 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -1014,6 +1014,16 @@ ReadReceipt Room::lastReadReceipt(const QString& userId) const return d->lastReadReceipts.value(userId); } +ReadReceipt Room::lastLocalReadReceipt() const +{ + return d->lastReadReceipts.value(localUser()->id()); +} + +Room::rev_iter_t Room::localReadReceiptMarker() const +{ + return findInTimeline(lastLocalReadReceipt().eventId); +} + QString Room::lastFullyReadEventId() const { return d->fullyReadUntilEventId; } Room::rev_iter_t Room::fullyReadMarker() const @@ -400,8 +400,7 @@ public: //! //! See the documentation for the single-argument overload. //! \sa fullyReadMarker - [[deprecated("Use lastReadReceipt() to get m.read receipt or" - " fullyReadMarker() to get m.fully_read marker")]] // + [[deprecated("Use localReadReceiptMarker() or fullyReadMarker()")]] // rev_iter_t readMarker() const; //! \brief Get the event id for the local user's fully-read marker //! \deprecated Use lastFullyReadEventId instead @@ -420,6 +419,19 @@ public: //! \sa usersAtEventId ReadReceipt lastReadReceipt(const QString& userId) const; + //! \brief Get the latest read receipt from the local user + //! + //! This is a shortcut for <tt>lastReadReceipt(localUserId)</tt>. + //! \sa lastReadReceipt + ReadReceipt lastLocalReadReceipt() const; + + //! \brief Find the timeline item the local read receipt is at + //! + //! This is a shortcut for \code + //! room->findInTimeline(room->lastLocalReadReceipt().eventId); + //! \endcode + rev_iter_t localReadReceiptMarker() const; + //! \brief Get the latest event id marked as fully read //! //! This can be either the event id pointed to by the actual latest |