QXmppClientExtension Class

The QXmppClientExtension class is the base class for QXmppClient extensions. More...

Public Functions

QXmppClientExtension()
virtual QStringList discoveryFeatures() const
virtual QList<QXmppDiscoIdentity> discoveryIdentities() const
(since QXmpp 1.5) virtual bool handleStanza(const QDomElement &stanza, const std::optional<QXmppE2eeMetadata> &e2eeMetadata)

Protected Functions

QXmppClient *client() const
(since QXmpp 1.5) void injectIq(const QDomElement &element, const std::optional<QXmppE2eeMetadata> &e2eeMetadata)
(since QXmpp 1.5) bool injectMessage(QXmppMessage &&message)
virtual void onRegistered(QXmppClient *client)
virtual void onUnregistered(QXmppClient *client)
virtual void setClient(QXmppClient *client)

Detailed Description

If you want to extend QXmppClient, for instance to support an IQ type which is not natively supported, you can subclass QXmppClientExtension and implement handleStanza(). You can then add your extension to the client instance using QXmppClient::addExtension().

Member Function Documentation

QXmppClientExtension::QXmppClientExtension()

Constructs a QXmppClient extension.

[protected] QXmppClient *QXmppClientExtension::client() const

Returns the client which loaded this extension.

See also setClient().

[virtual] QStringList QXmppClientExtension::discoveryFeatures() const

Returns the discovery features to add to the client.

[virtual] QList<QXmppDiscoIdentity> QXmppClientExtension::discoveryIdentities() const

Returns the discovery identities to add to the client.

[virtual, since QXmpp 1.5] bool QXmppClientExtension::handleStanza(const QDomElement &stanza, const std::optional<QXmppE2eeMetadata> &e2eeMetadata)

You need to implement this method to process incoming XMPP stanzas.

stanza is the DOM element to be handled. e2eeMetadata, if the element has been decrypted, contains metadata about the encryption.

Returns true if the stanza was handled and no further processing should occur, or false to let other extensions process the stanza.

This function was introduced in QXmpp 1.5.

[protected, since QXmpp 1.5] void QXmppClientExtension::injectIq(const QDomElement &element, const std::optional<QXmppE2eeMetadata> &e2eeMetadata)

Injects the IQ element into the client.

The IQ is handled like any other stanza received via the XMPP stream.

e2eeMetadata is the end-to-end encryption metadata for the IQ. It should be set if the stanza has been decrypted with an end-to-end encryption.

This function was introduced in QXmpp 1.5.

[protected, since QXmpp 1.5] bool QXmppClientExtension::injectMessage(QXmppMessage &&message)

Injects a message stanza into the client. Returns whether the stanza was handled.

The stanza is processed by the client with all extensions implementing MessageHandler.

message.

This function was introduced in QXmpp 1.5.

[virtual protected] void QXmppClientExtension::onRegistered(QXmppClient *client)

Called after the extension has been added to the QXmppClient client.

[virtual protected] void QXmppClientExtension::onUnregistered(QXmppClient *client)

Called after the extension has been removed from the QXmppClient client.

[virtual protected] void QXmppClientExtension::setClient(QXmppClient *client)

Sets the client which loaded this extension.

See also client().