From bdc2b00a1d89c20f6fe87bdb6f9eb792afeea2bb Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Mon, 17 Oct 2022 16:14:35 +0200 Subject: E2eeExtension: Add isEncrypted() and decryptMessage() functions --- src/client/QXmppE2eeExtension.cpp | 25 +++++++++++++++++++++++++ src/client/QXmppE2eeExtension.h | 6 +++++- 2 files changed, 30 insertions(+), 1 deletion(-) (limited to 'src/client') diff --git a/src/client/QXmppE2eeExtension.cpp b/src/client/QXmppE2eeExtension.cpp index 9e98a566..52cebb48 100644 --- a/src/client/QXmppE2eeExtension.cpp +++ b/src/client/QXmppE2eeExtension.cpp @@ -27,6 +27,12 @@ /// QXmpp::SendError in case the message couldn't be encrypted. /// +/// +/// \typedef QXmppE2eeExtension::MessageDecryptResult +/// +/// Contains the decrypted QXmppMessage, NotEncrypted or an QXmppError. +/// + /// /// \typedef QXmppE2eeExtension::IqEncryptResult /// @@ -52,6 +58,13 @@ /// an error message. /// +/// +/// \fn QXmppE2eeExtension::decryptMessage +/// +/// Decrypts a QXmppMessage and returns the decrypted QXmppMessage. In case the message was not +/// encrypted, QXmppE2eeExtension::NotEncrypted should be returned. +/// + /// /// \fn QXmppE2eeExtension::encryptIq /// @@ -70,3 +83,15 @@ /// element via QFuture. If the input was not encrypted, /// QXmppE2eeExtension::NotEncrypted should be returned. /// + +/// +/// \fn QXmppE2eeExtension::isEncrypted(const QDomElement &) +/// +/// Returns whether the DOM element of an IQ or message stanza is encrypted with this encryption. +/// + +/// +/// \fn QXmppE2eeExtension::isEncrypted(const QXmppMessage &) +/// +/// Returns whether the message is encrypted with this encryption. +/// diff --git a/src/client/QXmppE2eeExtension.h b/src/client/QXmppE2eeExtension.h index 6c3556f2..295de1a3 100644 --- a/src/client/QXmppE2eeExtension.h +++ b/src/client/QXmppE2eeExtension.h @@ -5,6 +5,7 @@ #ifndef QXMPPE2EEEXTENSION_H #define QXMPPE2EEEXTENSION_H +#include "QXmppError.h" #include "QXmppExtension.h" #include "QXmppSendResult.h" #include "QXmppSendStanzaParams.h" @@ -25,13 +26,16 @@ public: }; using MessageEncryptResult = std::variant; + using MessageDecryptResult = std::variant; using IqEncryptResult = std::variant; using IqDecryptResult = std::variant; virtual QFuture encryptMessage(QXmppMessage &&, const std::optional &) = 0; - + virtual QFuture decryptMessage(QXmppMessage &&) = 0; virtual QFuture encryptIq(QXmppIq &&, const std::optional &) = 0; virtual QFuture decryptIq(const QDomElement &) = 0; + virtual bool isEncrypted(const QDomElement &) = 0; + virtual bool isEncrypted(const QXmppMessage &) = 0; }; #endif // QXMPPE2EEEXTENSION_H -- cgit v1.2.3