aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-08-01 17:19:23 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-08-01 17:19:23 +0200
commit000710d2c78b0843d920b7cf983f693a3ddf193e (patch)
treef3aabed642d46e55d29e80682eb84843a6fac72c
parentf7a2e0f9885ecc622c67dd457993cb19c293f515 (diff)
downloadlibquotient-000710d2c78b0843d920b7cf983f693a3ddf193e.tar.gz
libquotient-000710d2c78b0843d920b7cf983f693a3ddf193e.zip
Enhanced logging for read receipts
-rw-r--r--lib/room.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index 77abf04c..a643ed68 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -649,7 +649,8 @@ void Room::Private::setLastReadReceipt(User* u, rev_iter_t newMarker,
return; // For Release builds
}
if (q->memberJoinState(u) != JoinState::Join) {
- qCWarning(MAIN) << "Won't record read receipt for non-member" << u->id();
+ qCWarning(EPHEMERAL)
+ << "Won't record read receipt for non-member" << u->id();
return;
}
@@ -657,8 +658,11 @@ void Room::Private::setLastReadReceipt(User* u, rev_iter_t newMarker,
newMarker = q->findInTimeline(newEvtId);
if (newMarker != historyEdge()) {
// NB: with reverse iterators, timeline history >= sync edge
- if (newMarker >= q->readMarker(u))
+ if (newMarker >= q->readMarker(u)) {
+ qCDebug(EPHEMERAL) << "The new read receipt for" << u->id()
+ << "is at or behind the old one, skipping";
return;
+ }
// Try to auto-promote the read marker over the user's own messages
// (switch to direct iterators for that).
@@ -680,6 +684,8 @@ void Room::Private::setLastReadReceipt(User* u, rev_iter_t newMarker,
eventIdReadUsers.remove(storedId, u);
eventIdReadUsers.insert(newEvtId, u);
swap(storedId, newEvtId); // Now newEvtId actually stores the old eventId
+ qCDebug(EPHEMERAL) << "The new read receipt for" << u->id() << "is at"
+ << storedId;
emit q->lastReadEventChanged(u);
if (!isLocalUser(u))
emit q->readMarkerForUserMoved(u, newEvtId, storedId);