diff options
Diffstat (limited to 'src/timeline2/TimelineModel.cpp')
-rw-r--r-- | src/timeline2/TimelineModel.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/timeline2/TimelineModel.cpp b/src/timeline2/TimelineModel.cpp index db9ce555..83d1e417 100644 --- a/src/timeline2/TimelineModel.cpp +++ b/src/timeline2/TimelineModel.cpp @@ -585,6 +585,27 @@ TimelineModel::fetchHistory() } void +TimelineModel::setCurrentIndex(int index) +{ + auto oldIndex = idToIndex(currentId); + currentId = indexToId(index); + emit currentIndexChanged(index); + + if (oldIndex < index) { + http::client()->read_event(room_id_.toStdString(), + currentId.toStdString(), + [this](mtx::http::RequestErr err) { + if (err) { + nhlog::net()->warn( + "failed to read_event ({}, {})", + room_id_.toStdString(), + currentId.toStdString()); + } + }); + } +} + +void TimelineModel::addBackwardsEvents(const mtx::responses::Messages &msgs) { std::vector<QString> ids = internalAddEvents(msgs.chunk); |