From 5aac009e969cc3bd15c484ba3437348cb7a4d186 Mon Sep 17 00:00:00 2001 From: ConfuSomu Date: Sat, 20 Jan 2024 21:57:39 -0500 Subject: Implemement Actor information tab This class still has improvements to be made, but it works and I am satisfied with it! --- src/activitypub/apactor.h | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) (limited to 'src/activitypub/apactor.h') diff --git a/src/activitypub/apactor.h b/src/activitypub/apactor.h index 60ef0bf..ad8d689 100644 --- a/src/activitypub/apactor.h +++ b/src/activitypub/apactor.h @@ -1,22 +1,60 @@ #pragma once #include "apbase.h" +#include "apattachment.h" +#include #include +struct APPropertyValue { + QString key; + QString value; +}; + +struct APActorFields { + QString url; + QString username; // without the leading '@' + QString display_name; + QString summary; // Profile biography/description (bio) + QStringList keys; + QStringList values; + APAttachment* avatar = nullptr; + APAttachment* header = nullptr; + bool manuallyApprovesFollowers = false; + bool discoverable = true; // is discoverable or indexable + QString joined_date; + QStringList also_known_as; // other Actors representing the same user +}; + // APActors will have an avatar, display name, username and more that will be fetched using the remote instance +// Currently missing: featured tags and featured posts class APActor : APBase { public: // Empty actor APActor(); - APActor(const QString url); - ~APActor() {}; + APActor(const QString& url); + APActor(APActorFields& fields); + ~APActor(); const QString get_url(); QString get_html_render(HtmlRenderDetails render_info); const QString get_plain_render(); private: + friend class TabActorInfo; + QString object_url; + QString username; + QString name; // Display name + QString summary; // Profile biography/description (bio) + typedef std::vector APPropertyValueList; // Key/value table in profile (example: "web site | http://example.com/") + APPropertyValueList table; + APAttachment* avatar = nullptr; + APAttachment* header = nullptr; + bool manuallyApprovesFollowers = false; + bool discoverable = true; // is discoverable or indexable + QDateTime joined; + // TODO: parse the also_known_as field + // APActorList known_as; }; class APActorList : public std::vector, APBase { -- cgit v1.2.3-54-g00ecf