aboutsummaryrefslogtreecommitdiffstats
path: root/src/activitypub
diff options
context:
space:
mode:
Diffstat (limited to 'src/activitypub')
-rw-r--r--src/activitypub/apactivity.cpp6
-rw-r--r--src/activitypub/apactivity.h11
-rw-r--r--src/activitypub/apactor.h5
-rw-r--r--src/activitypub/apobject.h5
-rw-r--r--src/activitypub/appost.h5
-rw-r--r--src/activitypub/apreblog.h5
6 files changed, 28 insertions, 9 deletions
diff --git a/src/activitypub/apactivity.cpp b/src/activitypub/apactivity.cpp
index b44f87a..ebd9d18 100644
--- a/src/activitypub/apactivity.cpp
+++ b/src/activitypub/apactivity.cpp
@@ -2,8 +2,6 @@
#include "apactor.h"
#include "src/settings_interface.h"
-#include <QDebug>
-
APActivity::APActivity() {}
APActivity::APActivity(APActivityFields fields) {
@@ -22,10 +20,6 @@ APActivity::APActivity(APActivityFields fields) {
object = fields.object;
}
-APActivity::~APActivity() {
- delete object;
-}
-
QString APActivity::get_html_render(HtmlRenderDetails render_info) {
QString html(get_html_template(QStringLiteral("apactivity")));
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);
diff --git a/src/activitypub/apactor.h b/src/activitypub/apactor.h
index ad8d689..70d80de 100644
--- a/src/activitypub/apactor.h
+++ b/src/activitypub/apactor.h
@@ -3,6 +3,8 @@
#include "apbase.h"
#include "apattachment.h"
#include <QDateTime>
+#include <QMetaType>
+#include <memory>
#include <vector>
struct APPropertyValue {
@@ -57,6 +59,9 @@ private:
// APActorList known_as;
};
+typedef std::shared_ptr<APActor> APActorPtr;
+Q_DECLARE_METATYPE(APActorPtr);
+
class APActorList : public std::vector<APActor>, APBase {
public:
QString get_html_render(HtmlRenderDetails render_info);
diff --git a/src/activitypub/apobject.h b/src/activitypub/apobject.h
index 62e60c8..5f17e80 100644
--- a/src/activitypub/apobject.h
+++ b/src/activitypub/apobject.h
@@ -5,6 +5,8 @@
#include "apattachment.h"
#include "../types.h"
#include <QDateTime>
+#include <QMetaType>
+#include <memory>
class APObject : protected APBase {
public:
@@ -34,3 +36,6 @@ protected:
APAttachmentList attachments;
};
+
+typedef std::shared_ptr<APObject> APObjectPtr;
+Q_DECLARE_METATYPE(APObjectPtr);
diff --git a/src/activitypub/appost.h b/src/activitypub/appost.h
index ccbedd9..8fe6430 100644
--- a/src/activitypub/appost.h
+++ b/src/activitypub/appost.h
@@ -3,6 +3,8 @@
#include "apobject.h"
#include "apbase.h"
#include "fields.h"
+#include <QMetaType>
+#include <memory>
#include <vector>
// APPost represents an ActivityPub Note Object
@@ -23,3 +25,6 @@ protected:
QString get_html_status_languages();
};
+
+typedef std::shared_ptr<APPost> APPostPtr;
+Q_DECLARE_METATYPE(APPostPtr);
diff --git a/src/activitypub/apreblog.h b/src/activitypub/apreblog.h
index cc340b8..66a6382 100644
--- a/src/activitypub/apreblog.h
+++ b/src/activitypub/apreblog.h
@@ -3,6 +3,8 @@
#include "apobject.h"
#include "apobject.h"
#include "src/types.h"
+#include <QMetaType>
+#include <memory>
#include <vector>
struct APReblogFields {
@@ -25,3 +27,6 @@ protected:
APObject object; // the object that was reblogged (impossible to be an APReblog)
StatusType visibility;
};
+
+typedef std::shared_ptr<APReblog> APReblogPtr;
+Q_DECLARE_METATYPE(APReblogPtr);