10#include "QXmppConfiguration.h"
11#include "QXmppLogger.h"
12#include "QXmppPresence.h"
13#include "QXmppSendResult.h"
14#include "QXmppSendStanzaParams.h"
15#include "QXmppStreamError.h"
20#include <QAbstractSocket>
29class QXmppClientPrivate;
31class QXmppOutgoingClient;
41namespace QXmpp::Private {
66 Q_PROPERTY(
QXmppLogger *logger READ logger WRITE setLogger NOTIFY loggerChanged)
68 Q_PROPERTY(
State state READ state NOTIFY stateChanged)
71 using IqResult = std::variant<QDomElement, QXmppError>;
111 QXmppClient(InitialExtensions, QObject *parent =
nullptr);
116 template<
typename T,
typename... Args>
120 auto *ext =
new T(args...);
129 QList<QXmppClientExtension *> extensions()
const;
147 const QList<QXmppClientExtension *> list = extensions();
148 for (
auto ext : list) {
149 T *extension = qobject_cast<T *>(ext);
175 auto list = extensions();
176 for (
int i = 0; i < list.size(); ++i) {
177 if (qobject_cast<T *>(list.at(i)) !=
nullptr) {
184 bool isAuthenticated()
const;
185 bool isConnected()
const;
187 bool isActive()
const;
188 void setActive(
bool active);
190 StreamManagementState streamManagementState()
const;
202 QAbstractSocket::SocketError socketError();
203 QString socketErrorString()
const;
217#if QXMPP_DEPRECATED_SINCE(1, 1)
218 QT_DEPRECATED_X(
"Use QXmppClient::findExtension<QXmppRosterManager>() instead")
315 void connectToServer(
const QString &jid,
316 const QString &password);
317 void disconnectFromServer();
319 void sendMessage(
const QString &bareJid,
const QString &message);
322 QXmppOutgoingClient *stream()
const;
323 void injectIq(
const QDomElement &element,
const std::optional<QXmppE2eeMetadata> &e2eeMetadata);
326 void setIgnoredStreamErrors(
const QVector<QXmpp::StreamError> &);
329 void _q_elementReceived(
const QDomElement &element,
bool &handled);
331 void _q_socketStateChanged(QAbstractSocket::SocketState state);
332 void _q_streamConnected(
const QXmpp::Private::SessionBegin &);
333 void _q_streamDisconnected();
336 const std::unique_ptr<QXmppClientPrivate> d;
341 friend class TestClient;
The QXmppCarbonManagerV2 class handles message carbons as described in XEP-0280: Message Carbons.
Definition: QXmppCarbonManagerV2.h:11
The QXmppClientExtension class is the base class for QXmppClient extensions.
Definition: QXmppClientExtension.h:32
Main class for starting and managing connections to XMPP servers.
Definition: QXmppClient.h:62
void presenceReceived(const QXmppPresence &presence)
Q_SIGNAL void credentialsChanged()
void error(QXmppClient::Error)
int indexOfExtension() const
Returns the index of an extension.
Definition: QXmppClient.h:173
T * findExtension() const
Returns the extension which can be cast into type T*, or 0 if there is no such extension.
Definition: QXmppClient.h:145
std::variant< QDomElement, QXmppError > IqResult
Definition: QXmppClient.h:71
InitialExtensions
Definition: QXmppClient.h:104
@ BasicExtensions
Creates a client with the default set of extensions.
Definition: QXmppClient.h:108
@ NoExtensions
Creates a client without any extensions.
Definition: QXmppClient.h:106
State
This enumeration describes a client state.
Definition: QXmppClient.h:85
@ DisconnectedState
Disconnected from the server.
Definition: QXmppClient.h:86
@ ConnectingState
Trying to connect to the server.
Definition: QXmppClient.h:87
Q_SIGNAL void errorOccurred(const QXmppError &error)
void loggerChanged(QXmppLogger *logger)
This signal is emitted when the logger changes.
Error
Definition: QXmppClient.h:76
@ NoError
No error.
Definition: QXmppClient.h:77
@ XmppStreamError
Error due to XML stream.
Definition: QXmppClient.h:80
@ KeepAliveError
Error due to no response to a keep alive.
Definition: QXmppClient.h:79
@ SocketError
Error due to TCP socket.
Definition: QXmppClient.h:78
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:93
@ NoStreamManagement
Stream Management is not used.
Definition: QXmppClient.h:95
@ NewStream
Stream Management is used and the previous stream has not been resumed.
Definition: QXmppClient.h:97
void iqReceived(const QXmppIq &iq)
T * addNewExtension(Args... args)
Definition: QXmppClient.h:117
void disconnected()
This signal is emitted when the XMPP connection disconnects.
std::variant< QXmpp::Success, QXmppError > EmptyResult
Definition: QXmppClient.h:72
The QXmppConfiguration class holds configuration options.
Definition: QXmppConfiguration.h:37
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:110
The QXmppLogger class represents a sink for logging messages.
Definition: QXmppLogger.h:29
The QXmppMessage class represents an XMPP message.
Definition: QXmppMessage.h:64
Definition: QXmppNonza.h:14
The QXmppPresence class represents an XMPP presence stanza.
Definition: QXmppPresence.h:22
The QXmppRegistrationManager class manages in-band registration and account management tasks like cha...
Definition: QXmppRegistrationManager.h:225
The QXmppRosterManager class provides access to a connected client's roster.
Definition: QXmppRosterManager.h:57
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
Definition: QXmppTask.h:62
The QXmppVCardManager class gets/sets XMPP vCards. It is an implementation of XEP-0054: vcard-temp.
Definition: QXmppVCardManager.h:43
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