Add basic read_event support (qml)
This commit is contained in:
parent
1dd1a19b06
commit
ea12c9f9bc
@ -584,6 +584,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
|
void
|
||||||
TimelineModel::addBackwardsEvents(const mtx::responses::Messages &msgs)
|
TimelineModel::addBackwardsEvents(const mtx::responses::Messages &msgs)
|
||||||
{
|
{
|
||||||
|
@ -162,11 +162,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void fetchHistory();
|
void fetchHistory();
|
||||||
void setCurrentIndex(int index)
|
void setCurrentIndex(int index);
|
||||||
{
|
|
||||||
currentId = indexToId(index);
|
|
||||||
emit currentIndexChanged(index);
|
|
||||||
}
|
|
||||||
int currentIndex() const { return idToIndex(currentId); }
|
int currentIndex() const { return idToIndex(currentId); }
|
||||||
void markEventsAsRead(const std::vector<QString> &event_ids);
|
void markEventsAsRead(const std::vector<QString> &event_ids);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user