QXmppServer Class

The QXmppServer class represents an XMPP server. More...

Header: #include <QXmppServer.h>
Inherits: QXmppLoggable

Properties

Public Functions

QXmppServer(QObject *parent = nullptr)
void addCaCertificates(const QString &path)
void addExtension(QXmppServerExtension *extension)
void addIncomingClient(QXmppIncomingClient *stream)
void close()
QString domain() const
QList<QXmppServerExtension *> extensions()
bool listenForClients(const QHostAddress &address = QHostAddress::Any, quint16 port = 5222)
bool listenForServers(const QHostAddress &address = QHostAddress::Any, quint16 port = 5269)
QXmppLogger *logger()
QXmppPasswordChecker *passwordChecker()
bool sendElement(const QDomElement &element)
bool sendPacket(const QXmppStanza &packet)
void setDomain(const QString &domain)
(since QXmpp 0.9) void setLocalCertificate(const QSslCertificate &certificate)
void setLocalCertificate(const QString &path)
void setLogger(QXmppLogger *logger)
void setPasswordChecker(QXmppPasswordChecker *checker)
(since QXmpp 0.9) void setPrivateKey(const QSslKey &key)
void setPrivateKey(const QString &path)
QVariantMap statistics() const

Public Slots

void handleElement(const QDomElement &element)

Signals

void clientConnected(const QString &jid)
void clientDisconnected(const QString &jid)
void loggerChanged(QXmppLogger *logger)

Detailed Description

It provides support for both client-to-server and server-to-server communications, SSL encryption and logging facilities.

QXmppServer comes with a number of modules for service discovery, XMPP ping, statistics and file transfer proxy support. You can write your own extensions for QXmppServer by subclassing QXmppServerExtension.

Property Documentation

logger : QXmppLogger*

The QXmppLogger associated with the server

Access functions:

QXmppLogger *logger()
void setLogger(QXmppLogger *logger)

Notifier signal:

void loggerChanged(QXmppLogger *logger)

Member Function Documentation

QXmppServer::QXmppServer(QObject *parent = nullptr)

Constructs a new XMPP server instance.

parent.

void QXmppServer::addCaCertificates(const QString &path)

Sets the path for additional SSL CA certificates.

void QXmppServer::addExtension(QXmppServerExtension *extension)

Registers a new extension with the server. Returns true on success.

void QXmppServer::addIncomingClient(QXmppIncomingClient *stream)

Add a new incoming client stream.

This method can be used for instance to implement BOSH support as a server extension.

[signal] void QXmppServer::clientConnected(const QString &jid)

This signal is emitted when a client has connected.

jid.

[signal] void QXmppServer::clientDisconnected(const QString &jid)

This signal is emitted when a client has disconnected.

jid.

void QXmppServer::close()

Closes the server.

QString QXmppServer::domain() const

Returns the server's domain.

See also setDomain().

QList<QXmppServerExtension *> QXmppServer::extensions()

Returns the list of loaded extensions.

[slot] void QXmppServer::handleElement(const QDomElement &element)

Handle an incoming XML element.

bool QXmppServer::listenForClients(const QHostAddress &address = QHostAddress::Any, quint16 port = 5222)

Listens for incoming XMPP client connections; returns true on success.

port and address.

bool QXmppServer::listenForServers(const QHostAddress &address = QHostAddress::Any, quint16 port = 5269)

Listens for incoming XMPP server connections; returns true on success.

port and address.

QXmppLogger *QXmppServer::logger()

Returns the QXmppLogger associated with the server.

Note: Getter function for property logger.

See also setLogger().

[signal] void QXmppServer::loggerChanged(QXmppLogger *logger)

This signal is emitted when the logger changes.

Note: Notifier signal for property logger.

QXmppPasswordChecker *QXmppServer::passwordChecker()

Returns the password checker used to verify client credentials.

See also setPasswordChecker().

bool QXmppServer::sendElement(const QDomElement &element)

Routes an XMPP stanza; returns true on success.

element.

bool QXmppServer::sendPacket(const QXmppStanza &packet)

Routes an XMPP packet; returns true on success.

void QXmppServer::setDomain(const QString &domain)

Sets the server's domain.

See also domain().

[since QXmpp 0.9] void QXmppServer::setLocalCertificate(const QSslCertificate &certificate)

Sets the local SSL certificate.

This function was introduced in QXmpp 0.9.

void QXmppServer::setLocalCertificate(const QString &path)

Sets the path for the local SSL certificate.

void QXmppServer::setLogger(QXmppLogger *logger)

Sets the QXmppLogger associated with the server.

logger.

Note: Setter function for property logger.

See also logger().

void QXmppServer::setPasswordChecker(QXmppPasswordChecker *checker)

Sets the password checker used to verify client credentials.

See also passwordChecker().

[since QXmpp 0.9] void QXmppServer::setPrivateKey(const QSslKey &key)

Sets the local SSL private key to key.

This function was introduced in QXmpp 0.9.

void QXmppServer::setPrivateKey(const QString &path)

Sets the path for the local SSL private key.

QVariantMap QXmppServer::statistics() const

Returns the statistics for the server.