aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTobias Fella <fella@posteo.de>2021-06-12 19:57:20 +0200
committerTobias Fella <fella@posteo.de>2021-12-01 21:56:11 +0100
commit46e7f0d69db376cf45b354fef69ecba1e4636805 (patch)
treea2e8b0b357ad81d8437e54b92bb1b918eed4abaf /lib
parentf89c05408bc9a4bf59366f92c50f055d527b9a28 (diff)
downloadlibquotient-46e7f0d69db376cf45b354fef69ecba1e4636805.tar.gz
libquotient-46e7f0d69db376cf45b354fef69ecba1e4636805.zip
Emit needsSave when required
Diffstat (limited to 'lib')
-rw-r--r--lib/connection.cpp3
-rw-r--r--lib/crypto/qolmaccount.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index ab5e030b..aaa17cdd 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -460,13 +460,12 @@ void Connection::Private::completeSetup(const QString& mxId)
connect(olmAccount.get(), &QOlmAccount::needsSave, q, [=](){
auto pickle = olmAccount->pickle(Unencrypted{});
AccountSettings(data->userId()).setEncryptionAccountPickle(std::get<QByteArray>(pickle));
+ //TODO handle errors
});
if (accountSettings.encryptionAccountPickle().isEmpty()) {
// create new account and save unpickle data
olmAccount->createNewAccount();
- accountSettings.setEncryptionAccountPickle(std::get<QByteArray>(olmAccount->pickle(Unencrypted{})));
- // TODO handle pickle errors
auto job = q->callApi<UploadKeysJob>(olmAccount->deviceKeys());
connect(job, &BaseJob::failure, q, [=]{
qCWarning(E2EE) << "Failed to upload device keys:" << job->errorString();
diff --git a/lib/crypto/qolmaccount.cpp b/lib/crypto/qolmaccount.cpp
index 44959ac2..3c1f4bd3 100644
--- a/lib/crypto/qolmaccount.cpp
+++ b/lib/crypto/qolmaccount.cpp
@@ -68,6 +68,7 @@ void QOlmAccount::createNewAccount()
if (error == olm_error()) {
throw lastError(m_account);
}
+ Q_EMIT needsSave();
}
void QOlmAccount::unpickle(QByteArray &pickled, const PicklingMode &mode)
@@ -218,6 +219,7 @@ std::optional<QOlmError> QOlmAccount::removeOneTimeKeys(const std::unique_ptr<QO
if (error == olm_error()) {
return lastError(m_account);
}
+ Q_EMIT needsSave();
return std::nullopt;
}
@@ -281,6 +283,7 @@ std::variant<std::unique_ptr<QOlmSession>, QOlmError> QOlmAccount::createOutboun
void QOlmAccount::markKeysAsPublished()
{
olm_account_mark_keys_as_published(m_account);
+ Q_EMIT needsSave();
}
bool Quotient::verifyIdentitySignature(const DeviceKeys &deviceKeys,