aboutsummaryrefslogtreecommitdiff
path: root/src/client/QXmppClient.cpp
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2022-04-04 17:51:35 +0200
committerLinus Jahn <lnj@kaidan.im>2022-05-20 16:55:28 +0200
commitbab7db9d579e52d7e6e27330042797fc9829c485 (patch)
tree9926d5a45fd83a78ae70243dd234dd0bcadcb956 /src/client/QXmppClient.cpp
parent9073ea57506e4081881355a508a29ea5325b9e8b (diff)
Client: Add reply() picking the encryption based on the received stanza
Currently does not support multiple encryptions, so the implementation is rather simple.
Diffstat (limited to 'src/client/QXmppClient.cpp')
-rw-r--r--src/client/QXmppClient.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/client/QXmppClient.cpp b/src/client/QXmppClient.cpp
index 2af1274d..0b14bc68 100644
--- a/src/client/QXmppClient.cpp
+++ b/src/client/QXmppClient.cpp
@@ -409,6 +409,25 @@ QFuture<QXmpp::SendResult> QXmppClient::sendUnencrypted(QXmppStanza &&stanza)
}
///
+/// Sends the stanza with the same encryption as \p e2eeMetadata.
+///
+/// When there is no e2eeMetadata given this always sends the stanza without
+/// end-to-end encryption.
+/// Intended to be used for replies to IQs and messages.
+///
+/// \since QXmpp 1.5
+///
+QFuture<QXmpp::SendResult> QXmppClient::reply(QXmppStanza &&stanza, const std::optional<QXmppE2eeMetadata> &e2eeMetadata)
+{
+ // This should pick the right e2ee manager as soon as multiple encryptions
+ // in parallel are supported.
+ if (e2eeMetadata) {
+ return send(std::move(stanza));
+ }
+ return sendUnencrypted(std::move(stanza));
+}
+
+///
/// Sends an IQ packet and returns the response asynchronously.
///
/// This is useful for further processing and parsing of the returned