QXmpp Version: 1.5.6
Loading...
Searching...
No Matches
QXmppOutgoingClient.h
1// SPDX-FileCopyrightText: 2010 Manjeet Dahiya <manjeetdahiya@gmail.com>
2// SPDX-FileCopyrightText: 2010 Jeremy Lainé <jeremy.laine@m4x.org>
3//
4// SPDX-License-Identifier: LGPL-2.1-or-later
5
6#ifndef QXMPPOUTGOINGCLIENT_H
7#define QXMPPOUTGOINGCLIENT_H
8
9#include "QXmppClient.h"
10#include "QXmppStanza.h"
11#include "QXmppStream.h"
12
13class QDomElement;
14class QSslError;
15
17class QXmppPresence;
18class QXmppIq;
19class QXmppMessage;
20
21class QXmppOutgoingClientPrivate;
22
26
27class QXMPP_EXPORT QXmppOutgoingClient : public QXmppStream
28{
29 Q_OBJECT
30
31public:
32 QXmppOutgoingClient(QObject *parent);
33 ~QXmppOutgoingClient() override;
34
35 void connectToHost();
36 bool isAuthenticated() const;
37 bool isConnected() const override;
38 bool isClientStateIndicationEnabled() const;
39 bool isStreamManagementEnabled() const;
40 bool isStreamResumed() const;
42
44 QSslSocket *socket() const { return QXmppStream::socket(); };
45 QXmppStanza::Error::Condition xmppStreamError();
46
47 QXmppConfiguration &configuration();
48
49Q_SIGNALS:
52
54 void elementReceived(const QDomElement &element, bool &handled);
55
58
61
64 void iqReceived(const QXmppIq &);
65
67 void sslErrors(const QList<QSslError> &errors);
68
69protected:
71 // Overridable methods
72 void handleStart() override;
73 void handleStanza(const QDomElement &element) override;
74 void handleStream(const QDomElement &element) override;
76
77public Q_SLOTS:
78 void disconnectFromHost() override;
79
80private Q_SLOTS:
81 void _q_dnsLookupFinished();
82 void _q_socketDisconnected();
83 void socketError(QAbstractSocket::SocketError);
84 void socketSslErrors(const QList<QSslError> &);
85
86 void pingStart();
87 void pingStop();
88 void pingSend();
89 void pingTimeout();
90
91private:
92 bool setResumeAddress(const QString &address);
93 static std::pair<QString, int> parseHostAddress(const QString &address);
94
95 friend class QXmppOutgoingClientPrivate;
96 friend class tst_QXmppOutgoingClient;
97
98 const std::unique_ptr<QXmppOutgoingClientPrivate> d;
99};
100
101#endif // QXMPPOUTGOINGCLIENT_H
Error
Definition QXmppClient.h:98
The QXmppConfiguration class holds configuration options.
Definition QXmppConfiguration.h:29
The QXmppIq class is the base class for all IQs.
Definition QXmppIq.h:23
The QXmppMessage class represents an XMPP message.
Definition QXmppMessage.h:35
The QXmppOutgoingClient class represents an outgoing XMPP stream to an XMPP server.
Definition QXmppOutgoingClient.h:28
void error(QXmppClient::Error)
This signal is emitted when an error is encountered.
void presenceReceived(const QXmppPresence &)
This signal is emitted when a presence is received.
QSslSocket * socket() const
Returns the used socket.
Definition QXmppOutgoingClient.h:44
void messageReceived(const QXmppMessage &)
This signal is emitted when a message is received.
void sslErrors(const QList< QSslError > &errors)
This signal is emitted when SSL errors are encountered.
void elementReceived(const QDomElement &element, bool &handled)
This signal is emitted when an element is received.
void iqReceived(const QXmppIq &)
The QXmppPresence class represents an XMPP presence stanza.
Definition QXmppPresence.h:21
Condition
A detailed condition of the error.
Definition QXmppStanza.h:110
The QXmppStream class is the base class for all XMPP streams.
Definition QXmppStream.h:36
virtual void disconnectFromHost()
Definition QXmppStream.cpp:114
QXmppTask< IqResult > sendIq(QXmppIq &&, const QString &to)
Definition QXmppStream.cpp:218
QSslSocket * socket() const
Definition QXmppStream.cpp:323
virtual void handleStart()
Definition QXmppStream.cpp:135
virtual bool isConnected() const
Definition QXmppStream.cpp:145
virtual void handleStream(const QDomElement &element)=0
virtual void handleStanza(const QDomElement &element)=0
Definition QXmppTask.h:62