summary refs log tree commit diff
path: root/src/EventAccessors.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-07-20 00:42:48 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2020-07-20 00:42:48 +0200
commit19f27236ea82b1927c83e4e24c71b30061674ee7 (patch)
tree1f6449488bbbd4dc23827253bbf56096f8f949e7 /src/EventAccessors.cpp
parentFix reaction display (diff)
downloadnheko-19f27236ea82b1927c83e4e24c71b30061674ee7.tar.xz
Fix reactions
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 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)