QXmpp: QXmppClientExtension Class Reference

QXmpp Version: 1.14.2

Loading...
Searching...
No Matches
QXmppClientExtension Class Reference
Core classes

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

`#include <QXmppClientExtension.h>`

Inheritance diagram for QXmppClientExtension:

## Public Member Functions
| QXmppClientExtension ()
virtual QStringList | discoveryFeatures () const
virtual QList< QXmppDiscoIdentity > | discoveryIdentities () const
virtual bool | handleStanza (const QDomElement &stanza)
| You need to implement this method to process incoming XMPP stanzas.
virtual bool | handleStanza (const QDomElement &stanza, const std::optional< QXmppE2eeMetadata > &e2eeMetadata)
| You need to implement this method to process incoming XMPP stanzas.
Public Member Functions inherited from QXmppLoggable
| QXmppLoggable (QObject *parent=nullptr)
Q_SIGNAL void | setGauge (const QString &gauge, double value)
| Sets the given gauge to value.
Q_SIGNAL void | logMessage (QXmppLogger::MessageType type, const QString &msg)
| This signal is emitted to send logging messages.
Q_SIGNAL void | updateCounter (const QString &counter, qint64 amount=1)
| Updates the given counter by amount.

## Protected Member Functions
QXmppClient * | client () const
virtual void | setClient (QXmppClient *client)
virtual void | onRegistered (QXmppClient *client)
virtual void | onUnregistered (QXmppClient *client)
void | injectIq (const QDomElement &element, const std::optional< QXmppE2eeMetadata > &e2eeMetadata)
bool | injectMessage (QXmppMessage &&message)
Protected Member Functions inherited from QXmppLoggable
void | debug (const QString &message)
| Logs a debugging message.
void | info (const QString &message)
| Logs an informational message.
void | warning (const QString &message)
| Logs a warning message.
void | logReceived (const QString &message)
| Logs a received packet.
void | logSent (const QString &message)
| Logs a sent packet.

## Friends
class | QXmppClient

## Detailed Description

The QXmppClientExtension class is the base class for QXmppClient extensions.

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().

## Constructor & Destructor Documentation

## ◆ QXmppClientExtension()

QXmppClientExtension::QXmppClientExtension | ( |  | ) |

Constructs a QXmppClient extension.

## Member Function Documentation

## ◆ client()

QXmppClient * QXmppClientExtension::client | ( |  | ) | const
| protected

Returns the client which loaded this extension.

## ◆ discoveryFeatures()

QStringList QXmppClientExtension::discoveryFeatures | ( |  | ) | const
| virtual

Returns the discovery features to add to the client.

Reimplemented in QXmppAttentionManager, QXmppMixManager, QXmppMovedManager, QXmppMucManagerV2, QXmppRegistrationManager, QXmppUserLocationManager, and QXmppUserTuneManager.

## ◆ discoveryIdentities()

QList< QXmppDiscoIdentity > QXmppClientExtension::discoveryIdentities | ( |  | ) | const
| virtual

Returns the discovery identities to add to the client.

## ◆ handleStanza() [1/2]

bool QXmppClientExtension::handleStanza | ( | const QDomElement & | stanza | ) |
| virtual

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

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

End-to-end encrypted stanzas are not passed to this overload, for that purpose use the new overload instead.

Deprecated
  This is deprecated since QXmpp 1.5. Please use QXmppClientExtension::handleStanza(const QDomElement &stanza, const std::optional<QXmppE2eeMetadata> &e2eeMetadata). Currently both methods are called by the client, so only implement one!

Reimplemented in QXmppUploadRequestManager.

## ◆ handleStanza() [2/2]

bool QXmppClientExtension::handleStanza | ( | const QDomElement & | stanza,
|  | const std::optional< QXmppE2eeMetadata > & | e2eeMetadata )
| virtual

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

Parameters

  stanza | The DOM element to be handled.
  e2eeMetadata | If the element has been decrypted this contains metadata about the encryption.

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

Since
  QXmpp 1.5

Reimplemented in QXmppCarbonManagerV2.

## ◆ injectIq()

void QXmppClientExtension::injectIq | ( | const QDomElement & | element,
|  | const std::optional< QXmppE2eeMetadata > & | e2eeMetadata )
| protected

Injects an IQ element into the client.

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

Parameters

  element |
  e2eeMetadata | End-to-end encryption metadata for the IQ. Should be set if the stanza has been decrypted with an end-to-end encryption.

Since
  QXmpp 1.5

## ◆ injectMessage()

bool QXmppClientExtension::injectMessage | ( | QXmppMessage && | message | ) |
| protected

Injects a message stanza into the client.

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

Since
  QXmpp 1.5

## ◆ onRegistered()

void QXmppClientExtension::onRegistered | ( | QXmppClient * | client | ) |
| protectedvirtual

Called after the extension has been added to a QXmppClient.

Parameters

  client |

Reimplemented in QXmppAttentionManager, QXmppCarbonManagerV2, QXmppDiscoveryManager, QXmppHttpUploadManager, QXmppMucManagerV2, QXmppRegistrationManager, QXmppRosterManager, QXmppUploadRequestManager, and QXmppVCardManager.

## ◆ onUnregistered()

void QXmppClientExtension::onUnregistered | ( | QXmppClient * | client | ) |
| protectedvirtual

Called after the extension has been removed from a QXmppClient.

Parameters

  client |

Reimplemented in QXmppAttentionManager, QXmppCarbonManagerV2, QXmppDiscoveryManager, QXmppHttpUploadManager, QXmppMucManagerV2, QXmppRegistrationManager, QXmppRosterManager, QXmppUploadRequestManager, and QXmppVCardManager.

## ◆ setClient()

void QXmppClientExtension::setClient | ( | QXmppClient * | client | ) |
| protectedvirtual

Sets the client which loaded this extension.

Parameters

  client |

The documentation for this class was generated from the following files:

- QXmppClientExtension.h
- client/compat/removed_api.cpp
- QXmppClientExtension.cpp