2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Take main DC and phone prefix from active account.

This commit is contained in:
John Preston
2020-06-29 22:14:16 +04:00
parent eff340deaf
commit 90f7f482ee
5 changed files with 27 additions and 7 deletions

View File

@@ -219,7 +219,9 @@ not_null<Main::Account*> Domain::add(MTP::Environment environment) {
static const auto cloneConfig = [](const MTP::Config &config) {
return std::make_unique<MTP::Config>(config);
};
static const auto accountConfig = [](not_null<Account*> account) {
auto mainDcId = MTP::Instance::Fields::kNotSetMainDc;
const auto accountConfig = [&](not_null<Account*> account) {
mainDcId = account->mtp().mainDcId();
return cloneConfig(account->mtp().config());
};
auto config = [&] {
@@ -244,6 +246,7 @@ not_null<Main::Account*> Domain::add(MTP::Environment environment) {
.account = std::make_unique<Account>(this, _dataName, index)
});
const auto account = _accounts.back().account.get();
account->setMtpMainDcId(mainDcId);
_local->startAdded(account, std::move(config));
watchSession(account);
_accountsChanges.fire({});