QXmpp: QXmppDiscoveryManager.h Source File

QXmpp Version: 1.14.4

Loading...
Searching...
No Matches
QXmppDiscoveryManager.h
1// SPDX-FileCopyrightText: 2010 Manjeet Dahiya <manjeetdahiya@gmail.com>
2// SPDX-FileCopyrightText: 2021 Linus Jahn <lnj@kaidan.im>
3//
4// SPDX-License-Identifier: LGPL-2.1-or-later
5
6#ifndef QXMPPDISCOVERYMANAGER_H
7#define QXMPPDISCOVERYMANAGER_H
8
9#include "QXmppClientExtension.h"
10
11#include <variant>
12
13#include <QDateTime>
14
15template<typename T>
16class QXmppTask;
17class QXmppDataForm;
18class QXmppDiscoveryIq;
19class QXmppDiscoveryManagerPrivate;
20struct QXmppError;
21
22 class QXMPP_EXPORT QXmppDiscoveryManager : public QXmppClientExtension
23{
24 Q_OBJECT
25
26public:
28 enum class CachePolicy {
31 Strict,
34 Relaxed,
35 };
36
37 QXmppDiscoveryManager();
38 ~QXmppDiscoveryManager() override;
39
40 QXmppTask<QXmpp::Result<QXmppDiscoInfo>> info(const QString &jid, const QString &node = {}, CachePolicy fetchPolicy = CachePolicy::Relaxed);
41 QXmppTask<QXmpp::Result<QList<QXmppDiscoItem>>> items(const QString &jid, const QString &node = {}, CachePolicy fetchPolicy = CachePolicy::Relaxed);
42
43 const QList<QXmppDiscoIdentity> &identities() const;
44 void setIdentities(const QList<QXmppDiscoIdentity> &identities);
45
46 const QList<QXmppDataForm> &infoForms() const;
47 void setInfoForms(const QList<QXmppDataForm> &dataForms);
48
49 QString clientCapabilitiesNode() const;
50 void setClientCapabilitiesNode(const QString &);
51
52 QXmppDiscoInfo buildClientInfo() const;
53
55 QStringList discoveryFeatures() const override;
56 bool handleStanza(const QDomElement &element) override;
58
59#if QXMPP_DEPRECATED_SINCE(1, 13)
62 [[deprecated("Use info()")]]
63 Q_SIGNAL void infoReceived(const QXmppDiscoveryIq &);
64
67 [[deprecated("Use items()")]]
68 Q_SIGNAL void itemsReceived(const QXmppDiscoveryIq &);
69#endif
70
71#if QXMPP_DEPRECATED_SINCE(1, 12)
72 QT_WARNING_PUSH
73 QT_WARNING_DISABLE_DEPRECATED
74 using InfoResult = std::variant<QXmppDiscoveryIq, QXmppError>;
75 using ItemsResult = std::variant<QList<QXmppDiscoveryIq::Item>, QXmppError>;
76 [[deprecated("Use info()")]]
77 QXmppTask<InfoResult> requestDiscoInfo(const QString &jid, const QString &node = {});
78 [[deprecated("Use items()")]]
79 QXmppTask<ItemsResult> requestDiscoItems(const QString &jid, const QString &node = {});
80 QT_WARNING_POP
81
82 [[deprecated("Use buildClientInfo()")]]
83 QXmppDiscoveryIq capabilities();
84
85 [[deprecated("Use identities()")]]
86 QString clientCategory() const;
87 [[deprecated("Use setIdentities()")]]
88 void setClientCategory(const QString &);
89
90 [[deprecated("Use identities()")]]
91 void setClientName(const QString &);
92 [[deprecated("Use setIdentities()")]]
93 QString clientApplicationName() const;
94
95 [[deprecated("Use identities()")]]
96 QString clientType() const;
97 [[deprecated("Use setIdentities()")]]
98 void setClientType(const QString &);
99
100 [[deprecated("Use infoForms()")]]
101 QXmppDataForm clientInfoForm() const;
102 [[deprecated("Use setInfoForms()()")]]
103 void setClientInfoForm(const QXmppDataForm &form);
104
105 [[deprecated("Use info()")]]
106 QString requestInfo(const QString &jid, const QString &node = QString());
107 [[deprecated("Use items()")]]
108 QString requestItems(const QString &jid, const QString &node = QString());
109#endif
110
111protected:
112 void onRegistered(QXmppClient *client);
113 void onUnregistered(QXmppClient *client);
114
115private:
116 friend class QXmppDiscoveryManagerPrivate;
117 const std::unique_ptr<QXmppDiscoveryManagerPrivate> d;
118};
119
120#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