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 |
- List of all members, including inherited members
- Deprecated members
- QXmppDiscoveryManager is part of Managers.
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.17) std::shared_ptr<QXmppEntityCapsStorage> | entityCapsStorage() const |
(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.17) void | setEntityCapsStorage(std::shared_ptr<QXmppEntityCapsStorage> storage) |
(since QXmpp 1.12) void | setIdentities(const QList<QXmppDiscoIdentity> &identities) |
(since QXmpp 1.12) void | setInfoForms(const QList<QXmppDataForm> &dataForms) |
(since QXmpp 1.17) QXmppDiscoInfoWatch | watchAccountInfo() |
(since QXmpp 1.17) QXmppDiscoInfoWatch | watchInfo(const QString &jid, const QString &node = {}) |
(since QXmpp 1.17) QXmppDiscoInfoWatch | watchServerInfo() |
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.
| Constant | Value | Description |
|---|---|---|
QXmppDiscoveryManager::CachePolicy::Strict | 0 | Always 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::Relaxed | 1 | Cached 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.17] std::shared_ptr<QXmppEntityCapsStorage> QXmppDiscoveryManager::entityCapsStorage() const
Returns the storage for verified information of entity capabilities, if one has been set.
This function was introduced in QXmpp 1.17.
See also setEntityCapsStorage().
[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.
For available entities that announce XEP-0115: Entity Capabilities in their presence, the info is requested using the caps and cached for all entities with the same caps. Such cached info is always up to date and is also used with CachePolicy::Strict.
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.17] void QXmppDiscoveryManager::setEntityCapsStorage(std::shared_ptr<QXmppEntityCapsStorage> storage)
Sets the storage for verified information of entity capabilities.
The stored information is used for all entities that announce the same capabilities, so no request is needed for them. Since it does not depend on the account, the storage can be shared between multiple clients.
This function was introduced in QXmpp 1.17.
See also entityCapsStorage().
[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().
[since QXmpp 1.17] QXmppDiscoInfoWatch QXmppDiscoveryManager::watchAccountInfo()
Watches the service discovery information of the own bare JID.
The account's information contains the features the server provides for the account, e.g. XEP-0163: Personal Eventing Protocol or XEP-0313: Message Archive Management.
This watch follows the configured JID, so it stays valid after the account has been changed.
This function was introduced in QXmpp 1.17.
[since QXmpp 1.17] QXmppDiscoInfoWatch QXmppDiscoveryManager::watchInfo(const QString &jid, const QString &node = {})
Watches the service discovery information of jid and node.
Returns a lightweight handle that provides reactive access to the information via QBindable properties. All watches on the same entity share their state and the information is only requested once.
The information is requested when the first watch is created and again on every new stream. Until the new response arrives, the previous information stays available with the state QXmppDiscoInfoWatch::State::Stale. If no other watch on the entity exists, but the information has been requested before, e.g. using info(), it is used with the state Stale while it is requested again, unless changes of the entity are tracked (see QXmppDiscoInfoWatch::changesTracked()).
On new streams, the information of full JIDs is only requested after their presence has been received, because with XEP-0115: Entity Capabilities the information is often known without a request then. Full JIDs without presence, e.g. of MUC occupants in rooms that have not been joined again yet, are requested after a few seconds.
Keep the handle alive as long as you need updates.
This function was introduced in QXmpp 1.17.
[since QXmpp 1.17] QXmppDiscoInfoWatch QXmppDiscoveryManager::watchServerInfo()
Watches the service discovery information of the own server.
Unlike watchInfo() with the server's domain, this watch follows the configured domain, so it stays valid after the account has been changed.
This function was introduced in QXmpp 1.17.