Loading...
Searching...
No Matches
QXmppOutgoingServer.h
// SPDX-FileCopyrightText: 2010 Jeremy Lainé <jeremy.laine@m4x.org>
//
// SPDX-License-Identifier: LGPL-2.1-or-later
#ifndef QXMPPOUTGOINGSERVER_H
#define QXMPPOUTGOINGSERVER_H
#include "QXmppLogger.h"
#include "QXmppStreamError.h"
#include <QAbstractSocket>
class QDomElement;
class QSslError;
class QXmppDialback;
class QXmppNonza;
class QXmppOutgoingServer;
class QXmppOutgoingServerPrivate;
namespace QXmpp::Private {
struct StreamOpen;
}
class QXMPP_EXPORT QXmppOutgoingServer : public QXmppLoggable
{
Q_OBJECT
public:
QXmppOutgoingServer(const QString &domain, QObject *parent);
~QXmppOutgoingServer() override;
bool isConnected() const;
Q_SLOT void connectToHost(const QString &domain);
void disconnectFromHost();
Q_SLOT void queueData(const QByteArray &data);
Q_SIGNAL void connected();
Q_SIGNAL void disconnected();
bool sendData(const QByteArray &);
bool sendPacket(const QXmppNonza &);
QString localStreamKey() const;
void setLocalStreamKey(const QString &key);
void setVerify(const QString &id, const QString &key);
QString remoteDomain() const;
Q_SIGNAL void dialbackResponseReceived(const QXmppDialback &response);
private:
void handleStart();
void handleStream(const QXmpp::Private::StreamOpen &streamElement);
void handleStanza(const QDomElement &stanzaElement);
void onDnsLookupFinished();
void onSocketDisconnected();
void sendDialback();
void slotSslErrors(const QList<QSslError> &errors);
void onSocketError(const QString &text, std::variant<QXmpp::StreamError, QAbstractSocket::SocketError> error);
const std::unique_ptr<QXmppOutgoingServerPrivate> d;
};
#endif
QXmppDialback
The QXmppDialback class represents a stanza used for the Server Dialback protocol as specified by XEP...
Definition QXmppDialback.h:16
QXmppLoggable::QXmppLoggable
QXmppLoggable(QObject *parent=nullptr)
Definition QXmppLogger.cpp:57
QXmppNonza
Definition QXmppNonza.h:14
QXmppOutgoingServer
The QXmppOutgoingServer class represents an outgoing XMPP stream to another XMPP server.
Definition QXmppOutgoingServer.h:29
QXmppOutgoingServer::setLocalStreamKey
void setLocalStreamKey(const QString &key)
Sets the stream's local dialback key.
Definition QXmppOutgoingServer.cpp:244
QXmppOutgoingServer::disconnectFromHost
void disconnectFromHost()
Disconnects from the remote host.
Definition QXmppOutgoingServer.cpp:220
QXmppOutgoingServer::connectToHost
Q_SLOT void connectToHost(const QString &domain)
Definition QXmppOutgoingServer.cpp:89
QXmppOutgoingServer::QXmppOutgoingServer
QXmppOutgoingServer(const QString &domain, QObject *parent)
Definition QXmppOutgoingServer.cpp:59
QXmppOutgoingServer::connected
Q_SIGNAL void connected()
This signal is emitted when the stream is connected.
QXmppOutgoingServer::sendData
bool sendData(const QByteArray &)
Sends raw data to the peer.
Definition QXmppOutgoingServer.cpp:226
QXmppOutgoingServer::remoteDomain
QString remoteDomain() const
Returns the remote server's domain.
Definition QXmppOutgoingServer.cpp:267
QXmppOutgoingServer::isConnected
bool isConnected() const
Returns true if the socket is connected and authentication succeeded.
Definition QXmppOutgoingServer.cpp:214
QXmppOutgoingServer::disconnected
Q_SIGNAL void disconnected()
This signal is emitted when the stream is disconnected.
QXmppOutgoingServer::sendPacket
bool sendPacket(const QXmppNonza &)
Sends an XMPP packet to the peer.
Definition QXmppOutgoingServer.cpp:232
QXmppOutgoingServer::setVerify
void setVerify(const QString &id, const QString &key)
Sets the stream's verification information.
Definition QXmppOutgoingServer.cpp:250
QXmppOutgoingServer::localStreamKey
QString localStreamKey() const
Returns the stream's local dialback key.
Definition QXmppOutgoingServer.cpp:238
QXmppOutgoingServer::queueData
Q_SLOT void queueData(const QByteArray &data)
Sends or queues data until connected.
Definition QXmppOutgoingServer.cpp:257
QXmppOutgoingServer::dialbackResponseReceived
Q_SIGNAL void dialbackResponseReceived(const QXmppDialback &response)
This signal is emitted when a dialback verify response is received.