aboutsummaryrefslogtreecommitdiffstats
path: root/src/archive/mastodon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/archive/mastodon.cpp')
-rw-r--r--src/archive/mastodon.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/archive/mastodon.cpp b/src/archive/mastodon.cpp
index 121c366..044056c 100644
--- a/src/archive/mastodon.cpp
+++ b/src/archive/mastodon.cpp
@@ -1,4 +1,5 @@
#include "mastodon.h"
+#include "src/activitypub/apactor.h"
#include "src/list_item.h"
#include "src/types.h"
#include "src/activitypub/apactivity.h"
@@ -237,7 +238,7 @@ std::vector<APAttachmentFields> MastodonArchive::get_status_attachments_list(QJs
return list;
}
-APActivity* MastodonArchive::get_activity(ArchiveItemRef index, Hinting_t hinting) {
+APActivityPtr MastodonArchive::get_activity(ArchiveItemRef index, Hinting_t hinting) {
// the JSON AP Activity
QJsonObject activity = outbox_items->at(index).toObject();
@@ -320,17 +321,17 @@ APActivity* MastodonArchive::get_activity(ArchiveItemRef index, Hinting_t hintin
obj_url = activity["object"].toString();
if (not obj_url.isNull())
- act_fields.object = new APReblog({obj_url, act_fields.visibility});
+ act_fields.object = std::make_shared<APReblog>(APReblogFields {obj_url, act_fields.visibility});
else switch(obj_type) {
case APObjectType::UNKNOWN:
case APObjectType::NOTE:
- act_fields.object = new APPost(obj_fields); break;
+ act_fields.object = std::make_shared<APPost>(obj_fields); break;
case APObjectType::QUESTION:
- act_fields.object = new APQuestion(obj_fields); break;
+ act_fields.object = std::make_shared<APQuestion>(obj_fields); break;
}
// TODO: it is currently a waste to create this APActivity object that will be immediately destroyed but it allows us to extend archive parsing to something that will become abstract (and an abstract base class) and separate from display (the final goal) which will allow us to add other sources that feed us with posts, reblogs and Actor information. furthermore, these objects can be cached for reuse in a session.
- return new APActivity(act_fields);
+ return std::make_shared<APActivity>(act_fields);
}
// TODO: make this use an APActivity object that will be present as an StatusListItem member.
@@ -355,7 +356,7 @@ const QString MastodonArchive::get_html_status_text(ArchiveItemRef index) {
return text;
}
-APActor* MastodonArchive::get_main_actor() {
+APActorPtr MastodonArchive::get_main_actor() {
// Avoid recreating the Actor each time by caching it
if (actor) return actor;
@@ -436,7 +437,7 @@ APActor* MastodonArchive::get_main_actor() {
obj_fields.header = new APAttachment(att_fields);
}
- actor = new APActor(obj_fields);
+ actor = std::make_shared<APActor>(obj_fields);
// TODO: query type. it seems to be always "Person", but maybe if the account is a bot, it changes?
// The code also currently ignores possible featured tags and users