From bab7db9d579e52d7e6e27330042797fc9829c485 Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Mon, 4 Apr 2022 17:51:35 +0200 Subject: Client: Add reply() picking the encryption based on the received stanza Currently does not support multiple encryptions, so the implementation is rather simple. --- src/client/QXmppClient.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/client/QXmppClient.cpp') 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 @@ -408,6 +408,25 @@ QFuture QXmppClient::sendUnencrypted(QXmppStanza &&stanza) return d->stream->send(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 QXmppClient::reply(QXmppStanza &&stanza, const std::optional &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. /// -- cgit v1.2.3