aboutsummaryrefslogtreecommitdiff
path: root/lib/connection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/connection.cpp')
-rw-r--r--lib/connection.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index d652c113..d7115885 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -456,7 +456,11 @@ void Connection::Private::completeSetup(const QString& mxId)
AccountSettings accountSettings(data->userId());
// init olmAccount
- olmAccount = std::make_unique<QOlmAccount>(data->userId(), data->deviceId());
+ olmAccount = std::make_unique<QOlmAccount>(data->userId(), data->deviceId(), q);
+ connect(olmAccount.get(), &QOlmAccount::needsSave, q, [=](){
+ auto pickle = olmAccount->pickle(Unencrypted{});
+ AccountSettings(data->userId()).setEncryptionAccountPickle(std::get<QByteArray>(pickle));
+ });
if (accountSettings.encryptionAccountPickle().isEmpty()) {
// create new account and save unpickle data
@@ -1283,7 +1287,7 @@ bool Connection::isLoggedIn() const { return !accessToken().isEmpty(); }
#ifdef Quotient_E2EE_ENABLED
QOlmAccount *Connection::olmAccount() const
{
- return d->olmAccount.get(); //d->encryptionManager->account();
+ return d->olmAccount.get();
}
#endif // Quotient_E2EE_ENABLED