diff options
author | ConfuSomu | 2023-07-18 00:00:20 +0200 |
---|---|---|
committer | ConfuSomu | 2023-07-18 00:00:20 +0200 |
commit | 5ed7d9b53a65aec1f4793f62ac15195c44224b39 (patch) | |
tree | 20f59b643ab185abc8eeecb6338d565ed36febda /src/activitypub/apquestion.h | |
parent | e322946df7c33f76dbee46ec5b8e2118fbae8a26 (diff) | |
download | ActorViewer-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/apquestion.h')
-rw-r--r-- | src/activitypub/apquestion.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/activitypub/apquestion.h b/src/activitypub/apquestion.h new file mode 100644 index 0000000..350ceec --- /dev/null +++ b/src/activitypub/apquestion.h @@ -0,0 +1,34 @@ +#pragma once + +#include "appost.h" +#include "apbase.h" +#include "fields.h" +#include <vector> +#include <list> + +// APQuestion represents an ActivityPub Question Object +class APQuestion : public APPost { +public: + APQuestion(); + // A post that will be built from strings, including attachments + APQuestion(APObjectFields fields); + ~APQuestion() {}; + + QString get_html_render(HtmlRenderDetails render_info); + +protected: + struct PollOption { + QString name; + int votes; + }; + typedef std::vector<PollOption> PollOptionList; + + QDateTime end_time; + QDateTime closed_time; + + int total_votes = 0; + + PollOptionList options; + + QString get_html_poll_options(HtmlRenderDetails render_info); +}; |