QXmppPubSubSubscribeOptions Class

The QXmppPubSubSubscribeOptions class represents the options of a PubSub subscription as defined by XEP-0060: Publish-Subscribe. More...

Header: #include <QXmppPubSubSubscribeOptions.h>
Since: QXmpp 1.5
Inherits: QXmppExtensibleDataFormBase

Public Types

enum PresenceState { Unset, Online, Away, Chat, DoNotDisturb, ExtendedAway }
flags PresenceStates
enum SubscriptionDepth { TopLevelOnly, Recursive }
enum SubscriptionType { Items, Nodes }

Public Functions

QXmppPubSubSubscribeOptions()
QXmppPubSubSubscribeOptions(const QXmppPubSubSubscribeOptions &)
QXmppPubSubSubscribeOptions(QXmppPubSubSubscribeOptions &&)
std::optional<bool> bodyIncluded() const
std::optional<quint32> digestFrequencyMs() const
std::optional<bool> digestsEnabled() const
QDateTime expire() const
QXmppPubSubSubscribeOptions::PresenceStates notificationRules() const
std::optional<bool> notificationsEnabled() const
void setBodyIncluded(std::optional<bool> bodyIncluded)
void setDigestFrequencyMs(std::optional<quint32> digestFrequencyMs)
void setDigestsEnabled(std::optional<bool> digestsEnabled)
void setExpire(const QDateTime &expire)
void setNotificationRules(QXmppPubSubSubscribeOptions::PresenceStates notificationRules)
void setNotificationsEnabled(std::optional<bool> enabled)
void setSubscriptionDepth(std::optional<QXmppPubSubSubscribeOptions::SubscriptionDepth> subscriptionDepth)
void setSubscriptionType(std::optional<QXmppPubSubSubscribeOptions::SubscriptionType> subscriptionType)
std::optional<QXmppPubSubSubscribeOptions::SubscriptionDepth> subscriptionDepth() const
std::optional<QXmppPubSubSubscribeOptions::SubscriptionType> subscriptionType() const
QXmppPubSubSubscribeOptions &operator=(QXmppPubSubSubscribeOptions &&)
QXmppPubSubSubscribeOptions &operator=(const QXmppPubSubSubscribeOptions &)

Static Public Members

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

Detailed Description

Subscribe options are exchanged as a data form with the form type http://jabber.org/protocol/pubsub#subscribe_options. They can be requested and changed using QXmppPubSubManager::requestSubscribeOptions() and QXmppPubSubManager::setSubscribeOptions().

All fields are optional: std::nullopt, invalid dates and empty flags mean that a field is not set and it is not included in the serialized form.

Member Type Documentation

enum QXmppPubSubSubscribeOptions::PresenceState
flags QXmppPubSubSubscribeOptions::PresenceStates

Describes a subscriber's presence state for which event notifications should be delivered. Multiple values may be combined as a flag set.

ConstantValueDescription
QXmppPubSubSubscribeOptions::Unset0x00No specific presence state filter is configured.
QXmppPubSubSubscribeOptions::Online0x01Deliver notifications when the subscriber is online.
QXmppPubSubSubscribeOptions::Away0x02Deliver notifications when the subscriber is away.
QXmppPubSubSubscribeOptions::Chat0x04Deliver notifications when the subscriber is available for chat.
QXmppPubSubSubscribeOptions::DoNotDisturb0x08Deliver notifications when the subscriber has set do-not-disturb.
QXmppPubSubSubscribeOptions::ExtendedAway0x10Deliver notifications when the subscriber is in extended away state.

The PresenceStates type is a typedef for QFlags<PresenceState>. It stores an OR combination of PresenceState values.

enum QXmppPubSubSubscribeOptions::SubscriptionDepth

Describes how deep into a node hierarchy a subscription reaches.

ConstantValueDescription
QXmppPubSubSubscribeOptions::TopLevelOnly0Subscribe only to the node itself.
QXmppPubSubSubscribeOptions::Recursive1Subscribe to the node and all its descendants recursively.

enum QXmppPubSubSubscribeOptions::SubscriptionType

Describes what kind of objects a subscription applies to.

ConstantValueDescription
QXmppPubSubSubscribeOptions::Items0Subscribe to items published to the node.
QXmppPubSubSubscribeOptions::Nodes1Subscribe to child nodes of a collection node.

Member Function Documentation

QXmppPubSubSubscribeOptions::QXmppPubSubSubscribeOptions()

Constructs empty subscribe options.

QXmppPubSubSubscribeOptions::QXmppPubSubSubscribeOptions(const QXmppPubSubSubscribeOptions &)

Default copy-constructor

QXmppPubSubSubscribeOptions::QXmppPubSubSubscribeOptions(QXmppPubSubSubscribeOptions &&)

Default move-constructor

std::optional<bool> QXmppPubSubSubscribeOptions::bodyIncluded() const

Returns whether event notifications include a message body.

This corresponds to the pubsub#include_body field.

See also setBodyIncluded().

std::optional<quint32> QXmppPubSubSubscribeOptions::digestFrequencyMs() const

Returns the minimum number of milliseconds between two digests.

This corresponds to the pubsub#digest_frequency field.

See also setDigestFrequencyMs().

std::optional<bool> QXmppPubSubSubscribeOptions::digestsEnabled() const

Returns whether event notifications are delivered as digests.

With digests enabled, the service collects notifications and sends them in a single message, see digestFrequencyMs().

This corresponds to the pubsub#digest field.

See also setDigestsEnabled().

QDateTime QXmppPubSubSubscribeOptions::expire() const

Returns the date and time at which the subscription expires.

An invalid QDateTime means that no expiry is set.

This corresponds to the pubsub#expire field.

See also setExpire().

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

Parses subscribe options from form.

Returns std::nullopt if the form type of form is not http://jabber.org/protocol/pubsub#subscribe_options.

QXmppPubSubSubscribeOptions::PresenceStates QXmppPubSubSubscribeOptions::notificationRules() const

Returns the presence states for which event notifications are delivered.

If no state is set, the field is not included.

This corresponds to the pubsub#show-values field.

See also setNotificationRules().

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

Returns whether event notifications are delivered to the subscriber.

This corresponds to the pubsub#deliver field.

See also setNotificationsEnabled().

void QXmppPubSubSubscribeOptions::setBodyIncluded(std::optional<bool> bodyIncluded)

Sets whether event notifications include a message body (bodyIncluded).

See also bodyIncluded().

void QXmppPubSubSubscribeOptions::setDigestFrequencyMs(std::optional<quint32> digestFrequencyMs)

Sets the minimum number of milliseconds between two digests to digestFrequencyMs.

See also digestFrequencyMs().

void QXmppPubSubSubscribeOptions::setDigestsEnabled(std::optional<bool> digestsEnabled)

Sets whether event notifications are delivered as digests (digestsEnabled).

See also digestsEnabled().

void QXmppPubSubSubscribeOptions::setExpire(const QDateTime &expire)

Sets the date and time at which the subscription expires to expire.

See also expire().

void QXmppPubSubSubscribeOptions::setNotificationRules(QXmppPubSubSubscribeOptions::PresenceStates notificationRules)

Sets the presence states for which event notifications are delivered to notificationRules.

See also notificationRules().

void QXmppPubSubSubscribeOptions::setNotificationsEnabled(std::optional<bool> enabled)

Sets whether event notifications are delivered to the subscriber (enabled).

See also notificationsEnabled().

void QXmppPubSubSubscribeOptions::setSubscriptionDepth(std::optional<QXmppPubSubSubscribeOptions::SubscriptionDepth> subscriptionDepth)

Sets the depth of the subscription to subscriptionDepth.

See also subscriptionDepth().

void QXmppPubSubSubscribeOptions::setSubscriptionType(std::optional<QXmppPubSubSubscribeOptions::SubscriptionType> subscriptionType)

Sets the type of the subscription to subscriptionType.

See also subscriptionType().

std::optional<QXmppPubSubSubscribeOptions::SubscriptionDepth> QXmppPubSubSubscribeOptions::subscriptionDepth() const

Returns the depth of the subscription.

Defines whether the subscription only applies to the direct children or to all descendants of a collection node.

This corresponds to the pubsub#subscription_depth field.

See also setSubscriptionDepth().

std::optional<QXmppPubSubSubscribeOptions::SubscriptionType> QXmppPubSubSubscribeOptions::subscriptionType() const

Returns the type of the subscription.

Defines whether notifications about items or about child nodes are delivered. Only applicable to collection nodes.

This corresponds to the pubsub#subscription_type field.

See also setSubscriptionType().

QXmppPubSubSubscribeOptions &QXmppPubSubSubscribeOptions::operator=(QXmppPubSubSubscribeOptions &&)

Default move-assignment operator

QXmppPubSubSubscribeOptions &QXmppPubSubSubscribeOptions::operator=(const QXmppPubSubSubscribeOptions &)

Default assignment operator