diff options
| author | Melvin Keskin <melvo@olomono.de> | 2022-03-07 14:58:29 +0100 |
|---|---|---|
| committer | Linus Jahn <lnj@kaidan.im> | 2022-03-07 20:19:29 +0100 |
| commit | ebbf58a05ca112b7e56df8aa072f410398a86dae (patch) | |
| tree | 414f3459888096124d4b3a1846c355ce2d0f290d /src | |
| parent | 76965a11aa4d230ae8636c67e0e6f9ce20f5ec5c (diff) | |
| download | qxmpp-ebbf58a05ca112b7e56df8aa072f410398a86dae.tar.gz | |
Add parameter 'keyOwnerJid' to trust storages' 'trustLevel()'
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/QXmppAtmManager.cpp | 2 | ||||
| -rw-r--r-- | src/client/QXmppTrustMemoryStorage.cpp | 4 | ||||
| -rw-r--r-- | src/client/QXmppTrustMemoryStorage.h | 2 | ||||
| -rw-r--r-- | src/client/QXmppTrustStorage.cpp | 3 | ||||
| -rw-r--r-- | src/client/QXmppTrustStorage.h | 2 |
5 files changed, 7 insertions, 6 deletions
diff --git a/src/client/QXmppAtmManager.cpp b/src/client/QXmppAtmManager.cpp index 2c9a8568..aef42d4d 100644 --- a/src/client/QXmppAtmManager.cpp +++ b/src/client/QXmppAtmManager.cpp @@ -301,7 +301,7 @@ QFuture<void> QXmppAtmManager::handleMessage(const QXmppMessage &message) const auto senderKey = e2eeMetadata ? e2eeMetadata->senderKey() : QByteArray(); const auto encryption = trustMessageElement->encryption(); - auto future = m_trustStorage->trustLevel(encryption, senderKey); + auto future = m_trustStorage->trustLevel(encryption, senderJid, senderKey); await(future, this, [=](const auto &&senderKeyTrustLevel) mutable { const auto isSenderKeyAuthenticated = senderKeyTrustLevel == QXmppTrustStorage::Authenticated; diff --git a/src/client/QXmppTrustMemoryStorage.cpp b/src/client/QXmppTrustMemoryStorage.cpp index 5a1b6e61..c9e2f37f 100644 --- a/src/client/QXmppTrustMemoryStorage.cpp +++ b/src/client/QXmppTrustMemoryStorage.cpp @@ -223,11 +223,11 @@ QFuture<void> QXmppTrustMemoryStorage::setTrustLevel(const QString &encryption, return makeReadyFuture(); } -QFuture<QXmppTrustStorage::TrustLevel> QXmppTrustMemoryStorage::trustLevel(const QString &encryption, const QByteArray &keyId) +QFuture<QXmppTrustStorage::TrustLevel> QXmppTrustMemoryStorage::trustLevel(const QString &encryption, const QString &keyOwnerJid, const QByteArray &keyId) { const auto keys = d->keys.values(encryption); for (const auto &key : keys) { - if (key.id == keyId) { + if (key.id == keyId && key.ownerJid == keyOwnerJid) { return makeReadyFuture(std::move(QXmppTrustStorage::TrustLevel(key.trustLevel))); } } diff --git a/src/client/QXmppTrustMemoryStorage.h b/src/client/QXmppTrustMemoryStorage.h index abab2d6a..c9d15fe9 100644 --- a/src/client/QXmppTrustMemoryStorage.h +++ b/src/client/QXmppTrustMemoryStorage.h @@ -36,7 +36,7 @@ public: QFuture<void> setTrustLevel(const QString &encryption, const QMultiHash<QString, QByteArray> &keyIds, TrustLevel trustLevel) override; QFuture<void> setTrustLevel(const QString &encryption, const QList<QString> &keyOwnerJids, TrustLevel oldTrustLevel, TrustLevel newTrustLevel) override; - QFuture<TrustLevel> trustLevel(const QString &encryption, const QByteArray &keyId) override; + QFuture<TrustLevel> trustLevel(const QString &encryption, const QString &keyOwnerJid, const QByteArray &keyId) override; QFuture<void> resetAll(const QString &encryption) override; /// \endcond diff --git a/src/client/QXmppTrustStorage.cpp b/src/client/QXmppTrustStorage.cpp index 149eccfe..5cfe5b95 100644 --- a/src/client/QXmppTrustStorage.cpp +++ b/src/client/QXmppTrustStorage.cpp @@ -176,13 +176,14 @@ /// /// -/// \fn QXmppTrustStorage::trustLevel(const QString &encryption, const QByteArray &keyId) +/// \fn QXmppTrustStorage::trustLevel(const QString &encryption, const QString &keyOwnerJid, const QByteArray &keyId) /// /// Returns the trust level of a key. /// /// If the key is not stored, the trust in that key is undecided. /// /// \param encryption encryption protocol namespace +/// \param keyOwnerJid key owner's bare JID /// \param keyId ID of the key /// /// \return the key's trust level diff --git a/src/client/QXmppTrustStorage.h b/src/client/QXmppTrustStorage.h index dffbcfae..c1db773d 100644 --- a/src/client/QXmppTrustStorage.h +++ b/src/client/QXmppTrustStorage.h @@ -55,7 +55,7 @@ public: virtual QFuture<void> setTrustLevel(const QString &encryption, const QMultiHash<QString, QByteArray> &keyIds, TrustLevel trustLevel) = 0; virtual QFuture<void> setTrustLevel(const QString &encryption, const QList<QString> &keyOwnerJids, TrustLevel oldTrustLevel, TrustLevel newTrustLevel) = 0; - virtual QFuture<TrustLevel> trustLevel(const QString &encryption, const QByteArray &keyId) = 0; + virtual QFuture<TrustLevel> trustLevel(const QString &encryption, const QString &keyOwnerJid, const QByteArray &keyId) = 0; virtual QFuture<void> resetAll(const QString &encryption) = 0; }; |
