aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/room.cpp13
-rw-r--r--lib/room.h2
2 files changed, 7 insertions, 8 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index e8f67f3f..27f54ddb 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -1599,12 +1599,11 @@ void Room::Private::addNewMessageEvents(RoomEvents&& events)
{
RoomEventsRange eventsSpan { it, nextPending };
emit q->aboutToAddNewMessages(eventsSpan);
- if (auto insertedSize = moveEventsToTimeline(eventsSpan, Newer))
- {
- totalInserted += insertedSize;
- q->onAddNewTimelineEvents(timeline.cend() - insertedSize);
- }
- emit q->addedMessages();
+ auto insertedSize = moveEventsToTimeline(eventsSpan, Newer);
+ totalInserted += insertedSize;
+ auto firstInserted = timeline.cend() - insertedSize;
+ q->onAddNewTimelineEvents(firstInserted);
+ emit q->addedMessages(firstInserted->index(), timeline.back().index());
}
if (nextPending == newEnd)
break;
@@ -1669,7 +1668,7 @@ void Room::Private::addHistoricalMessageEvents(RoomEvents&& events)
qCDebug(MAIN) << "Room" << displayname << "received" << insertedSize
<< "past events; the oldest event is now" << timeline.front();
q->onAddHistoricalTimelineEvents(from);
- emit q->addedMessages();
+ emit q->addedMessages(timeline.front().index(), from->index());
if (from <= q->readMarker())
updateUnreadCount(from, timeline.crend());
diff --git a/lib/room.h b/lib/room.h
index 12884eb4..35263eaf 100644
--- a/lib/room.h
+++ b/lib/room.h
@@ -350,7 +350,7 @@ namespace QMatrixClient
signals:
void aboutToAddHistoricalMessages(RoomEventsRange events);
void aboutToAddNewMessages(RoomEventsRange events);
- void addedMessages();
+ void addedMessages(int fromIndex, int toIndex);
void pendingEventAboutToAdd();
void pendingEventAdded();
void pendingEventAboutToMerge(RoomEvent* serverEvent,