summary refs log tree commit diff
path: root/src/EventAccessors.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-01-26 22:36:35 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2021-02-09 20:22:02 +0100
commit2e77a1554f1572b7c7e59f8177a48e5dffa16c23 (patch)
treea6a6c22e64646683d8c283e391d922fa4da1b335 /src/EventAccessors.cpp
parentFix wrong font used in emoji escape (diff)
downloadnheko-2e77a1554f1572b7c7e59f8177a48e5dffa16c23.tar.xz
Switch to new relations format
Diffstat (limited to 'src/EventAccessors.cpp')
-rw-r--r--src/EventAccessors.cpp35
1 files changed, 8 insertions, 27 deletions
diff --git a/src/EventAccessors.cpp b/src/EventAccessors.cpp
index 3ae781f0..4218f491 100644
--- a/src/EventAccessors.cpp
+++ b/src/EventAccessors.cpp
@@ -250,31 +250,17 @@ struct EventFilesize
         }
 };
 
-struct EventInReplyTo
+struct EventRelations
 {
         template<class Content>
-        using related_ev_id_t = decltype(Content::relates_to.in_reply_to.event_id);
+        using related_ev_id_t = decltype(Content::relations);
         template<class T>
-        std::string operator()(const mtx::events::Event<T> &e)
+        mtx::common::Relations operator()(const mtx::events::Event<T> &e)
         {
                 if constexpr (is_detected<related_ev_id_t, T>::value) {
-                        return e.content.relates_to.in_reply_to.event_id;
+                        return e.content.relations;
                 }
-                return "";
-        }
-};
-
-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 "";
+                return {};
         }
 };
 
@@ -434,15 +420,10 @@ mtx::accessors::mimetype(const mtx::events::collections::TimelineEvents &event)
 {
         return std::visit(EventMimeType{}, event);
 }
-std::string
-mtx::accessors::in_reply_to_event(const mtx::events::collections::TimelineEvents &event)
-{
-        return std::visit(EventInReplyTo{}, event);
-}
-std::string
-mtx::accessors::relates_to_event_id(const mtx::events::collections::TimelineEvents &event)
+mtx::common::Relations
+mtx::accessors::relations(const mtx::events::collections::TimelineEvents &event)
 {
-        return std::visit(EventRelatesTo{}, event);
+        return std::visit(EventRelations{}, event);
 }
 
 std::string