9#include "QXmppConfiguration.h"
10#include "QXmppLogger.h"
11#include "QXmppPresence.h"
12#include "QXmppSendResult.h"
13#include "QXmppSendStanzaParams.h"
18#include <QAbstractSocket>
27class QXmppClientPrivate;
32class QXmppInternalClientExtension;
89 Q_PROPERTY(
QXmppLogger *logger READ logger WRITE setLogger NOTIFY loggerChanged)
91 Q_PROPERTY(
State state READ state NOTIFY stateChanged)
94 using IqResult = std::variant<QDomElement, QXmppError>;
134 QXmppClient(InitialExtensions, QObject *parent =
nullptr);
139 template<
typename T,
typename... Args>
143 auto *ext =
new T(args...);
152 QList<QXmppClientExtension *> extensions();
170 const QList<QXmppClientExtension *> list = extensions();
171 for (
auto ext : list) {
172 T *extension = qobject_cast<T *>(ext);
198 auto list = extensions();
199 for (
int i = 0; i < list.size(); ++i) {
200 if (qobject_cast<T *>(list.at(i)) !=
nullptr) {
207 bool isAuthenticated()
const;
208 bool isConnected()
const;
210 bool isActive()
const;
211 void setActive(
bool active);
213 StreamManagementState streamManagementState()
const;
225 QAbstractSocket::SocketError socketError();
226 QString socketErrorString()
const;
240#if QXMPP_DEPRECATED_SINCE(1, 1)
241 QT_DEPRECATED_X(
"Use QXmppClient::findExtension<QXmppRosterManager>() instead")
331 void connectToServer(
const QString &jid,
332 const QString &password);
333 void disconnectFromServer();
335 void sendMessage(
const QString &bareJid,
const QString &message);
338 void injectIq(
const QDomElement &element,
const std::optional<QXmppE2eeMetadata> &e2eeMetadata);
342 void _q_elementReceived(
const QDomElement &element,
bool &handled);
344 void _q_socketStateChanged(QAbstractSocket::SocketState state);
345 void _q_streamConnected();
346 void _q_streamDisconnected();
349 const std::unique_ptr<QXmppClientPrivate> d;
352 friend class QXmppInternalClientExtension;
353 friend class TestClient;
The QXmppClientExtension class is the base class for QXmppClient extensions.
Definition: QXmppClientExtension.h:33
The QXmppClient class is the main class for using QXmpp.
Definition: QXmppClient.h:85
void presenceReceived(const QXmppPresence &presence)
void error(QXmppClient::Error)
std::variant< QDomElement, QXmppError > IqResult
Definition: QXmppClient.h:94
InitialExtensions
Definition: QXmppClient.h:127
@ BasicExtensions
Creates a client with the default set of extensions.
Definition: QXmppClient.h:131
@ NoExtensions
Creates a client without any extensions.
Definition: QXmppClient.h:129
State
This enumeration describes a client state.
Definition: QXmppClient.h:108
@ DisconnectedState
Disconnected from the server.
Definition: QXmppClient.h:109
@ ConnectingState
Trying to connect to the server.
Definition: QXmppClient.h:110
Q_SIGNAL void errorOccurred(const QXmppError &error)
void loggerChanged(QXmppLogger *logger)
This signal is emitted when the logger changes.
Error
Definition: QXmppClient.h:99
@ NoError
No error.
Definition: QXmppClient.h:100
@ XmppStreamError
Error due to XML stream.
Definition: QXmppClient.h:103
@ KeepAliveError
Error due to no response to a keep alive.
Definition: QXmppClient.h:102
@ SocketError
Error due to TCP socket.
Definition: QXmppClient.h:101
void sslErrors(const QList< QSslError > &errors)
void stateChanged(QXmppClient::State state)
This signal is emitted when the client state changes.
void messageReceived(const QXmppMessage &message)
StreamManagementState
Describes the use of XEP-0198: Stream Management.
Definition: QXmppClient.h:116
@ NoStreamManagement
Stream Management is not used.
Definition: QXmppClient.h:118
@ NewStream
Stream Management is used and the previous stream has not been resumed.
Definition: QXmppClient.h:120
void iqReceived(const QXmppIq &iq)
T * addNewExtension(Args... args)
Definition: QXmppClient.h:140
T * findExtension()
Returns the extension which can be cast into type T*, or 0 if there is no such extension.
Definition: QXmppClient.h:168
void disconnected()
This signal is emitted when the XMPP connection disconnects.
std::variant< QXmpp::Success, QXmppError > EmptyResult
Definition: QXmppClient.h:95
int indexOfExtension()
Returns the index of an extension.
Definition: QXmppClient.h:196
The QXmppConfiguration class holds configuration options.
Definition: QXmppConfiguration.h:32
Definition: QXmppDiscoveryIq.h:18
Definition: QXmppE2eeExtension.h:23
The QXmppIq class is the base class for all IQs.
Definition: QXmppIq.h:23
The QXmppLoggable class represents a source of logging messages.
Definition: QXmppLogger.h:107
The QXmppLogger class represents a sink for logging messages.
Definition: QXmppLogger.h:29
The QXmppMessage class represents an XMPP message.
Definition: QXmppMessage.h:39
Definition: QXmppNonza.h:14
The QXmppPresence class represents an XMPP presence stanza.
Definition: QXmppPresence.h:21
The QXmppRosterManager class provides access to a connected client's roster.
Definition: QXmppRosterManager.h:56
Condition
A detailed condition of the error.
Definition: QXmppStanza.h:110
The QXmppStanza class is the base class for all XMPP stanzas.
Definition: QXmppStanza.h:88
The QXmppStream class is the base class for all XMPP streams.
Definition: QXmppStream.h:27
Definition: QXmppTask.h:62
The QXmppVCardManager class gets/sets XMPP vCards. It is an implementation of XEP-0054: vcard-temp.
Definition: QXmppVCardManager.h:38
The QXmppVersionManager class makes it possible to request for the software version of an entity as d...
Definition: QXmppVersionManager.h:24
Definition: QXmppError.h:17