From 32ccc6358ba6433e6b870b238fba20ccf1862fe2 Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Sat, 18 Jun 2022 12:41:31 +0200 Subject: Move SecurityPolicy, TrustLevel intro extra headers This avoids the need to include the whole TrustStorage in files like SendStanzaParams.h. --- src/client/QXmppTrustMemoryStorage.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/client/QXmppTrustMemoryStorage.cpp') diff --git a/src/client/QXmppTrustMemoryStorage.cpp b/src/client/QXmppTrustMemoryStorage.cpp index a94768d2..daab2e73 100644 --- a/src/client/QXmppTrustMemoryStorage.cpp +++ b/src/client/QXmppTrustMemoryStorage.cpp @@ -6,6 +6,7 @@ #include "QXmppFutureUtils_p.h" +using namespace QXmpp; using namespace QXmpp::Private; /// @@ -23,14 +24,14 @@ struct Key { QByteArray id; QString ownerJid; - QXmppTrustStorage::TrustLevel trustLevel; + TrustLevel trustLevel; }; class QXmppTrustMemoryStoragePrivate { public: // encryption protocols mapped to security policies - QMap securityPolicies; + QMap securityPolicies; // encryption protocols mapped to keys of this client instance QMap ownKeys; @@ -50,7 +51,7 @@ QXmppTrustMemoryStorage::QXmppTrustMemoryStorage() QXmppTrustMemoryStorage::~QXmppTrustMemoryStorage() = default; /// \cond -QFuture QXmppTrustMemoryStorage::setSecurityPolicy(const QString &encryption, QXmppTrustStorage::SecurityPolicy securityPolicy) +QFuture QXmppTrustMemoryStorage::setSecurityPolicy(const QString &encryption, TrustSecurityPolicy securityPolicy) { d->securityPolicies.insert(encryption, securityPolicy); return makeReadyFuture(); @@ -62,7 +63,7 @@ QFuture QXmppTrustMemoryStorage::resetSecurityPolicy(const QString &encryp return makeReadyFuture(); } -QFuture QXmppTrustMemoryStorage::securityPolicy(const QString &encryption) +QFuture QXmppTrustMemoryStorage::securityPolicy(const QString &encryption) { return makeReadyFuture(std::move(d->securityPolicies.value(encryption))); } @@ -85,7 +86,7 @@ QFuture QXmppTrustMemoryStorage::ownKey(const QString &encryption) return makeReadyFuture(std::move(key)); } -QFuture QXmppTrustMemoryStorage::addKeys(const QString &encryption, const QString &keyOwnerJid, const QList &keyIds, QXmppTrustStorage::TrustLevel trustLevel) +QFuture QXmppTrustMemoryStorage::addKeys(const QString &encryption, const QString &keyOwnerJid, const QList &keyIds, TrustLevel trustLevel) { for (const auto &keyId : keyIds) { Key key; @@ -132,7 +133,7 @@ QFuture QXmppTrustMemoryStorage::removeKeys(const QString &encryption) return makeReadyFuture(); } -QFuture>> QXmppTrustMemoryStorage::keys(const QString &encryption, TrustLevels trustLevels) +QFuture>> QXmppTrustMemoryStorage::keys(const QString &encryption, TrustLevels trustLevels) { QHash> keys; @@ -147,9 +148,9 @@ QFuture>> Q return makeReadyFuture(std::move(keys)); } -QFuture>> QXmppTrustMemoryStorage::keys(const QString &encryption, const QList &keyOwnerJids, TrustLevels trustLevels) +QFuture>> QXmppTrustMemoryStorage::keys(const QString &encryption, const QList &keyOwnerJids, TrustLevels trustLevels) { - QHash> keys; + QHash> keys; const auto storedKeys = d->keys.values(encryption); for (const auto &key : storedKeys) { @@ -231,7 +232,7 @@ QFuture>> QXmppTrustMemoryStorage return makeReadyFuture(std::move(modifiedKeys)); } -QFuture QXmppTrustMemoryStorage::trustLevel(const QString &encryption, const QString &keyOwnerJid, const QByteArray &keyId) +QFuture QXmppTrustMemoryStorage::trustLevel(const QString &encryption, const QString &keyOwnerJid, const QByteArray &keyId) { const auto keys = d->keys.values(encryption); for (const auto &key : keys) { @@ -240,7 +241,7 @@ QFuture QXmppTrustMemoryStorage::trustLevel(const } } - return makeReadyFuture(std::move(QXmppTrustStorage::Undecided)); + return makeReadyFuture(std::move(TrustLevel::Undecided)); } QFuture QXmppTrustMemoryStorage::resetAll(const QString &encryption) -- cgit v1.2.3