aboutsummaryrefslogtreecommitdiff
path: root/lib/connection.cpp
diff options
context:
space:
mode:
authorAlexey Andreyev <aa13q@ya.ru>2019-08-14 12:43:22 +0300
committerAlexey Andreev <aa13q@ya.ru>2020-02-25 17:24:21 +0300
commit2de9cb11b4157eebacc3906df79a8d6d4fb43651 (patch)
treee6389e5c9d07ec9de93dfd470bbe619b826e9950 /lib/connection.cpp
parentd3ca82b9d7477a35e7580f2d6ce579dcbf791d07 (diff)
downloadlibquotient-2de9cb11b4157eebacc3906df79a8d6d4fb43651.tar.gz
libquotient-2de9cb11b4157eebacc3906df79a8d6d4fb43651.zip
E2EE: Fix EncryptionManager initialization place
Signed-off-by: Alexey Andreev <aa13q@ya.ru>
Diffstat (limited to 'lib/connection.cpp')
-rw-r--r--lib/connection.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index 5bddbb83..75c459d5 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -243,15 +243,6 @@ void Connection::doConnectToServer(const QString& user, const QString& password,
connect(loginJob, &BaseJob::success, this, [this, loginJob] {
d->connectWithToken(loginJob->userId(), loginJob->accessToken(),
loginJob->deviceId());
-
- AccountSettings accountSettings(loginJob->userId());
- d->encryptionManager.reset(
- new EncryptionManager(accountSettings.encryptionAccountPickle()));
- if (accountSettings.encryptionAccountPickle().isEmpty()) {
- accountSettings.setEncryptionAccountPickle(
- d->encryptionManager->olmAccountPickle());
- }
-
d->encryptionManager->uploadIdentityKeys(this);
d->encryptionManager->uploadOneTimeKeys(this);
});
@@ -309,6 +300,13 @@ void Connection::Private::connectWithToken(const QString& userId,
q->setObjectName(userId % '/' % deviceId);
qCDebug(MAIN) << "Using server" << data->baseUrl().toDisplayString()
<< "by user" << userId << "from device" << deviceId;
+ AccountSettings accountSettings(userId);
+ encryptionManager.reset(
+ new EncryptionManager(accountSettings.encryptionAccountPickle()));
+ if (accountSettings.encryptionAccountPickle().isEmpty()) {
+ accountSettings.setEncryptionAccountPickle(
+ encryptionManager->olmAccountPickle());
+ }
emit q->stateChanged();
emit q->connected();
q->reloadCapabilities();