From cb1c0ac7ba16590304c8fe7bd6d87b69dffe5c67 Mon Sep 17 00:00:00 2001 From: Melvin Keskin Date: Mon, 23 May 2022 15:17:12 +0200 Subject: SendStanzaParams: Add accepted trust levels --- src/client/QXmppSendStanzaParams.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/client/QXmppSendStanzaParams.cpp') diff --git a/src/client/QXmppSendStanzaParams.cpp b/src/client/QXmppSendStanzaParams.cpp index 3a3beaae..6c8b6ccc 100644 --- a/src/client/QXmppSendStanzaParams.cpp +++ b/src/client/QXmppSendStanzaParams.cpp @@ -18,6 +18,7 @@ class QXmppSendStanzaParamsPrivate : public QSharedData { public: QVector encryptionJids; + QXmppTrustStorage::TrustLevels acceptedTrustLevels; }; QXmppSendStanzaParams::QXmppSendStanzaParams() @@ -56,3 +57,30 @@ void QXmppSendStanzaParams::setEncryptionJids(QVector encryptionJids) { d->encryptionJids = std::move(encryptionJids); } + +/// +/// Returns the possible trust levels a key must have to be used for encryption. +/// +/// If no trust levels are set, the encryption manager uses an own default. +/// +/// \return the trust levels of the keys used for encryption +/// +std::optional QXmppSendStanzaParams::acceptedTrustLevels() const +{ + if (d->acceptedTrustLevels) { + return d->acceptedTrustLevels; + } + return {}; +} + +/// +/// Sets the possible trust levels a key must have to be used for encryption. +/// +/// If no trust levels are set, the encryption manager uses an own default. +/// +/// \param trustLevels trust levels of the keys used for encryption +/// +void QXmppSendStanzaParams::setAcceptedTrustLevels(std::optional trustLevels) +{ + d->acceptedTrustLevels = trustLevels.value_or(QXmppTrustStorage::TrustLevels()); +} -- cgit v1.2.3