aboutsummaryrefslogtreecommitdiffstats
path: root/src/activitypub/apactivity.h
diff options
context:
space:
mode:
authorConfuSomu2024-03-20 13:28:19 -0400
committerConfuSomu2024-03-20 13:28:19 -0400
commit4e59eadba3b0d4586a9122e6a825ea030a139c9a (patch)
tree6674c2b23ef6295e7a8d60bb034c3321e7a5a996 /src/activitypub/apactivity.h
parent0e32ef940e53c4f10d84762f2de6836025f87610 (diff)
downloadActorViewer-4e59eadba3b0d4586a9122e6a825ea030a139c9a.tar
ActorViewer-4e59eadba3b0d4586a9122e6a825ea030a139c9a.tar.gz
ActorViewer-4e59eadba3b0d4586a9122e6a825ea030a139c9a.zip
Use smart pointers with AP classes and Instance
Diffstat (limited to 'src/activitypub/apactivity.h')
-rw-r--r--src/activitypub/apactivity.h11
1 files changed, 8 insertions, 3 deletions
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 <QDateTime>
+#include <QMetaType>
+#include <memory>
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<APActivity> APActivityPtr;
+Q_DECLARE_METATYPE(APActivityPtr);