aboutsummaryrefslogtreecommitdiffstats
path: root/src/activitypub/apactor.h
blob: ad8d6894a516b2ab7e5e20caff7b9234d02f8b18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#pragma once

#include "apbase.h"
#include "apattachment.h"
#include <QDateTime>
#include <vector>

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(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<APPropertyValue> 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<APActor>, APBase {
public:
    QString get_html_render(HtmlRenderDetails render_info);
};