diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-01-12 23:51:22 +0100 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-01-12 23:51:22 +0100 |
commit | ba56c9f408571f92bb67dc8a7a61d4a2d8c538fb (patch) | |
tree | 65876ef605f63c3d70811c8d61f1b0a30be39742 /src/timeline | |
parent | v0.11.0 (diff) | |
download | nheko-ba56c9f408571f92bb67dc8a7a61d4a2d8c538fb.tar.xz |
There was always supposed to be a failed state for events
Diffstat (limited to '')
-rw-r--r-- | src/timeline/TimelineModel.cpp | 13 | ||||
-rw-r--r-- | src/timeline/TimelineModel.h | 2 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index 7b50da59..a6950870 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -698,7 +698,8 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r return QVariant(QString::fromStdString(event_id(event))); } case State: { - auto id = QString::fromStdString(event_id(event)); + auto idstr = event_id(event); + auto id = QString::fromStdString(idstr); auto containsOthers = [](const auto &vec) { for (const auto &e : vec) if (e.second != http::client()->user_id().to_string()) @@ -709,9 +710,13 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r // only show read receipts for messages not from us if (acc::sender(event) != http::client()->user_id().to_string()) return qml_mtx_events::Empty; - else if (!id.isEmpty() && id[0] == 'm') - return qml_mtx_events::Sent; - else if (read.contains(id) || containsOthers(cache::readReceipts(id, room_id_))) + else if (!id.isEmpty() && id[0] == 'm') { + auto pending = cache::client()->pendingEvents(this->room_id_.toStdString()); + if (std::find(pending.begin(), pending.end(), idstr) != pending.end()) + return qml_mtx_events::Sent; + else + return qml_mtx_events::Failed; + } else if (read.contains(id) || containsOthers(cache::readReceipts(id, room_id_))) return qml_mtx_events::Read; else return qml_mtx_events::Received; diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h index cb8aa380..0bf29dc1 100644 --- a/src/timeline/TimelineModel.h +++ b/src/timeline/TimelineModel.h @@ -149,6 +149,8 @@ enum EventState Read, //! The client sent the message. Not yet received. Sent, + //! The client sent the message, but it failed. + Failed, //! When the message is loaded from cache or backfill. Empty, }; |