aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--room.cpp12
-rw-r--r--room.h2
2 files changed, 12 insertions, 2 deletions
diff --git a/room.cpp b/room.cpp
index e07426a7..5181fb2a 100644
--- a/room.cpp
+++ b/room.cpp
@@ -163,9 +163,17 @@ void Room::setJoinState(JoinState state)
emit joinStateChanged(oldState, state);
}
+void Room::setLastReadEvent(User* user, QString eventId)
+{
+ d->lastReadEvent.insert(user, eventId);
+ emit lastReadEventChanged(user);
+}
+
void Room::markMessageAsRead(Event* event)
{
- d->connection->postReceipt(this, event);
+ setLastReadEvent(connection()->user(), event->id());
+ if (event->senderId() != connection()->userId())
+ d->connection->postReceipt(this, event);
}
QString Room::lastReadEvent(User* user)
@@ -489,7 +497,7 @@ void Room::processEphemeralEvent(Event* event)
for( const Receipt& r: receipts )
{
if (auto m = d->member(r.userId))
- d->lastReadEvent.insert(m, eventId);
+ setLastReadEvent(m, eventId);
}
}
}
diff --git a/room.h b/room.h
index 7266ae70..3727af0e 100644
--- a/room.h
+++ b/room.h
@@ -69,6 +69,7 @@ namespace QMatrixClient
Q_INVOKABLE void updateData(SyncRoomData& data );
Q_INVOKABLE void setJoinState( JoinState state );
+ Q_INVOKABLE void setLastReadEvent(User* user, QString eventId);
Q_INVOKABLE void markMessageAsRead( Event* event );
Q_INVOKABLE QString lastReadEvent(User* user);
@@ -102,6 +103,7 @@ namespace QMatrixClient
void typingChanged();
void highlightCountChanged(Room* room);
void notificationCountChanged(Room* room);
+ void lastReadEventChanged(User* user);
protected:
Connection* connection() const;