QXmppDiscoveryManager Class

The QXmppDiscoveryManager class makes it possible to discover information about XMPP entities as defined by XEP-0030: Service Discovery. More...

Header: #include <QXmppDiscoveryManager.h>
Inherits: QXmppClientExtension

Public Types

enum class CachePolicy { Strict, Relaxed }
(since QXmpp 1.5) InfoResult
(since QXmpp 1.5) ItemsResult

Public Functions

(since QXmpp 1.12) QXmppDiscoInfo buildClientInfo() const
QString clientCapabilitiesNode() const
(since QXmpp 1.16) QXmppDiscoServicesWatch discoverServices(QString category, std::optional<QString> type = {}, QStringList requiredFeatures = {})
(since QXmpp 1.16) QXmppDiscoServicesWatch discoverServices(QXmpp::Disco::Category category, std::optional<QXmpp::Disco::Type> type = {}, QStringList requiredFeatures = {})
(since QXmpp 1.12) const QList<QXmppDiscoIdentity> &identities() const
(since QXmpp 1.12) QXmppTask<QXmpp::Result<QXmppDiscoInfo>> info(const QString &jid, const QString &node = {}, QXmppDiscoveryManager::CachePolicy cachePolicy = CachePolicy::Relaxed)
(since QXmpp 1.12) const QList<QXmppDataForm> &infoForms() const
(since QXmpp 1.12) QXmppTask<QXmpp::Result<QList<QXmppDiscoItem>>> items(const QString &jid, const QString &node = {}, QXmppDiscoveryManager::CachePolicy cachePolicy = CachePolicy::Relaxed)
void setClientCapabilitiesNode(const QString &node)
(since QXmpp 1.12) void setIdentities(const QList<QXmppDiscoIdentity> &identities)
(since QXmpp 1.12) void setInfoForms(const QList<QXmppDataForm> &dataForms)

Detailed Description

Since QXmpp 1.12 info and items queries are cached per session by default.

Member Type Documentation

enum class QXmppDiscoveryManager::CachePolicy

Policies for how cached service discovery information is used.

ConstantValueDescription
QXmppDiscoveryManager::CachePolicy::Strict0Always ensure the data is up-to-date. Cached data may be used only if it is guaranteed to be current (e.g. via entity capabilities).
QXmppDiscoveryManager::CachePolicy::Relaxed1Cached data may be used even if it is not guaranteed to be current, within the configured limits.

[alias, since QXmpp 1.5] QXmppDiscoveryManager::InfoResult

Contains the discovery information result in the form of an QXmppDiscoveryIq or (in case the request did not succeed) a QXmppStanza::Error.

This typedef was introduced in QXmpp 1.5.

[alias, since QXmpp 1.5] QXmppDiscoveryManager::ItemsResult

Contains a list of service discovery items or (in case the request did not succeed) a QXmppStanza::Error.

This typedef was introduced in QXmpp 1.5.

Member Function Documentation

[since QXmpp 1.12] QXmppDiscoInfo QXmppDiscoveryManager::buildClientInfo() const

Builds a full disco info element for this client.

Contains features and identities from all extensions and identities and data forms configured in this manager.

This function was introduced in QXmpp 1.12.

QString QXmppDiscoveryManager::clientCapabilitiesNode() const

Returns the capabilities node of the local XMPP client.

By default this is "org.qxmpp.caps".

See also setClientCapabilitiesNode().

[since QXmpp 1.16] QXmppDiscoServicesWatch QXmppDiscoveryManager::discoverServices(QString category, std::optional<QString> type = {}, QStringList requiredFeatures = {})

Watches for server services matching the given identity category and optional type strings.

This overload accepts raw strings for non-standard or unregistered categories and types.

requiredFeatures, category, and type.

This function was introduced in QXmpp 1.16.

[since QXmpp 1.16] QXmppDiscoServicesWatch QXmppDiscoveryManager::discoverServices(QXmpp::Disco::Category category, std::optional<QXmpp::Disco::Type> type = {}, QStringList requiredFeatures = {})

Watches for server services matching the given identity category and optional type.

Returns a lightweight handle that provides reactive access to discovered services via QBindable properties. The watch is automatically started and will be populated as discovery results arrive.

category is the identity category to filter by. type is the optional identity type to filter by. If not set, matches any type. requiredFeatures specifies features that discovered services must support.

Returns a watch handle. Keep it alive as long as you need updates.

This function was introduced in QXmpp 1.16.

[since QXmpp 1.12] const QList<QXmppDiscoIdentity> &QXmppDiscoveryManager::identities() const

Returns the base identities of this client.

The identities are added to the service discovery information other entities can request.

Note: Additionally also all identities reported via QXmppClientExtension::discoveryIdentities() are added.

Note: The default identity is type=client, category=pc/phone (OS dependent) and name="{application name} {application version}".

This function was introduced in QXmpp 1.12.

See also setIdentities().

[since QXmpp 1.12] QXmppTask<QXmpp::Result<QXmppDiscoInfo>> QXmppDiscoveryManager::info(const QString &jid, const QString &node = {}, QXmppDiscoveryManager::CachePolicy cachePolicy = CachePolicy::Relaxed)

Fetches discovery info from the specified XMPP entity.

cachePolicy, node, and jid.

This function was introduced in QXmpp 1.12.

[since QXmpp 1.12] const QList<QXmppDataForm> &QXmppDiscoveryManager::infoForms() const

Returns the data forms for this client as defined in XEP-0128: Service Discovery Extensions.

The data forms are added to the service discovery information other entities can request.

This function was introduced in QXmpp 1.12.

See also setInfoForms().

[since QXmpp 1.12] QXmppTask<QXmpp::Result<QList<QXmppDiscoItem>>> QXmppDiscoveryManager::items(const QString &jid, const QString &node = {}, QXmppDiscoveryManager::CachePolicy cachePolicy = CachePolicy::Relaxed)

Fetches discovery items from the specified XMPP entity.

cachePolicy, node, and jid.

This function was introduced in QXmpp 1.12.

void QXmppDiscoveryManager::setClientCapabilitiesNode(const QString &node)

Sets the capabilities node of the local XMPP client.

By default this is "org.qxmpp.caps".

node.

See also clientCapabilitiesNode().

[since QXmpp 1.12] void QXmppDiscoveryManager::setIdentities(const QList<QXmppDiscoIdentity> &identities)

Sets the base identities of this client.

The identities are added to the service discovery information other entities can request.

Note: Additionally also all identities reported via QXmppClientExtension::discoveryIdentities() are added.

Note: The default identity is type=client, category=pc/phone (OS dependent) and name="{application name} {application version}".

identities.

This function was introduced in QXmpp 1.12.

See also identities().

[since QXmpp 1.12] void QXmppDiscoveryManager::setInfoForms(const QList<QXmppDataForm> &dataForms)

Sets the data forms for this client as defined in XEP-0128: Service Discovery Extensions.

The data forms are added to the service discovery information other entities can request.

dataForms.

This function was introduced in QXmpp 1.12.

See also infoForms().