From 372ed74c04f2c542451771aa792242a4e2afb351 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 20 Oct 2016 09:38:16 +0900 Subject: Room: added setLastReadEvent accessor and a signal for it; don't post receipts for own messages to the server As discussed with Matthew in #quaternion: https://matrix.to/#/!PCzUtxtOjUySxSelof:matrix.org/$14768896199130qcJqe:matrix.org --- room.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'room.cpp') 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); } } } -- cgit v1.2.3