QXmpp: QXmppMixConfigItem.h Source File

QXmpp Version: 1.14.2

Loading...
Searching...
No Matches
QXmppMixConfigItem.h
1// SPDX-FileCopyrightText: 2023 Melvin Keskin <melvo@olomono.de>
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4
5#ifndef QXMPPMIXCONFIGITEM_H
6#define QXMPPMIXCONFIGITEM_H
7
8#include "QXmppDataForm.h"
9#include "QXmppPubSubBaseItem.h"
10
11class QXmppMixConfigItemPrivate;
12
13 class QXMPP_EXPORT QXmppMixConfigItem : public QXmppPubSubBaseItem
14{
15public:
16 enum class Role {
17 Owner,
18 Administrator,
19 Participant,
20 Allowed,
21 Anyone,
22 Nobody,
23 };
24
25 enum class Node {
26 AllowedJids = 1 << 0,
27 AvatarData = 1 << 1,
28 AvatarMetadata = 1 << 2,
29 BannedJids = 1 << 3,
30 Configuration = 1 << 4,
31 Information = 1 << 5,
32 JidMap = 1 << 6,
33 Messages = 1 << 7,
34 Participants = 1 << 8,
35 Presence = 1 << 9,
36 };
37 Q_DECLARE_FLAGS(Nodes, Node)
38
39 QXmppMixConfigItem();
40 QXmppMixConfigItem(const QXmppMixConfigItem &);
41 QXmppMixConfigItem(QXmppMixConfigItem &&);
42 ~QXmppMixConfigItem() override;
43
44 QXmppMixConfigItem &operator=(const QXmppMixConfigItem &);
45 QXmppMixConfigItem &operator=(QXmppMixConfigItem &&);
46
47 QXmppDataForm::Type formType() const;
48 void setFormType(QXmppDataForm::Type formType);
49
50 QString lastEditorJid() const;
51 void setLastEditorJid(const QString &lastEditorJid);
52
53 QStringList ownerJids() const;
54 void setOwnerJids(const QStringList &ownerJids);
55
56 QStringList administratorJids() const;
57 void setAdministratorJids(const QStringList &administratorJids);
58
59 QDateTime channelDeletion() const;
60 void setChannelDeletion(const QDateTime &channelDeletion);
61
62 Nodes nodes() const;
63 void setNodes(Nodes nodes);
64
65 std::optional<Role> messagesSubscribeRole() const;
66 void setMessagesSubscribeRole(std::optional<Role> messagesSubscribeRole);
67
68 std::optional<Role> messagesRetractRole() const;
69 void setMessagesRetractRole(std::optional<Role> messagesRetractRole);
70
71 std::optional<Role> presenceSubscribeRole() const;
72 void setPresenceSubscribeRole(std::optional<Role> presenceSubscribeRole);
73
74 std::optional<Role> participantsSubscribeRole() const;
75 void setParticipantsSubscribeRole(std::optional<Role> participantsSubscribeRole);
76
77 std::optional<Role> informationSubscribeRole() const;
78 void setInformationSubscribeRole(std::optional<Role> informationSubscribeRole);
79
80 std::optional<Role> informationUpdateRole() const;
81 void setInformationUpdateRole(std::optional<Role> informationUpdateRole);
82
83 std::optional<Role> allowedJidsSubscribeRole() const;
84 void setAllowedJidsSubscribeRole(std::optional<Role> allowedJidsSubscribeRole);
85
86 std::optional<Role> bannedJidsSubscribeRole() const;
87 void setBannedJidsSubscribeRole(std::optional<Role> bannedJidsSubscribeRole);
88
89 std::optional<Role> configurationReadRole() const;
90 void setConfigurationReadRole(std::optional<Role> configurationReadRole);
91
92 std::optional<Role> avatarUpdateRole() const;
93 void setAvatarUpdateRole(std::optional<Role> avatarUpdateRole);
94
95 std::optional<bool> nicknameRequired() const;
96 void setNicknameRequired(std::optional<bool> nicknameRequired);
97
98 std::optional<bool> presenceRequired() const;
99 void setPresenceRequired(std::optional<bool> presenceRequired);
100
101 std::optional<bool> onlyParticipantsPermittedToSubmitPresence() const;
102 void setOnlyParticipantsPermittedToSubmitPresence(std::optional<bool> onlyParticipantsPermittedToSubmitPresence);
103
104 std::optional<bool> ownMessageRetractionPermitted() const;
105 void setOwnMessageRetractionPermitted(std::optional<bool> ownMessageRetractionPermitted);
106
107 std::optional<bool> invitationsPermitted() const;
108 void setInvitationsPermitted(std::optional<bool> invitationsPermitted);
109
110 std::optional<bool> privateMessagesPermitted() const;
111 void setPrivateMessagesPermitted(std::optional<bool> privateMessagesPermitted);
112
113 static bool isItem(const QDomElement &itemElement);
114
115protected:
117 void parsePayload(const QDomElement &payloadElement) override;
118 void serializePayload(QXmlStreamWriter *writer) const override;
120
121private:
122 QSharedDataPointer<QXmppMixConfigItemPrivate> d;
123};
124
125Q_DECLARE_OPERATORS_FOR_FLAGS(QXmppMixConfigItem::Nodes)
127// Scoped enums (enum class) are not implicitly converted to int.
128inline auto qHash(QXmppMixConfigItem::Node key, uint seed) noexcept { return qHash(std::underlying_type_t<QXmppMixConfigItem::Node>(key), seed); }
130
131Q_DECLARE_METATYPE(QXmppMixConfigItem)
132Q_DECLARE_METATYPE(QXmppMixConfigItem::Nodes)
133
134#endif // QXMPPMIXCONFIGITEM_H
QXmppDataForm::Type
Type
This enum is used to describe a form's type.
Definition QXmppDataForm.h:176
QXmppMixConfigItem
The QXmppMixConfigItem class represents a PubSub item of a MIX channel containing its configuration a...
Definition QXmppMixConfigItem.h:14
QXmppMixConfigItem::operator=
QXmppMixConfigItem & operator=(QXmppMixConfigItem &&)
Default move-assignment operator.
QXmppMixConfigItem::setMessagesRetractRole
void setMessagesRetractRole(std::optional< Role > messagesRetractRole)
Definition QXmppMixItems.cpp:554
QXmppMixConfigItem::Role
Role
Definition QXmppMixConfigItem.h:16
QXmppMixConfigItem::participantsSubscribeRole
std::optional< Role > participantsSubscribeRole() const
Definition QXmppMixItems.cpp:589
QXmppMixConfigItem::bannedJidsSubscribeRole
std::optional< Role > bannedJidsSubscribeRole() const
Definition QXmppMixItems.cpp:689
QXmppMixConfigItem::setAvatarUpdateRole
void setAvatarUpdateRole(std::optional< Role > avatarUpdateRole)
Definition QXmppMixItems.cpp:759
QXmppMixConfigItem::operator=
QXmppMixConfigItem & operator=(const QXmppMixConfigItem &)
Default assignment operator.
QXmppMixConfigItem::setMessagesSubscribeRole
void setMessagesSubscribeRole(std::optional< Role > messagesSubscribeRole)
Definition QXmppMixItems.cpp:529
QXmppMixConfigItem::ownerJids
QStringList ownerJids() const
Definition QXmppMixItems.cpp:424
QXmppMixConfigItem::Node
Node
Definition QXmppMixConfigItem.h:25
QXmppMixConfigItem::nodes
Nodes nodes() const
Definition QXmppMixItems.cpp:494
QXmppMixConfigItem::setConfigurationReadRole
void setConfigurationReadRole(std::optional< Role > configurationReadRole)
Definition QXmppMixItems.cpp:734
QXmppMixConfigItem::informationUpdateRole
std::optional< Role > informationUpdateRole() const
Definition QXmppMixItems.cpp:634
QXmppMixConfigItem::setAllowedJidsSubscribeRole
void setAllowedJidsSubscribeRole(std::optional< Role > allowedJidsSubscribeRole)
Definition QXmppMixItems.cpp:678
QXmppMixConfigItem::setOnlyParticipantsPermittedToSubmitPresence
void setOnlyParticipantsPermittedToSubmitPresence(std::optional< bool > onlyParticipantsPermittedToSubmitPresence)
Definition QXmppMixItems.cpp:820
QXmppMixConfigItem::informationSubscribeRole
std::optional< Role > informationSubscribeRole() const
Definition QXmppMixItems.cpp:609
QXmppMixConfigItem::setInvitationsPermitted
void setInvitationsPermitted(std::optional< bool > invitationsPermitted)
Definition QXmppMixItems.cpp:868
QXmppMixConfigItem::setParticipantsSubscribeRole
void setParticipantsSubscribeRole(std::optional< Role > participantsSubscribeRole)
Definition QXmppMixItems.cpp:599
QXmppMixConfigItem::messagesRetractRole
std::optional< Role > messagesRetractRole() const
Definition QXmppMixItems.cpp:539
QXmppMixConfigItem::setInformationUpdateRole
void setInformationUpdateRole(std::optional< Role > informationUpdateRole)
Definition QXmppMixItems.cpp:649
QXmppMixConfigItem::configurationReadRole
std::optional< Role > configurationReadRole() const
Definition QXmppMixItems.cpp:717
QXmppMixConfigItem::ownMessageRetractionPermitted
std::optional< bool > ownMessageRetractionPermitted() const
Definition QXmppMixItems.cpp:830
QXmppMixConfigItem::onlyParticipantsPermittedToSubmitPresence
std::optional< bool > onlyParticipantsPermittedToSubmitPresence() const
Definition QXmppMixItems.cpp:809
QXmppMixConfigItem::setFormType
void setFormType(QXmppDataForm::Type formType)
Definition QXmppMixItems.cpp:386
QXmppMixConfigItem::avatarUpdateRole
std::optional< Role > avatarUpdateRole() const
Definition QXmppMixItems.cpp:744
QXmppMixConfigItem::QXmppMixConfigItem
QXmppMixConfigItem(QXmppMixConfigItem &&)
Default move-constructor.
QXmppMixConfigItem::setOwnerJids
void setOwnerJids(const QStringList &ownerJids)
Definition QXmppMixItems.cpp:436
QXmppMixConfigItem::formType
QXmppDataForm::Type formType() const
Definition QXmppMixItems.cpp:376
QXmppMixConfigItem::allowedJidsSubscribeRole
std::optional< Role > allowedJidsSubscribeRole() const
Definition QXmppMixItems.cpp:660
QXmppMixConfigItem::setAdministratorJids
void setAdministratorJids(const QStringList &administratorJids)
Definition QXmppMixItems.cpp:460
QXmppMixConfigItem::presenceRequired
std::optional< bool > presenceRequired() const
Definition QXmppMixItems.cpp:789
QXmppMixConfigItem::presenceSubscribeRole
std::optional< Role > presenceSubscribeRole() const
Definition QXmppMixItems.cpp:564
QXmppMixConfigItem::setLastEditorJid
void setLastEditorJid(const QString &lastEditorJid)
Definition QXmppMixItems.cpp:410
QXmppMixConfigItem::setBannedJidsSubscribeRole
void setBannedJidsSubscribeRole(std::optional< Role > bannedJidsSubscribeRole)
Definition QXmppMixItems.cpp:707
QXmppMixConfigItem::lastEditorJid
QString lastEditorJid() const
Definition QXmppMixItems.cpp:398
QXmppMixConfigItem::administratorJids
QStringList administratorJids() const
Definition QXmppMixItems.cpp:448
QXmppMixConfigItem::setPrivateMessagesPermitted
void setPrivateMessagesPermitted(std::optional< bool > privateMessagesPermitted)
Definition QXmppMixItems.cpp:888
QXmppMixConfigItem::channelDeletion
QDateTime channelDeletion() const
Definition QXmppMixItems.cpp:472
QXmppMixConfigItem::setOwnMessageRetractionPermitted
void setOwnMessageRetractionPermitted(std::optional< bool > ownMessageRetractionPermitted)
Definition QXmppMixItems.cpp:840
QXmppMixConfigItem::messagesSubscribeRole
std::optional< Role > messagesSubscribeRole() const
Definition QXmppMixItems.cpp:514
QXmppMixConfigItem::setNicknameRequired
void setNicknameRequired(std::optional< bool > nicknameRequired)
Definition QXmppMixItems.cpp:779
QXmppMixConfigItem::QXmppMixConfigItem
QXmppMixConfigItem(const QXmppMixConfigItem &)
Default copy-constructor.
QXmppMixConfigItem::privateMessagesPermitted
std::optional< bool > privateMessagesPermitted() const
Definition QXmppMixItems.cpp:878
QXmppMixConfigItem::invitationsPermitted
std::optional< bool > invitationsPermitted() const
Definition QXmppMixItems.cpp:856
QXmppMixConfigItem::setPresenceSubscribeRole
void setPresenceSubscribeRole(std::optional< Role > presenceSubscribeRole)
Definition QXmppMixItems.cpp:579
QXmppMixConfigItem::setInformationSubscribeRole
void setInformationSubscribeRole(std::optional< Role > informationSubscribeRole)
Definition QXmppMixItems.cpp:624
QXmppMixConfigItem::setNodes
void setNodes(Nodes nodes)
Definition QXmppMixItems.cpp:504
QXmppMixConfigItem::nicknameRequired
std::optional< bool > nicknameRequired() const
Definition QXmppMixItems.cpp:769
QXmppMixConfigItem::setChannelDeletion
void setChannelDeletion(const QDateTime &channelDeletion)
Definition QXmppMixItems.cpp:484
QXmppMixConfigItem::setPresenceRequired
void setPresenceRequired(std::optional< bool > presenceRequired)
Definition QXmppMixItems.cpp:799
QXmppPubSubBaseItem::serializePayload
virtual void serializePayload(QXmlStreamWriter *writer) const
Definition QXmppPubSubBaseItem.cpp:154
QXmppPubSubBaseItem::QXmppPubSubBaseItem
QXmppPubSubBaseItem(const QString &id={}, const QString &publisher={})
Definition QXmppPubSubBaseItem.cpp:62
QXmppPubSubBaseItem::parsePayload
virtual void parsePayload(const QDomElement &payloadElement)
Definition QXmppPubSubBaseItem.cpp:144
QXmppPubSubBaseItem::isItem
static bool isItem(const QDomElement &element)
Definition QXmppPubSubBaseItem.cpp:134