mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Handle call updates only from the correct session.
This commit is contained in:
parent
d40768f6b0
commit
d773f2c765
2 changed files with 15 additions and 7 deletions
|
@ -301,7 +301,7 @@ void Instance::handleUpdate(
|
|||
update.match([&](const MTPDupdatePhoneCall &data) {
|
||||
handleCallUpdate(session, data.vphone_call());
|
||||
}, [&](const MTPDupdatePhoneCallSignalingData &data) {
|
||||
handleSignalingData(data);
|
||||
handleSignalingData(session, data);
|
||||
}, [&](const MTPDupdateGroupCall &data) {
|
||||
handleGroupCallUpdate(session, data.vcall());
|
||||
}, [&](const MTPDupdateGroupCallParticipants &data) {
|
||||
|
@ -379,7 +379,9 @@ void Instance::handleCallUpdate(
|
|||
createCall(user, Call::Type::Incoming, phoneCall.is_video());
|
||||
_currentCall->handleUpdate(call);
|
||||
}
|
||||
} else if (!_currentCall || !_currentCall->handleUpdate(call)) {
|
||||
} else if (!_currentCall
|
||||
|| (&_currentCall->user()->session() != session)
|
||||
|| !_currentCall->handleUpdate(call)) {
|
||||
DEBUG_LOG(("API Warning: unexpected phone call update %1").arg(call.type()));
|
||||
}
|
||||
}
|
||||
|
@ -393,7 +395,8 @@ void Instance::handleGroupCallUpdate(
|
|||
if (const auto existing = session->data().groupCall(callId)) {
|
||||
existing->applyUpdate(call);
|
||||
}
|
||||
if (_currentGroupCall) {
|
||||
if (_currentGroupCall
|
||||
&& (&_currentGroupCall->channel()->session() == session)) {
|
||||
_currentGroupCall->handleUpdate(call);
|
||||
}
|
||||
}
|
||||
|
@ -407,14 +410,18 @@ void Instance::handleGroupCallUpdate(
|
|||
if (const auto existing = session->data().groupCall(callId)) {
|
||||
existing->applyUpdate(update);
|
||||
}
|
||||
if (_currentGroupCall) {
|
||||
if (_currentGroupCall
|
||||
&& (&_currentGroupCall->channel()->session() == session)) {
|
||||
_currentGroupCall->handleUpdate(update);
|
||||
}
|
||||
}
|
||||
|
||||
void Instance::handleSignalingData(
|
||||
not_null<Main::Session*> session,
|
||||
const MTPDupdatePhoneCallSignalingData &data) {
|
||||
if (!_currentCall || !_currentCall->handleSignalingData(data)) {
|
||||
if (!_currentCall
|
||||
|| (&_currentCall->user()->session() != session)
|
||||
|| !_currentCall->handleSignalingData(data)) {
|
||||
DEBUG_LOG(("API Warning: unexpected call signaling data %1"
|
||||
).arg(data.vphone_call_id().v));
|
||||
}
|
||||
|
|
|
@ -92,8 +92,6 @@ private:
|
|||
void requestPermissionsOrFail(Fn<void()> onSuccess);
|
||||
void requestPermissionOrFail(Platform::PermissionType type, Fn<void()> onSuccess);
|
||||
|
||||
void handleSignalingData(const MTPDupdatePhoneCallSignalingData &data);
|
||||
|
||||
void refreshDhConfig();
|
||||
void refreshServerConfig(not_null<Main::Session*> session);
|
||||
bytes::const_span updateDhConfig(const MTPmessages_DhConfig &data);
|
||||
|
@ -104,6 +102,9 @@ private:
|
|||
void handleCallUpdate(
|
||||
not_null<Main::Session*> session,
|
||||
const MTPPhoneCall &call);
|
||||
void handleSignalingData(
|
||||
not_null<Main::Session*> session,
|
||||
const MTPDupdatePhoneCallSignalingData &data);
|
||||
void handleGroupCallUpdate(
|
||||
not_null<Main::Session*> session,
|
||||
const MTPGroupCall &call);
|
||||
|
|
Loading…
Add table
Reference in a new issue