QXmppPubSubNodeConfig Class

The QXmppPubSubNodeConfig class represents the configuration of a PubSub node as defined by XEP-0060: Publish-Subscribe. More...

Header: #include <QXmppPubSubNodeConfig.h>
Since: QXmpp 1.5
Inherits: QXmppExtensibleDataFormBase
Inherited By:

QXmppPubSubPublishOptions

Public Types

struct Max
struct Unset
enum AccessModel { Open, Presence, Roster, Authorize, Allowlist }
enum class ChildAssociationPolicy { All, Owners, Whitelist }
ItemLimit
enum ItemPublisher { NodeOwner, Publisher }
enum NodeType { Leaf, Collection }
enum NotificationType { Normal, Headline }
enum PublishModel { Publishers, Subscribers, Anyone }
enum SendLastItemType { Never, OnSubscription, OnSubscriptionAndPresence }

Public Functions

QXmppPubSubNodeConfig()
QXmppPubSubNodeConfig(const QXmppPubSubNodeConfig &)
QXmppPubSubNodeConfig(QXmppPubSubNodeConfig &&)
std::optional<QXmppPubSubNodeConfig::AccessModel> accessModel() const
std::optional<bool> allowSubscriptions() const
QStringList allowedRosterGroups() const
QString bodyXslt() const
QStringList childAssociationAllowlist() const
std::optional<QXmppPubSubNodeConfig::ChildAssociationPolicy> childAssociationPolicy() const
QStringList childNodes() const
std::optional<quint32> childNodesMax() const
QStringList collections() const
std::optional<bool> configNotificationsEnabled() const
QStringList contactJids() const
QString dataFormXslt() const
std::optional<bool> deleteNotificationsEnabled() const
QString description() const
std::optional<bool> includePayloads() const
std::optional<quint32> itemExpiry() const
QString language() const
QXmppPubSubNodeConfig::ItemLimit maxItems() const
std::optional<quint32> maxPayloadSize() const
std::optional<QXmppPubSubNodeConfig::NodeType> nodeType() const
std::optional<QXmppPubSubNodeConfig::ItemPublisher> notificationItemPublisher() const
std::optional<QXmppPubSubNodeConfig::NotificationType> notificationType() const
std::optional<bool> notificationsEnabled() const
QString payloadType() const
std::optional<bool> persistItems() const
std::optional<bool> presenceBasedNotifications() const
std::optional<QXmppPubSubNodeConfig::PublishModel> publishModel() const
std::optional<bool> purgeWhenOffline() const
void resetMaxItems()
std::optional<bool> retractNotificationsEnabled() const
std::optional<QXmppPubSubNodeConfig::SendLastItemType> sendLastItem() const
void setAccessModel(std::optional<QXmppPubSubNodeConfig::AccessModel> accessModel)
void setAllowSubscriptions(std::optional<bool> allowSubscriptions)
void setAllowedRosterGroups(const QStringList &allowedRosterGroups)
void setBodyXslt(const QString &bodyXslt)
void setChildAssociationAllowlist(const QStringList &childAssociationWhitelist)
void setChildAssociationPolicy(std::optional<QXmppPubSubNodeConfig::ChildAssociationPolicy> childAssociationPolicy)
void setChildNodes(const QStringList &childNodes)
void setChildNodesMax(std::optional<quint32> childNodesMax)
void setCollections(const QStringList &collections)
void setConfigNotificationsEnabled(std::optional<bool> configNotificationsEnabled)
void setContactJids(const QStringList &contactJids)
void setDataFormXslt(const QString &dataFormXslt)
void setDeleteNotificationsEnabled(std::optional<bool> nodeDeleteNotificationsEnabled)
void setDescription(const QString &description)
void setIncludePayloads(std::optional<bool> includePayloads)
void setItemExpiry(std::optional<quint32> itemExpiry)
void setLanguage(const QString &language)
void setMaxItems(QXmppPubSubNodeConfig::ItemLimit maxItems)
void setMaxPayloadSize(std::optional<quint32> maxPayloadSize)
void setNodeType(std::optional<QXmppPubSubNodeConfig::NodeType> nodeType)
void setNotificationItemPublisher(std::optional<QXmppPubSubNodeConfig::ItemPublisher> notificationItemPublisher)
void setNotificationType(std::optional<QXmppPubSubNodeConfig::NotificationType> notificationType)
void setNotificationsEnabled(std::optional<bool> notificationsEnabled)
void setPayloadType(const QString &payloadType)
void setPersistItems(std::optional<bool> persistItems)
void setPresenceBasedNotifications(std::optional<bool> presenceBasedNotifications)
void setPublishModel(std::optional<QXmppPubSubNodeConfig::PublishModel> publishModel)
void setPurgeWhenOffline(std::optional<bool> purgeWhenOffline)
void setRetractNotificationsEnabled(std::optional<bool> retractNotificationsEnabled)
void setSendLastItem(std::optional<QXmppPubSubNodeConfig::SendLastItemType> sendLastItem)
void setSubNotificationsEnabled(std::optional<bool> subNotificationsEnabled)
void setTemporarySubscriptions(std::optional<bool> temporarySubscriptions)
void setTitle(const QString &title)
std::optional<bool> subNotificationsEnabled() const
std::optional<bool> temporarySubscriptions() const
QString title() const
QXmppPubSubNodeConfig &operator=(QXmppPubSubNodeConfig &&)
QXmppPubSubNodeConfig &operator=(const QXmppPubSubNodeConfig &)

Static Public Members

std::optional<QXmppPubSubNodeConfig> fromDataForm(const QXmppDataForm &form)

Detailed Description

The configuration is exchanged as a data form with the form type http://jabber.org/protocol/pubsub#node_config. It can be requested and changed by the node owner, e.g. using QXmppPubSubManager::requestNodeConfiguration() and QXmppPubSubManager::configureNode().

All fields are optional: std::nullopt, empty strings and empty lists mean that a field is not set and it is not included in the serialized form. Fields that are not known to this class are kept as additional fields of the QXmppExtensibleDataFormBase.

See also QXmppPubSubPublishOptions and QXmppPubSubMetadata.

Member Type Documentation

enum QXmppPubSubNodeConfig::AccessModel

Describes who may subscribe to a node and retrieve its items.

ConstantValueDescription
QXmppPubSubNodeConfig::Open0Anyone may subscribe and retrieve items.
QXmppPubSubNodeConfig::Presence1Only contacts with a presence subscription may subscribe.
QXmppPubSubNodeConfig::Roster2Only contacts in allowed roster groups may subscribe.
QXmppPubSubNodeConfig::Authorize3Subscriptions must be approved by the node owner.
QXmppPubSubNodeConfig::Allowlist4Only users on a whitelist set by the owner may subscribe.

enum class QXmppPubSubNodeConfig::ChildAssociationPolicy

Describes the policy for associating child nodes with a collection node.

ConstantValueDescription
QXmppPubSubNodeConfig::ChildAssociationPolicy::All0Any node may be associated as a child.
QXmppPubSubNodeConfig::ChildAssociationPolicy::Owners1Only node owners may associate child nodes.
QXmppPubSubNodeConfig::ChildAssociationPolicy::Whitelist2Only nodes whose owners are on the whitelist may be associated.

[alias] QXmppPubSubNodeConfig::ItemLimit

Maximum number of items of a node: either a number, Max for the maximum supported by the service or Unset if no limit has been set.

enum QXmppPubSubNodeConfig::ItemPublisher

Describes who is shown as the publisher of an item.

ConstantValueDescription
QXmppPubSubNodeConfig::NodeOwner0The node owner is shown as the publisher.
QXmppPubSubNodeConfig::Publisher1The actual publisher of the item is shown.

enum QXmppPubSubNodeConfig::NodeType

Describes the type of a PubSub node.

ConstantValueDescription
QXmppPubSubNodeConfig::Leaf0A leaf node stores and distributes items.
QXmppPubSubNodeConfig::Collection1A collection node contains other nodes.

enum QXmppPubSubNodeConfig::NotificationType

Describes the message type used to deliver event notifications.

ConstantValueDescription
QXmppPubSubNodeConfig::Normal0Notifications are delivered as normal messages.
QXmppPubSubNodeConfig::Headline1Notifications are delivered as headline messages.

enum QXmppPubSubNodeConfig::PublishModel

Describes who is allowed to publish items to a node.

ConstantValueDescription
QXmppPubSubNodeConfig::Publishers0Only explicitly designated publishers may publish.
QXmppPubSubNodeConfig::Subscribers1Any subscriber may publish.
QXmppPubSubNodeConfig::Anyone2Anyone may publish, including non-subscribers.

enum QXmppPubSubNodeConfig::SendLastItemType

Describes when the last published item is sent to a new subscriber.

ConstantValueDescription
QXmppPubSubNodeConfig::Never0The last item is never sent on subscription.
QXmppPubSubNodeConfig::OnSubscription1The last item is sent when a subscription is created.
QXmppPubSubNodeConfig::OnSubscriptionAndPresence2The last item is sent on subscription and on each presence change.

Member Function Documentation

QXmppPubSubNodeConfig::QXmppPubSubNodeConfig()

Constructs an empty node configuration.

QXmppPubSubNodeConfig::QXmppPubSubNodeConfig(const QXmppPubSubNodeConfig &)

Default copy-constructor

QXmppPubSubNodeConfig::QXmppPubSubNodeConfig(QXmppPubSubNodeConfig &&)

Default move-constructor

std::optional<QXmppPubSubNodeConfig::AccessModel> QXmppPubSubNodeConfig::accessModel() const

Returns the access model of the node.

The access model defines who may subscribe to the node and retrieve its items.

This corresponds to the pubsub#access_model field.

See also setAccessModel().

std::optional<bool> QXmppPubSubNodeConfig::allowSubscriptions() const

Returns whether subscriptions to the node are allowed.

This corresponds to the pubsub#subscribe field.

See also setAllowSubscriptions().

QStringList QXmppPubSubNodeConfig::allowedRosterGroups() const

Returns the roster groups that are allowed to subscribe and retrieve items.

Only used with the AccessModel::Roster access model.

This corresponds to the pubsub#roster_groups_allowed field.

See also setAllowedRosterGroups().

QString QXmppPubSubNodeConfig::bodyXslt() const

Returns the URL of the XSL transformation for message bodies.

The transformation is applied to payloads in order to generate an appropriate message body element.

This corresponds to the pubsub#body_xslt field.

See also setBodyXslt().

QStringList QXmppPubSubNodeConfig::childAssociationAllowlist() const

Returns the list of entities that may associate child nodes.

Only used with the ChildAssociationPolicy::Whitelist policy.

This corresponds to the pubsub#children_association_whitelist field.

See also setChildAssociationAllowlist().

std::optional<QXmppPubSubNodeConfig::ChildAssociationPolicy> QXmppPubSubNodeConfig::childAssociationPolicy() const

Returns the child association policy.

Defines who may associate leaf nodes with a collection node.

This corresponds to the pubsub#children_association_policy field.

See also setChildAssociationPolicy().

QStringList QXmppPubSubNodeConfig::childNodes() const

Returns the child nodes of this collection node.

Only applicable to collection nodes.

This corresponds to the pubsub#children field.

See also setChildNodes().

std::optional<quint32> QXmppPubSubNodeConfig::childNodesMax() const

Returns the maximum number of child nodes.

The maximum number of child nodes that can be associated with a collection node.

This corresponds to the pubsub#children_max field.

See also setChildNodesMax().

QStringList QXmppPubSubNodeConfig::collections() const

Returns the collection nodes this node is affiliated with.

This corresponds to the pubsub#collection field.

See also setCollections().

std::optional<bool> QXmppPubSubNodeConfig::configNotificationsEnabled() const

Returns whether subscribers are notified when the node configuration changes.

This corresponds to the pubsub#notify_config field.

See also setConfigNotificationsEnabled().

QStringList QXmppPubSubNodeConfig::contactJids() const

Returns the JIDs of the entities to contact with questions about the node.

This corresponds to the pubsub#contact field.

See also setContactJids().

QString QXmppPubSubNodeConfig::dataFormXslt() const

Returns the URL of the XSL transformation for data forms.

The transformation is applied to the payload format in order to generate a valid data form that the client could display.

This corresponds to the pubsub#dataform_xslt field.

See also setDataFormXslt().

std::optional<bool> QXmppPubSubNodeConfig::deleteNotificationsEnabled() const

Returns whether subscribers are notified when the node is deleted.

This corresponds to the pubsub#notify_delete field.

See also setDeleteNotificationsEnabled().

QString QXmppPubSubNodeConfig::description() const

Returns the description of the node.

This corresponds to the pubsub#description field.

See also setDescription().

[static] std::optional<QXmppPubSubNodeConfig> QXmppPubSubNodeConfig::fromDataForm(const QXmppDataForm &form)

Parses the node configuration from form.

Returns std::nullopt if the form type of form is not http://jabber.org/protocol/pubsub#node_config or if the form could not be parsed.

std::optional<bool> QXmppPubSubNodeConfig::includePayloads() const

Returns whether item payloads are included in event notifications.

Only applicable to leaf nodes.

This corresponds to the pubsub#deliver_payloads field.

See also setIncludePayloads().

std::optional<quint32> QXmppPubSubNodeConfig::itemExpiry() const

Returns the number of seconds after which items are purged automatically.

This corresponds to the pubsub#item_expire field.

See also setItemExpiry().

QString QXmppPubSubNodeConfig::language() const

Returns the default language of the node.

This corresponds to the pubsub#language field.

See also setLanguage().

QXmppPubSubNodeConfig::ItemLimit QXmppPubSubNodeConfig::maxItems() const

Returns the maximum number of items the node keeps.

The limit is either a number, Max for the maximum supported by the service or Unset.

This corresponds to the pubsub#max_items field.

See also setMaxItems().

std::optional<quint32> QXmppPubSubNodeConfig::maxPayloadSize() const

Returns the maximum payload size in bytes.

This corresponds to the pubsub#max_payload_size field.

See also setMaxPayloadSize().

std::optional<QXmppPubSubNodeConfig::NodeType> QXmppPubSubNodeConfig::nodeType() const

Returns the type of the node.

Whether the node is a leaf node (the default) or a collection node.

This corresponds to the pubsub#node_type field.

See also setNodeType().

std::optional<QXmppPubSubNodeConfig::ItemPublisher> QXmppPubSubNodeConfig::notificationItemPublisher() const

Returns who is shown as the publisher of items.

Defines whether the node owner or the publisher of an item should receive replies to it.

This corresponds to the pubsub#itemreply field.

See also setNotificationItemPublisher().

std::optional<QXmppPubSubNodeConfig::NotificationType> QXmppPubSubNodeConfig::notificationType() const

Returns the message type of event notifications.

This corresponds to the pubsub#notification_type field.

See also setNotificationType().

std::optional<bool> QXmppPubSubNodeConfig::notificationsEnabled() const

Returns whether event notifications are delivered.

This corresponds to the pubsub#deliver_notifications field.

See also setNotificationsEnabled().

QString QXmppPubSubNodeConfig::payloadType() const

Returns the type of the payload of the node's items.

This is usually the namespace of the payload elements.

This corresponds to the pubsub#type field.

See also setPayloadType().

std::optional<bool> QXmppPubSubNodeConfig::persistItems() const

Returns whether items are persisted in the node.

This corresponds to the pubsub#persist_items field.

See also setPersistItems().

std::optional<bool> QXmppPubSubNodeConfig::presenceBasedNotifications() const

Returns whether event notifications are only delivered to available users.

This corresponds to the pubsub#presence_based_delivery field.

See also setPresenceBasedNotifications().

std::optional<QXmppPubSubNodeConfig::PublishModel> QXmppPubSubNodeConfig::publishModel() const

Returns the publish model of the node.

The publish model defines who is allowed to publish items to the node.

This corresponds to the pubsub#publish_model field.

See also setPublishModel().

std::optional<bool> QXmppPubSubNodeConfig::purgeWhenOffline() const

Returns whether all items are purged when the publisher goes offline.

This corresponds to the pubsub#purge_offline field.

See also setPurgeWhenOffline().

void QXmppPubSubNodeConfig::resetMaxItems()

Resets the maximum number of items to Unset.

See also maxItems() and setMaxItems().

std::optional<bool> QXmppPubSubNodeConfig::retractNotificationsEnabled() const

Returns whether subscribers are notified when items are removed from the node.

This corresponds to the pubsub#notify_retract field.

See also setRetractNotificationsEnabled().

std::optional<QXmppPubSubNodeConfig::SendLastItemType> QXmppPubSubNodeConfig::sendLastItem() const

Returns when the last published item is sent to subscribers.

This corresponds to the pubsub#send_last_published_item field.

See also setSendLastItem().

void QXmppPubSubNodeConfig::setAccessModel(std::optional<QXmppPubSubNodeConfig::AccessModel> accessModel)

Sets the access model of the node to accessModel.

See also accessModel().

void QXmppPubSubNodeConfig::setAllowSubscriptions(std::optional<bool> allowSubscriptions)

Sets whether subscriptions to the node are allowed (allowSubscriptions).

See also allowSubscriptions().

void QXmppPubSubNodeConfig::setAllowedRosterGroups(const QStringList &allowedRosterGroups)

Sets the roster groups that are allowed to subscribe and retrieve items to allowedRosterGroups.

See also allowedRosterGroups().

void QXmppPubSubNodeConfig::setBodyXslt(const QString &bodyXslt)

Sets the URL of the XSL transformation for message bodies to bodyXslt.

See also bodyXslt().

void QXmppPubSubNodeConfig::setChildAssociationAllowlist(const QStringList &childAssociationWhitelist)

Sets the list of entities that may associate child nodes to childAssociationWhitelist.

See also childAssociationAllowlist().

void QXmppPubSubNodeConfig::setChildAssociationPolicy(std::optional<QXmppPubSubNodeConfig::ChildAssociationPolicy> childAssociationPolicy)

Sets the child association policy to childAssociationPolicy.

See also childAssociationPolicy().

void QXmppPubSubNodeConfig::setChildNodes(const QStringList &childNodes)

Sets the child nodes of this collection node to childNodes.

See also childNodes().

void QXmppPubSubNodeConfig::setChildNodesMax(std::optional<quint32> childNodesMax)

Sets the maximum number of child nodes to childNodesMax.

See also childNodesMax().

void QXmppPubSubNodeConfig::setCollections(const QStringList &collections)

Sets the collection nodes this node is affiliated with to collections.

See also collections().

void QXmppPubSubNodeConfig::setConfigNotificationsEnabled(std::optional<bool> configNotificationsEnabled)

Sets whether subscribers are notified when the node configuration changes (configNotificationsEnabled).

See also configNotificationsEnabled().

void QXmppPubSubNodeConfig::setContactJids(const QStringList &contactJids)

Sets the JIDs of the entities to contact with questions about the node to contactJids.

See also contactJids().

void QXmppPubSubNodeConfig::setDataFormXslt(const QString &dataFormXslt)

Sets the URL of the XSL transformation for data forms to dataFormXslt.

See also dataFormXslt().

void QXmppPubSubNodeConfig::setDeleteNotificationsEnabled(std::optional<bool> nodeDeleteNotificationsEnabled)

Sets whether subscribers are notified when the node is deleted (nodeDeleteNotificationsEnabled).

See also deleteNotificationsEnabled().

void QXmppPubSubNodeConfig::setDescription(const QString &description)

Sets the description of the node to description.

See also description().

void QXmppPubSubNodeConfig::setIncludePayloads(std::optional<bool> includePayloads)

Sets whether item payloads are included in event notifications (includePayloads).

See also includePayloads().

void QXmppPubSubNodeConfig::setItemExpiry(std::optional<quint32> itemExpiry)

Sets the number of seconds after which items are purged automatically to itemExpiry.

See also itemExpiry().

void QXmppPubSubNodeConfig::setLanguage(const QString &language)

Sets the default language of the node to language.

See also language().

void QXmppPubSubNodeConfig::setMaxItems(QXmppPubSubNodeConfig::ItemLimit maxItems)

Sets the maximum number of items the node keeps to maxItems.

See also maxItems().

void QXmppPubSubNodeConfig::setMaxPayloadSize(std::optional<quint32> maxPayloadSize)

Sets the maximum payload size in bytes to maxPayloadSize.

See also maxPayloadSize().

void QXmppPubSubNodeConfig::setNodeType(std::optional<QXmppPubSubNodeConfig::NodeType> nodeType)

Sets the type of the node to nodeType.

See also nodeType().

void QXmppPubSubNodeConfig::setNotificationItemPublisher(std::optional<QXmppPubSubNodeConfig::ItemPublisher> notificationItemPublisher)

Sets who is shown as the publisher of items to notificationItemPublisher.

See also notificationItemPublisher().

void QXmppPubSubNodeConfig::setNotificationType(std::optional<QXmppPubSubNodeConfig::NotificationType> notificationType)

Sets the message type of event notifications to notificationType.

See also notificationType().

void QXmppPubSubNodeConfig::setNotificationsEnabled(std::optional<bool> notificationsEnabled)

Sets whether event notifications are delivered (notificationsEnabled).

See also notificationsEnabled().

void QXmppPubSubNodeConfig::setPayloadType(const QString &payloadType)

Sets the type of the payload of the node's items to payloadType.

See also payloadType().

void QXmppPubSubNodeConfig::setPersistItems(std::optional<bool> persistItems)

Sets whether items are persisted in the node (persistItems).

See also persistItems().

void QXmppPubSubNodeConfig::setPresenceBasedNotifications(std::optional<bool> presenceBasedNotifications)

Sets whether event notifications are only delivered to available users (presenceBasedNotifications).

See also presenceBasedNotifications().

void QXmppPubSubNodeConfig::setPublishModel(std::optional<QXmppPubSubNodeConfig::PublishModel> publishModel)

Sets the publish model of the node to publishModel.

See also publishModel().

void QXmppPubSubNodeConfig::setPurgeWhenOffline(std::optional<bool> purgeWhenOffline)

Sets whether all items are purged when the publisher goes offline (purgeWhenOffline).

See also purgeWhenOffline().

void QXmppPubSubNodeConfig::setRetractNotificationsEnabled(std::optional<bool> retractNotificationsEnabled)

Sets whether subscribers are notified when items are removed from the node (retractNotificationsEnabled).

See also retractNotificationsEnabled().

void QXmppPubSubNodeConfig::setSendLastItem(std::optional<QXmppPubSubNodeConfig::SendLastItemType> sendLastItem)

Sets when the last published item is sent to subscribers to sendLastItem.

See also sendLastItem().

void QXmppPubSubNodeConfig::setSubNotificationsEnabled(std::optional<bool> subNotificationsEnabled)

Sets whether owners are notified about new subscribers and unsubscribes (subNotificationsEnabled).

See also subNotificationsEnabled().

void QXmppPubSubNodeConfig::setTemporarySubscriptions(std::optional<bool> temporarySubscriptions)

Sets whether all subscriptions are temporary (temporarySubscriptions).

See also temporarySubscriptions().

void QXmppPubSubNodeConfig::setTitle(const QString &title)

Sets the human readable name of the node to title.

See also title().

std::optional<bool> QXmppPubSubNodeConfig::subNotificationsEnabled() const

Returns whether owners are notified about new subscribers and unsubscribes.

This corresponds to the pubsub#notify_sub field.

See also setSubNotificationsEnabled().

std::optional<bool> QXmppPubSubNodeConfig::temporarySubscriptions() const

Returns whether all subscriptions are temporary.

Temporary subscriptions are based on the presence of the subscriber.

This corresponds to the pubsub#tempsub field.

See also setTemporarySubscriptions().

QString QXmppPubSubNodeConfig::title() const

Returns the human readable name of the node.

This corresponds to the pubsub#title field.

See also setTitle().

QXmppPubSubNodeConfig &QXmppPubSubNodeConfig::operator=(QXmppPubSubNodeConfig &&)

Default move-assignment operator

QXmppPubSubNodeConfig &QXmppPubSubNodeConfig::operator=(const QXmppPubSubNodeConfig &)

Default assignment operator