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)
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")
297 Q_SIGNAL
void sslErrors(
const QList<QSslError> &errors);
313 void connectToServer(
const QString &jid,
314 const QString &password);
315 void disconnectFromServer();
317 void sendMessage(
const QString &bareJid,
const QString &message);
320 QXmppOutgoingClient *stream()
const;
321 void injectIq(
const QDomElement &element,
const std::optional<QXmppE2eeMetadata> &e2eeMetadata);
324 void setIgnoredStreamErrors(
const QVector<QXmpp::StreamError> &);
326 void _q_elementReceived(
const QDomElement &element,
bool &handled);
328 void onInternalSocketStateChanged();
329 void _q_streamConnected(
const QXmpp::Private::SessionBegin &);
330 void _q_streamDisconnected();
333 const std::unique_ptr<QXmppClientPrivate> d;
338 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
Q_SIGNAL void connected()
Q_SIGNAL void credentialsChanged()
Q_SIGNAL void loggerChanged(QXmppLogger *logger)
This signal is emitted when the logger changes.
int indexOfExtension() const
Returns the index of an extension.
Definition QXmppClient.h:173
Q_SIGNAL void messageReceived(const QXmppMessage &message)
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
Q_SIGNAL void error(QXmppClient::Error)
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
Q_SIGNAL void disconnected()
This signal is emitted when the XMPP connection disconnects.
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)
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
Q_SIGNAL void stateChanged(QXmppClient::State state)
This signal is emitted when the client state changes.
Q_SIGNAL void presenceReceived(const QXmppPresence &presence)
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
T * addNewExtension(Args... args)
Definition QXmppClient.h:117
Q_SIGNAL void sslErrors(const QList< QSslError > &errors)
std::variant< QXmpp::Success, QXmppError > EmptyResult
Definition QXmppClient.h:72
Q_SIGNAL void iqReceived(const QXmppIq &iq)
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:84
Condition
A detailed condition of the error.
Definition QXmppStanza.h:112
The QXmppStanza class is the base class for all XMPP stanzas.
Definition QXmppStanza.h:90
Definition QXmppTask.h:46
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 Algorithms.h:14
Definition QXmppError.h:17