Loading...
Searching...
No Matches
QXmppDiscoveryManager.h
// SPDX-FileCopyrightText: 2010 Manjeet Dahiya <manjeetdahiya@gmail.com>
// SPDX-FileCopyrightText: 2021 Linus Jahn <lnj@kaidan.im>
//
// SPDX-License-Identifier: LGPL-2.1-or-later
#ifndef QXMPPDISCOVERYMANAGER_H
#define QXMPPDISCOVERYMANAGER_H
#include "QXmppClientExtension.h"
#include <variant>
#include <QDateTime>
template<typename T>
class QXmppTask;
class QXmppDataForm;
class QXmppDiscoveryIq;
class QXmppDiscoveryManagerPrivate;
struct QXmppError;
class QXMPP_EXPORT QXmppDiscoveryManager : public QXmppClientExtension
{
Q_OBJECT
public:
enum class CachePolicy {
Strict,
Relaxed,
};
QXmppDiscoveryManager();
~QXmppDiscoveryManager() override;
QXmppTask<QXmpp::Result<QXmppDiscoInfo>> info(const QString &jid, const QString &node = {}, CachePolicy fetchPolicy = CachePolicy::Relaxed);
QXmppTask<QXmpp::Result<QList<QXmppDiscoItem>>> items(const QString &jid, const QString &node = {}, CachePolicy fetchPolicy = CachePolicy::Relaxed);
const QList<QXmppDiscoIdentity> &identities() const;
void setIdentities(const QList<QXmppDiscoIdentity> &identities);
const QList<QXmppDataForm> &infoForms() const;
void setInfoForms(const QList<QXmppDataForm> &dataForms);
QString clientCapabilitiesNode() const;
void setClientCapabilitiesNode(const QString &);
QXmppDiscoInfo buildClientInfo() const;
QStringList discoveryFeatures() const override;
bool handleStanza(const QDomElement &element) override;
#if QXMPP_DEPRECATED_SINCE(1, 13)
[[deprecated("Use info()")]]
Q_SIGNAL void infoReceived(const QXmppDiscoveryIq &);
[[deprecated("Use items()")]]
Q_SIGNAL void itemsReceived(const QXmppDiscoveryIq &);
#endif
#if QXMPP_DEPRECATED_SINCE(1, 12)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
using InfoResult = std::variant<QXmppDiscoveryIq, QXmppError>;
using ItemsResult = std::variant<QList<QXmppDiscoveryIq::Item>, QXmppError>;
[[deprecated("Use info()")]]
QXmppTask<InfoResult> requestDiscoInfo(const QString &jid, const QString &node = {});
[[deprecated("Use items()")]]
QXmppTask<ItemsResult> requestDiscoItems(const QString &jid, const QString &node = {});
QT_WARNING_POP
[[deprecated("Use buildClientInfo()")]]
QXmppDiscoveryIq capabilities();
[[deprecated("Use identities()")]]
QString clientCategory() const;
[[deprecated("Use setIdentities()")]]
void setClientCategory(const QString &);
[[deprecated("Use identities()")]]
void setClientName(const QString &);
[[deprecated("Use setIdentities()")]]
QString clientApplicationName() const;
[[deprecated("Use identities()")]]
QString clientType() const;
[[deprecated("Use setIdentities()")]]
void setClientType(const QString &);
[[deprecated("Use infoForms()")]]
QXmppDataForm clientInfoForm() const;
[[deprecated("Use setInfoForms()()")]]
void setClientInfoForm(const QXmppDataForm &form);
[[deprecated("Use info()")]]
QString requestInfo(const QString &jid, const QString &node = QString());
[[deprecated("Use items()")]]
QString requestItems(const QString &jid, const QString &node = QString());
#endif
protected:
void onRegistered(QXmppClient *client);
void onUnregistered(QXmppClient *client);
private:
friend class QXmppDiscoveryManagerPrivate;
const std::unique_ptr<QXmppDiscoveryManagerPrivate> d;
};
#endif // QXMPPDISCOVERYMANAGER_H
QXmppClientExtension::discoveryFeatures
virtual QStringList discoveryFeatures() const
Definition QXmppClientExtension.cpp:22
QXmppClientExtension::onUnregistered
virtual void onUnregistered(QXmppClient *client)
Definition QXmppClientExtension.cpp:95
QXmppClientExtension::onRegistered
virtual void onRegistered(QXmppClient *client)
Definition QXmppClientExtension.cpp:85
QXmppClientExtension::QXmppClientExtension
QXmppClientExtension()
Definition QXmppClientExtension.cpp:12
QXmppClientExtension::handleStanza
virtual bool handleStanza(const QDomElement &stanza)
You need to implement this method to process incoming XMPP stanzas.
Definition client/compat/removed_api.cpp:44
QXmppDataForm
Definition QXmppDataForm.h:28
QXmppDiscoveryIq
Definition QXmppDiscoveryIq.h:200
QXmppDiscoveryManager
The QXmppDiscoveryManager class makes it possible to discover information about other entities as def...
Definition QXmppDiscoveryManager.h:23
QXmppDiscoveryManager::ItemsResult
std::variant< QList< QXmppDiscoveryIq::Item >, QXmppError > ItemsResult
Definition QXmppDiscoveryManager.h:75
QXmppDiscoveryManager::CachePolicy
CachePolicy
Policies for how cached service discovery information is used.
Definition QXmppDiscoveryManager.h:28
QXmppDiscoveryManager::requestDiscoInfo
QXmppTask< InfoResult > requestDiscoInfo(const QString &jid, const QString &node={})
Definition client/compat/removed_api.cpp:216
QXmppDiscoveryManager::InfoResult
std::variant< QXmppDiscoveryIq, QXmppError > InfoResult
Definition QXmppDiscoveryManager.h:74
QXmppDiscoveryManager::itemsReceived
Q_SIGNAL void itemsReceived(const QXmppDiscoveryIq &)
QXmppDiscoveryManager::infoReceived
Q_SIGNAL void infoReceived(const QXmppDiscoveryIq &)
QXmppLoggable::info
void info(const QString &message)
Logs an informational message.
Definition QXmppLogger.h:127
QXmppTask
Definition QXmppTask.h:46
QXmppError
Definition QXmppError.h:17