summary refs log tree commit diff
path: root/src/EventAccessors.cpp
diff options
context:
space:
mode:
authorWeblate <noreply@weblate.org>2020-09-13 17:20:51 -0400
committerWeblate <noreply@weblate.org>2020-09-13 17:20:51 -0400
commitb5669310e5d272418480def6d0a78ad26eda6c72 (patch)
tree62e3681090e7d5d9ecc502223cd63037bc86d5ba /src/EventAccessors.cpp
parentAdd simpified chinese translations (diff)
parentMerge pull request #275 from Chethan2k1/master (diff)
downloadnheko-b5669310e5d272418480def6d0a78ad26eda6c72.tar.xz
Merge branch 'master' of github.com:Nheko-Reborn/nheko
Diffstat (limited to 'src/EventAccessors.cpp')
-rw-r--r--src/EventAccessors.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/EventAccessors.cpp b/src/EventAccessors.cpp

index 7846737b..88612b14 100644 --- a/src/EventAccessors.cpp +++ b/src/EventAccessors.cpp
@@ -248,6 +248,20 @@ struct EventInReplyTo } }; +struct EventRelatesTo +{ + template<class Content> + using related_ev_id_t = decltype(Content::relates_to.event_id); + template<class T> + std::string operator()(const mtx::events::Event<T> &e) + { + if constexpr (is_detected<related_ev_id_t, T>::value) { + return e.content.relates_to.event_id; + } + return ""; + } +}; + struct EventTransactionId { template<class T> @@ -409,6 +423,11 @@ mtx::accessors::in_reply_to_event(const mtx::events::collections::TimelineEvents { return std::visit(EventInReplyTo{}, event); } +std::string +mtx::accessors::relates_to_event_id(const mtx::events::collections::TimelineEvents &event) +{ + return std::visit(EventRelatesTo{}, event); +} std::string mtx::accessors::transaction_id(const mtx::events::collections::TimelineEvents &event)