mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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) {
|
update.match([&](const MTPDupdatePhoneCall &data) {
|
||||||
handleCallUpdate(session, data.vphone_call());
|
handleCallUpdate(session, data.vphone_call());
|
||||||
}, [&](const MTPDupdatePhoneCallSignalingData &data) {
|
}, [&](const MTPDupdatePhoneCallSignalingData &data) {
|
||||||
handleSignalingData(data);
|
handleSignalingData(session, data);
|
||||||
}, [&](const MTPDupdateGroupCall &data) {
|
}, [&](const MTPDupdateGroupCall &data) {
|
||||||
handleGroupCallUpdate(session, data.vcall());
|
handleGroupCallUpdate(session, data.vcall());
|
||||||
}, [&](const MTPDupdateGroupCallParticipants &data) {
|
}, [&](const MTPDupdateGroupCallParticipants &data) {
|
||||||
|
@ -379,7 +379,9 @@ void Instance::handleCallUpdate(
|
||||||
createCall(user, Call::Type::Incoming, phoneCall.is_video());
|
createCall(user, Call::Type::Incoming, phoneCall.is_video());
|
||||||
_currentCall->handleUpdate(call);
|
_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()));
|
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)) {
|
if (const auto existing = session->data().groupCall(callId)) {
|
||||||
existing->applyUpdate(call);
|
existing->applyUpdate(call);
|
||||||
}
|
}
|
||||||
if (_currentGroupCall) {
|
if (_currentGroupCall
|
||||||
|
&& (&_currentGroupCall->channel()->session() == session)) {
|
||||||
_currentGroupCall->handleUpdate(call);
|
_currentGroupCall->handleUpdate(call);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -407,14 +410,18 @@ void Instance::handleGroupCallUpdate(
|
||||||
if (const auto existing = session->data().groupCall(callId)) {
|
if (const auto existing = session->data().groupCall(callId)) {
|
||||||
existing->applyUpdate(update);
|
existing->applyUpdate(update);
|
||||||
}
|
}
|
||||||
if (_currentGroupCall) {
|
if (_currentGroupCall
|
||||||
|
&& (&_currentGroupCall->channel()->session() == session)) {
|
||||||
_currentGroupCall->handleUpdate(update);
|
_currentGroupCall->handleUpdate(update);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Instance::handleSignalingData(
|
void Instance::handleSignalingData(
|
||||||
|
not_null<Main::Session*> session,
|
||||||
const MTPDupdatePhoneCallSignalingData &data) {
|
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"
|
DEBUG_LOG(("API Warning: unexpected call signaling data %1"
|
||||||
).arg(data.vphone_call_id().v));
|
).arg(data.vphone_call_id().v));
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,8 +92,6 @@ private:
|
||||||
void requestPermissionsOrFail(Fn<void()> onSuccess);
|
void requestPermissionsOrFail(Fn<void()> onSuccess);
|
||||||
void requestPermissionOrFail(Platform::PermissionType type, Fn<void()> onSuccess);
|
void requestPermissionOrFail(Platform::PermissionType type, Fn<void()> onSuccess);
|
||||||
|
|
||||||
void handleSignalingData(const MTPDupdatePhoneCallSignalingData &data);
|
|
||||||
|
|
||||||
void refreshDhConfig();
|
void refreshDhConfig();
|
||||||
void refreshServerConfig(not_null<Main::Session*> session);
|
void refreshServerConfig(not_null<Main::Session*> session);
|
||||||
bytes::const_span updateDhConfig(const MTPmessages_DhConfig &data);
|
bytes::const_span updateDhConfig(const MTPmessages_DhConfig &data);
|
||||||
|
@ -104,6 +102,9 @@ private:
|
||||||
void handleCallUpdate(
|
void handleCallUpdate(
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
const MTPPhoneCall &call);
|
const MTPPhoneCall &call);
|
||||||
|
void handleSignalingData(
|
||||||
|
not_null<Main::Session*> session,
|
||||||
|
const MTPDupdatePhoneCallSignalingData &data);
|
||||||
void handleGroupCallUpdate(
|
void handleGroupCallUpdate(
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
const MTPGroupCall &call);
|
const MTPGroupCall &call);
|
||||||
|
|
Loading…
Add table
Reference in a new issue