aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/QXmppClient.cpp3
-rw-r--r--src/client/QXmppClientExtension.cpp37
-rw-r--r--src/client/QXmppClientExtension.h12
3 files changed, 43 insertions, 9 deletions
diff --git a/src/client/QXmppClient.cpp b/src/client/QXmppClient.cpp
index 6f993a46..2af1274d 100644
--- a/src/client/QXmppClient.cpp
+++ b/src/client/QXmppClient.cpp
@@ -753,8 +753,9 @@ QXmppVersionManager &QXmppClient::versionManager()
void QXmppClient::_q_elementReceived(const QDomElement &element, bool &handled)
{
+ const std::optional<QXmppE2eeMetadata> e2eeMetadata;
for (auto *extension : std::as_const(d->extensions)) {
- if (extension->handleStanza(element)) {
+ if (extension->handleStanza(element, e2eeMetadata) || extension->handleStanza(element)) {
handled = true;
return;
}
diff --git a/src/client/QXmppClientExtension.cpp b/src/client/QXmppClientExtension.cpp
index 5e16d52a..c5e00c21 100644
--- a/src/client/QXmppClientExtension.cpp
+++ b/src/client/QXmppClientExtension.cpp
@@ -45,6 +45,43 @@ QList<QXmppDiscoveryIq::Identity> QXmppClientExtension::discoveryIdentities() co
return QList<QXmppDiscoveryIq::Identity>();
}
+///
+/// \brief 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.
+///
+/// \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!
+///
+bool QXmppClientExtension::handleStanza(const QDomElement &)
+{
+ return false;
+}
+
+///
+/// \brief You need to implement this method to process incoming XMPP
+/// stanzas.
+///
+/// \param stanza The DOM element to be handled.
+/// \param e2eeMetadata If the element has been decrypted this contains metdata
+/// about the encryption.
+///
+/// \return 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
+///
+bool QXmppClientExtension::handleStanza(const QDomElement &, const std::optional<QXmppE2eeMetadata> &)
+{
+ return false;
+}
+
/// Returns the client which loaded this extension.
///
diff --git a/src/client/QXmppClientExtension.h b/src/client/QXmppClientExtension.h
index 355f12b3..0cf81fc3 100644
--- a/src/client/QXmppClientExtension.h
+++ b/src/client/QXmppClientExtension.h
@@ -14,6 +14,7 @@ class QXmppClient;
class QXmppClientExtensionPrivate;
class QXmppStream;
+///
/// \brief The QXmppClientExtension class is the base class for QXmppClient
/// extensions.
///
@@ -23,7 +24,7 @@ class QXmppStream;
/// client instance using QXmppClient::addExtension().
///
/// \ingroup Core
-
+///
class QXMPP_EXPORT QXmppClientExtension : public QXmppLoggable
{
Q_OBJECT
@@ -35,13 +36,8 @@ public:
virtual QStringList discoveryFeatures() const;
virtual QList<QXmppDiscoveryIq::Identity> discoveryIdentities() const;
- /// \brief 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.
- virtual bool handleStanza(const QDomElement &stanza) = 0;
+ virtual bool handleStanza(const QDomElement &stanza);
+ virtual bool handleStanza(const QDomElement &stanza, const std::optional<QXmppE2eeMetadata> &e2eeMetadata);
protected:
QXmppClient *client();