aboutsummaryrefslogtreecommitdiffstats
path: root/src/activitypub/fields.h
diff options
context:
space:
mode:
authorConfuSomu2023-07-18 00:00:20 +0200
committerConfuSomu2023-07-18 00:00:20 +0200
commit5ed7d9b53a65aec1f4793f62ac15195c44224b39 (patch)
tree20f59b643ab185abc8eeecb6338d565ed36febda /src/activitypub/fields.h
parente322946df7c33f76dbee46ec5b8e2118fbae8a26 (diff)
downloadActorViewer-5ed7d9b53a65aec1f4793f62ac15195c44224b39.tar
ActorViewer-5ed7d9b53a65aec1f4793f62ac15195c44224b39.tar.gz
ActorViewer-5ed7d9b53a65aec1f4793f62ac15195c44224b39.zip
Implement Question object type support
This commit adds support for dealing with ActivityPub Questions, which are polls. They are like Notes (posts) but contain a few more keys that record information about the poll options, number of votes and poll closure date.
Diffstat (limited to 'src/activitypub/fields.h')
-rw-r--r--src/activitypub/fields.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/activitypub/fields.h b/src/activitypub/fields.h
new file mode 100644
index 0000000..25ed246
--- /dev/null
+++ b/src/activitypub/fields.h
@@ -0,0 +1,38 @@
+#pragma once
+
+#include "src/types.h"
+#include <QString>
+#include <vector>
+
+enum struct APObjectType {NOTE, QUESTION, UNKNOWN};
+
+// All these fields (including APAttachmentFields, etc. in other files) are made to map to the fields present in the ActivityStream JSON's "object" for very easy construction.
+// There are additional fields that we don't use so they are not included in the objects (including parent and APActivity).
+
+struct APQuestionFields {
+ QString end_time;
+ QString closed_time;
+ int total_votes;
+ struct Option {
+ QString name;
+ int votes;
+ };
+ std::vector<Option> poll_options;
+};
+
+struct APObjectFields {
+ QStringList to_actors; // Start APObject
+ QStringList cc_actors;
+ QString by_actor;
+ QString object_url;
+ QString web_url;
+ QString reply_to_url;
+ QString published;
+ std::vector<APAttachmentFields> attachments; // End APObject
+ QStringList languages; // This is taken from "content_map"
+ QString content;
+ QString summary;
+ StatusType visibility; // status type discovery is better left to the archive/API parser as this can very between fedi implementations and archive formats
+
+ APQuestionFields question = {}; // only fill if it's of type Question.
+};