diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/QXmppSendStanzaParams.cpp | 28 | ||||
| -rw-r--r-- | src/client/QXmppSendStanzaParams.h | 6 |
2 files changed, 34 insertions, 0 deletions
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<QString> encryptionJids; + QXmppTrustStorage::TrustLevels acceptedTrustLevels; }; QXmppSendStanzaParams::QXmppSendStanzaParams() @@ -56,3 +57,30 @@ void QXmppSendStanzaParams::setEncryptionJids(QVector<QString> 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<QXmppTrustStorage::TrustLevels> 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<QXmppTrustStorage::TrustLevels> trustLevels) +{ + d->acceptedTrustLevels = trustLevels.value_or(QXmppTrustStorage::TrustLevels()); +} diff --git a/src/client/QXmppSendStanzaParams.h b/src/client/QXmppSendStanzaParams.h index af22f7cf..70ef572a 100644 --- a/src/client/QXmppSendStanzaParams.h +++ b/src/client/QXmppSendStanzaParams.h @@ -6,6 +6,9 @@ #define QXMPPSENDSTANZAPARAMS_H #include "QXmppGlobal.h" +#include "QXmppTrustStorage.h" + +#include <optional> #include <QSharedDataPointer> @@ -24,6 +27,9 @@ public: QVector<QString> encryptionJids() const; void setEncryptionJids(QVector<QString>); + std::optional<QXmppTrustStorage::TrustLevels> acceptedTrustLevels() const; + void setAcceptedTrustLevels(std::optional<QXmppTrustStorage::TrustLevels> trustLevels); + private: QSharedDataPointer<QXmppSendStanzaParamsPrivate> d; }; |
