2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Implement fast confcall migration.

This commit is contained in:
John Preston
2025-04-09 14:18:14 +04:00
parent 2a7aac76d9
commit c72cf46db7
13 changed files with 366 additions and 191 deletions

View File

@@ -1159,6 +1159,36 @@ std::shared_ptr<GroupCall> Session::sharedConferenceCall(
return result;
}
std::shared_ptr<GroupCall> Session::sharedConferenceCallFind(
const MTPUpdates &response) {
const auto list = response.match([&](const MTPDupdates &data) {
return &data.vupdates().v;
}, [&](const MTPDupdatesCombined &data) {
return &data.vupdates().v;
}, [](const auto &) {
return (const QVector<MTPUpdate>*)nullptr;
});
const auto empty = std::shared_ptr<GroupCall>();
if (!list) {
return empty;
}
for (const auto &update : *list) {
const auto call = update.match([&](const MTPDupdateGroupCall &data) {
return data.vcall().match([&](const MTPDgroupCall &data) {
return data.is_conference()
? sharedConferenceCall(
data.vid().v,
data.vaccess_hash().v)
: nullptr;
}, [&](const auto &) { return empty; });
}, [&](const auto &) { return empty; });
if (call) {
return call;
}
}
return empty;
}
void Session::watchForOffline(not_null<UserData*> user, TimeId now) {
if (!now) {
now = base::unixtime::now();