From e515ca109faa897e84be8a97a1240c59df612dd4 Mon Sep 17 00:00:00 2001 From: ConfuSomu Date: Wed, 5 Jul 2023 15:14:46 +0200 Subject: Implement a small library of ActivityPub objects These objects allow, and will allow us, to move HTML rendering out of the archive parser and into separate classes. Each of the derived classes specialise HTML rendering for their specific requirements. Furthermore, these ActivityPub objects will be able to be expanded upon and have support to be written to disk, in a database, for instance. Separating ActivityPub object retrieving from rendering allows us to implement other retrieving sources and methods, such as downloading posts from a configured remote instance. --- src/activitypub/apobject.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/activitypub/apobject.h (limited to 'src/activitypub/apobject.h') diff --git a/src/activitypub/apobject.h b/src/activitypub/apobject.h new file mode 100644 index 0000000..62e60c8 --- /dev/null +++ b/src/activitypub/apobject.h @@ -0,0 +1,36 @@ +#pragma once + +#include "apbase.h" +#include "apactor.h" +#include "apattachment.h" +#include "../types.h" +#include + +class APObject : protected APBase { +public: + // An empty object + APObject(); + + // An object that will be fetched through the remote instance + APObject(const QString& url); + ~APObject() {}; + + // The object will be built from the fetched URL + void load_object_url(const QString& url); + + const QString get_object_url(); + + virtual QString get_html_render(HtmlRenderDetails render_info); + +protected: + APActorList to_actors; + APActorList cc_actors; + APActor by_actor; // maps to "attributedTo" + StatusType visibility; // status_type + + QString web_url; // URL that has something like a user accessible web user front-end + QString reply_to_url; // in reply to, this is not really a URL but a APPost that could be retrived. maybe have a method for creating that object? + QDateTime published; // publishing date + + APAttachmentList attachments; +}; -- cgit v1.2.3-54-g00ecf