1 files changed, 19 insertions, 0 deletions
diff --git a/src/EventAccessors.cpp b/src/EventAccessors.cpp
index 7071819b..0618206c 100644
--- a/src/EventAccessors.cpp
+++ b/src/EventAccessors.cpp
@@ -223,6 +223,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>
@@ -378,6 +392,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)
|