From 4e59eadba3b0d4586a9122e6a825ea030a139c9a Mon Sep 17 00:00:00 2001 From: ConfuSomu Date: Wed, 20 Mar 2024 13:28:19 -0400 Subject: Use smart pointers with AP classes and Instance --- src/activitypub/apactivity.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/activitypub/apactivity.h') diff --git a/src/activitypub/apactivity.h b/src/activitypub/apactivity.h index fcfb86c..dd6c09e 100644 --- a/src/activitypub/apactivity.h +++ b/src/activitypub/apactivity.h @@ -5,6 +5,8 @@ #include "apobject.h" #include "../types.h" #include +#include +#include enum struct APActivityType {CREATE, ANNOUNCE, UNKNOWN}; @@ -14,7 +16,7 @@ struct APActivityFields { QStringList cc_actors; QString object_url; // maps to "id", represents the Activity, *not* the URL of the object it contains QString published; - APObject* object; // will generally be a APPost or APReblog + APObjectPtr object; // will generally be a APPost or APReblog StatusType visibility; APActivityType type = APActivityType::UNKNOWN; }; @@ -25,9 +27,9 @@ public: // An Activity that can easily be constructed from an ActivityStreams JSON Activity. Make sure to pass the APObject. APActivity(APActivityFields fields); - ~APActivity(); + ~APActivity() {}; - APObject* object = nullptr; // the object that's manipulated by this Activity, use APPost for something useful and "manually" create it + APObjectPtr object; // the object that's manipulated by this Activity, use APPost for something useful and "manually" create it QString get_html_render(HtmlRenderDetails render_info); @@ -43,3 +45,6 @@ private: QDateTime published; }; + +typedef std::shared_ptr APActivityPtr; +Q_DECLARE_METATYPE(APActivityPtr); -- cgit v1.2.3-54-g00ecf