aboutsummaryrefslogtreecommitdiff
path: root/src/client/QXmppAtmManager.cpp
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2021-12-05 16:22:22 +0100
committerLinus Jahn <lnj@kaidan.im>2022-03-03 13:32:37 +0100
commit4f77a9d91d5841771d27821ced76c7c6801790f5 (patch)
treedc4c7e8c72dd8eec466050d990c0a6e0dfb8be93 /src/client/QXmppAtmManager.cpp
parent447f4b27ef6c3f7120fe9f3a42290baa317471ca (diff)
downloadqxmpp-4f77a9d91d5841771d27821ced76c7c6801790f5.tar.gz
AtmManager: Minor clean up
Diffstat (limited to 'src/client/QXmppAtmManager.cpp')
-rw-r--r--src/client/QXmppAtmManager.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/client/QXmppAtmManager.cpp b/src/client/QXmppAtmManager.cpp
index fb20f922..829daa20 100644
--- a/src/client/QXmppAtmManager.cpp
+++ b/src/client/QXmppAtmManager.cpp
@@ -373,31 +373,31 @@ QFuture<void> QXmppAtmManager::handleMessage(const QXmppMessage &message)
///
QFuture<void> QXmppAtmManager::authenticate(const QString &encryption, const QMultiHash<QString, QByteArray> &keyIds)
{
+ if (keyIds.isEmpty()) {
+ return makeReadyFuture();
+ }
+
QFutureInterface<void> interface(QFutureInterfaceBase::Started);
- if (keyIds.isEmpty()) {
- interface.reportFinished();
- } else {
- auto future = m_trustStorage->setTrustLevel(encryption, keyIds, QXmppTrustStorage::Authenticated);
- await(future, this, [=]() mutable {
- await(m_trustStorage->securityPolicy(encryption), this, [=](const auto securityPolicy) mutable {
- if (securityPolicy == QXmppTrustStorage::Toakafa) {
- auto future = distrustAutomaticallyTrustedKeys(encryption, keyIds.uniqueKeys());
- await(future, this, [=]() mutable {
- auto future = makePostponedTrustDecisions(encryption, keyIds.values());
- await(future, this, [=]() mutable {
- interface.reportFinished();
- });
- });
- } else {
+ auto future = m_trustStorage->setTrustLevel(encryption, keyIds, QXmppTrustStorage::Authenticated);
+ await(future, this, [=]() mutable {
+ await(m_trustStorage->securityPolicy(encryption), this, [=](const auto securityPolicy) mutable {
+ if (securityPolicy == QXmppTrustStorage::Toakafa) {
+ auto future = distrustAutomaticallyTrustedKeys(encryption, keyIds.uniqueKeys());
+ await(future, this, [=]() mutable {
auto future = makePostponedTrustDecisions(encryption, keyIds.values());
await(future, this, [=]() mutable {
interface.reportFinished();
});
- }
- });
+ });
+ } else {
+ auto future = makePostponedTrustDecisions(encryption, keyIds.values());
+ await(future, this, [=]() mutable {
+ interface.reportFinished();
+ });
+ }
});
- }
+ });
return interface.future();
}
@@ -410,19 +410,19 @@ QFuture<void> QXmppAtmManager::authenticate(const QString &encryption, const QMu
///
QFuture<void> QXmppAtmManager::distrust(const QString &encryption, const QMultiHash<QString, QByteArray> &keyIds)
{
+ if (keyIds.isEmpty()) {
+ return makeReadyFuture();
+ }
+
QFutureInterface<void> interface(QFutureInterfaceBase::Started);
- if (keyIds.isEmpty()) {
- interface.reportFinished();
- } else {
- auto future = m_trustStorage->setTrustLevel(encryption, keyIds, QXmppTrustStorage::ManuallyDistrusted);
+ auto future = m_trustStorage->setTrustLevel(encryption, keyIds, QXmppTrustStorage::ManuallyDistrusted);
+ await(future, this, [=]() mutable {
+ auto future = m_trustStorage->removeKeysForPostponedTrustDecisions(encryption, keyIds.values());
await(future, this, [=]() mutable {
- auto future = m_trustStorage->removeKeysForPostponedTrustDecisions(encryption, keyIds.values());
- await(future, this, [=]() mutable {
- interface.reportFinished();
- });
+ interface.reportFinished();
});
- }
+ });
return interface.future();
}