Mark own events as read again after sending

This commit is contained in:
Nicolas Werner 2020-07-18 20:39:31 +02:00
parent 36e4405f25
commit 046b3f4da6
2 changed files with 13 additions and 4 deletions

View file

@ -91,7 +91,7 @@ EventStore::EventStore(std::string room_id, QObject *)
room_id_,
txn_id,
e.content,
[this, txn_id](const mtx::responses::EventId &,
[this, txn_id](const mtx::responses::EventId &event_id,
mtx::http::RequestErr err) {
if (err) {
const int status_code =
@ -104,7 +104,7 @@ EventStore::EventStore(std::string room_id, QObject *)
emit messageFailed(txn_id);
return;
}
emit messageSent(txn_id);
emit messageSent(txn_id, event_id.event_id.to_string());
});
},
event->data);
@ -135,8 +135,17 @@ EventStore::EventStore(std::string room_id, QObject *)
this,
&EventStore::messageSent,
this,
[this](std::string txn_id) {
[this](std::string txn_id, std::string event_id) {
nhlog::ui()->debug("sent {}", txn_id);
http::client()->read_event(
room_id_, event_id, [this, event_id](mtx::http::RequestErr err) {
if (err) {
nhlog::net()->warn(
"failed to read_event ({}, {})", room_id_, event_id);
}
});
cache::client()->removePendingStatus(room_id_, txn_id);
this->current_txn = "";
this->current_txn_error_count = 0;

View file

@ -91,7 +91,7 @@ signals:
void fetchedMore();
void processPending();
void messageSent(std::string txn_id);
void messageSent(std::string txn_id, std::string event_id);
void messageFailed(std::string txn_id);
public slots: