aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/connection.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index 9883b8f3..b91a1a90 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -110,6 +110,7 @@ public:
#ifdef Quotient_E2EE_ENABLED
std::unique_ptr<QOlmAccount> olmAccount;
//QScopedPointer<EncryptionManager> encryptionManager;
+ bool isUploadingKeys = false;
#endif // Quotient_E2EE_ENABLED
QPointer<GetWellknownJob> resolverJob = nullptr;
@@ -620,7 +621,8 @@ void Connection::onSyncSuccess(SyncData&& data, bool fromCache)
d->consumePresenceData(data.takePresenceData());
d->consumeToDeviceEvents(data.takeToDeviceEvents());
#ifdef Quotient_E2EE_ENABLED
- if(data.deviceOneTimeKeysCount()["signed_curve25519"] < 0.4 * d->olmAccount->maxNumberOfOneTimeKeys()) {
+ if(data.deviceOneTimeKeysCount()["signed_curve25519"] < 0.4 * d->olmAccount->maxNumberOfOneTimeKeys() && !d->isUploadingKeys) {
+ d->isUploadingKeys = true;
d->olmAccount->generateOneTimeKeys(d->olmAccount->maxNumberOfOneTimeKeys() - data.deviceOneTimeKeysCount()["signed_curve25519"]);
auto keys = d->olmAccount->oneTimeKeys();
auto job = d->olmAccount->createUploadKeyRequest(keys);
@@ -628,6 +630,9 @@ void Connection::onSyncSuccess(SyncData&& data, bool fromCache)
connect(job, &BaseJob::success, this, [=](){
d->olmAccount->markKeysAsPublished();
});
+ connect(job, &BaseJob::result, this, [=](){
+ d->isUploadingKeys = false;
+ });
}
#endif // Quotient_E2EE_ENABLED
}