QXmpp Version: 1.10.3
 
Loading...
Searching...
No Matches
QXmppOutgoingServer.h
1// SPDX-FileCopyrightText: 2010 Jeremy Lainé <jeremy.laine@m4x.org>
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4
5#ifndef QXMPPOUTGOINGSERVER_H
6#define QXMPPOUTGOINGSERVER_H
7
8#include "QXmppLogger.h"
9
10#include <QAbstractSocket>
11
12class QDomElement;
13class QSslError;
14class QXmppDialback;
15class QXmppNonza;
17class QXmppOutgoingServerPrivate;
18
23class QXMPP_EXPORT QXmppOutgoingServer : public QXmppLoggable
24{
25 Q_OBJECT
26
27public:
28 QXmppOutgoingServer(const QString &domain, QObject *parent);
29 ~QXmppOutgoingServer() override;
30
31 bool isConnected() const;
32 Q_SLOT void connectToHost(const QString &domain);
33 void disconnectFromHost();
34 Q_SLOT void queueData(const QByteArray &data);
35
37 Q_SIGNAL void connected();
39 Q_SIGNAL void disconnected();
40
41 bool sendData(const QByteArray &);
42 bool sendPacket(const QXmppNonza &);
43
44 QString localStreamKey() const;
45 void setLocalStreamKey(const QString &key);
46 void setVerify(const QString &id, const QString &key);
47
48 QString remoteDomain() const;
49
51 Q_SIGNAL void dialbackResponseReceived(const QXmppDialback &response);
52
53private:
54 void handleStart();
55 void handleStream(const QDomElement &streamElement);
56 void handleStanza(const QDomElement &stanzaElement);
57
58 void onDnsLookupFinished();
59 void onSocketDisconnected();
60 void sendDialback();
61 void slotSslErrors(const QList<QSslError> &errors);
62 void socketError(QAbstractSocket::SocketError error);
63
64 const std::unique_ptr<QXmppOutgoingServerPrivate> d;
65};
66
67#endif
The QXmppDialback class represents a stanza used for the Server Dialback protocol as specified by XEP...
Definition QXmppDialback.h:16
QXmppLoggable(QObject *parent=nullptr)
Definition QXmppLogger.cpp:57
Definition QXmppNonza.h:14
The QXmppOutgoingServer class represents an outgoing XMPP stream to another XMPP server.
Definition QXmppOutgoingServer.h:24
void setLocalStreamKey(const QString &key)
Sets the stream's local dialback key.
Definition QXmppOutgoingServer.cpp:252
void disconnectFromHost()
Disconnects from the remote host.
Definition QXmppOutgoingServer.cpp:228
Q_SLOT void connectToHost(const QString &domain)
Definition QXmppOutgoingServer.cpp:94
QXmppOutgoingServer(const QString &domain, QObject *parent)
Definition QXmppOutgoingServer.cpp:58
Q_SIGNAL void connected()
This signal is emitted when the stream is connected.
bool sendData(const QByteArray &)
Sends raw data to the peer.
Definition QXmppOutgoingServer.cpp:234
QString remoteDomain() const
Returns the remote server's domain.
Definition QXmppOutgoingServer.cpp:275
bool isConnected() const
Returns true if the socket is connected and authentication succeeded.
Definition QXmppOutgoingServer.cpp:222
Q_SIGNAL void disconnected()
This signal is emitted when the stream is disconnected.
bool sendPacket(const QXmppNonza &)
Sends an XMPP packet to the peer.
Definition QXmppOutgoingServer.cpp:240
void setVerify(const QString &id, const QString &key)
Sets the stream's verification information.
Definition QXmppOutgoingServer.cpp:258
QString localStreamKey() const
Returns the stream's local dialback key.
Definition QXmppOutgoingServer.cpp:246
Q_SLOT void queueData(const QByteArray &data)
Sends or queues data until connected.
Definition QXmppOutgoingServer.cpp:265
Q_SIGNAL void dialbackResponseReceived(const QXmppDialback &response)
This signal is emitted when a dialback verify response is received.