mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-08 08:04:08 +02:00
Fix discarded group call handle.
This commit is contained in:
parent
9cfbccf9e7
commit
ba41da7b28
4 changed files with 27 additions and 11 deletions
|
@ -722,7 +722,8 @@ void GroupCall::handlePossibleCreateOrJoinResponse(
|
||||||
const MTPDupdateGroupCall &data) {
|
const MTPDupdateGroupCall &data) {
|
||||||
data.vcall().match([&](const MTPDgroupCall &data) {
|
data.vcall().match([&](const MTPDgroupCall &data) {
|
||||||
handlePossibleCreateOrJoinResponse(data);
|
handlePossibleCreateOrJoinResponse(data);
|
||||||
}, [](const MTPDgroupCallDiscarded &data) {
|
}, [&](const MTPDgroupCallDiscarded &data) {
|
||||||
|
handlePossibleDiscarded(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -815,6 +816,14 @@ void GroupCall::handlePossibleCreateOrJoinResponse(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GroupCall::handlePossibleDiscarded(const MTPDgroupCallDiscarded &data) {
|
||||||
|
if (data.vid().v == _id) {
|
||||||
|
LOG(("Call Info: Hangup after groupCallDiscarded."));
|
||||||
|
_mySsrc = 0;
|
||||||
|
hangup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GroupCall::addParticipantsToInstance() {
|
void GroupCall::addParticipantsToInstance() {
|
||||||
const auto real = _peer->groupCall();
|
const auto real = _peer->groupCall();
|
||||||
if (!real
|
if (!real
|
||||||
|
@ -869,10 +878,7 @@ void GroupCall::handleUpdate(const MTPUpdate &update) {
|
||||||
void GroupCall::handleUpdate(const MTPDupdateGroupCall &data) {
|
void GroupCall::handleUpdate(const MTPDupdateGroupCall &data) {
|
||||||
data.vcall().match([](const MTPDgroupCall &) {
|
data.vcall().match([](const MTPDgroupCall &) {
|
||||||
}, [&](const MTPDgroupCallDiscarded &data) {
|
}, [&](const MTPDgroupCallDiscarded &data) {
|
||||||
if (data.vid().v == _id) {
|
handlePossibleDiscarded(data);
|
||||||
_mySsrc = 0;
|
|
||||||
hangup();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1129,7 +1135,8 @@ void GroupCall::broadcastPartStart(std::shared_ptr<LoadPartTask> task) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}).fail([=](const MTP::Error &error, const MTP::Response &response) {
|
}).fail([=](const MTP::Error &error, const MTP::Response &response) {
|
||||||
if (error.type() == u"GROUPCALL_JOIN_MISSING"_q) {
|
if (error.type() == u"GROUPCALL_JOIN_MISSING"_q
|
||||||
|
|| error.type() == u"GROUPCALL_FORBIDDEN"_q) {
|
||||||
for (const auto &[task, part] : _broadcastParts) {
|
for (const auto &[task, part] : _broadcastParts) {
|
||||||
_api.request(part.requestId).cancel();
|
_api.request(part.requestId).cancel();
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,6 +228,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
void handlePossibleCreateOrJoinResponse(const MTPDgroupCall &data);
|
void handlePossibleCreateOrJoinResponse(const MTPDgroupCall &data);
|
||||||
|
void handlePossibleDiscarded(const MTPDgroupCallDiscarded &data);
|
||||||
void handleUpdate(const MTPDupdateGroupCall &data);
|
void handleUpdate(const MTPDupdateGroupCall &data);
|
||||||
void handleUpdate(const MTPDupdateGroupCallParticipants &data);
|
void handleUpdate(const MTPDupdateGroupCallParticipants &data);
|
||||||
void handleRequestError(const MTP::Error &error);
|
void handleRequestError(const MTP::Error &error);
|
||||||
|
|
|
@ -218,7 +218,7 @@ void GroupCall::enqueueUpdate(const MTPUpdate &update) {
|
||||||
_queuedUpdates.emplace(std::pair{ version, type }, update);
|
_queuedUpdates.emplace(std::pair{ version, type }, update);
|
||||||
}
|
}
|
||||||
}, [&](const MTPDgroupCallDiscarded &data) {
|
}, [&](const MTPDgroupCallDiscarded &data) {
|
||||||
discard();
|
discard(data);
|
||||||
});
|
});
|
||||||
}, [&](const MTPDupdateGroupCallParticipants &updateData) {
|
}, [&](const MTPDupdateGroupCallParticipants &updateData) {
|
||||||
const auto version = updateData.vversion().v;
|
const auto version = updateData.vversion().v;
|
||||||
|
@ -255,7 +255,7 @@ void GroupCall::enqueueUpdate(const MTPUpdate &update) {
|
||||||
processQueuedUpdates();
|
processQueuedUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupCall::discard() {
|
void GroupCall::discard(const MTPDgroupCallDiscarded &data) {
|
||||||
const auto id = _id;
|
const auto id = _id;
|
||||||
const auto peer = _peer;
|
const auto peer = _peer;
|
||||||
crl::on_main(&peer->session(), [=] {
|
crl::on_main(&peer->session(), [=] {
|
||||||
|
@ -267,6 +267,14 @@ void GroupCall::discard() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Core::App().calls().applyGroupCallUpdateChecked(
|
||||||
|
&peer->session(),
|
||||||
|
MTP_updateGroupCall(
|
||||||
|
MTP_int(peer->bareId()),
|
||||||
|
MTP_groupCallDiscarded(
|
||||||
|
data.vid(),
|
||||||
|
data.vaccess_hash(),
|
||||||
|
data.vduration())));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupCall::processFullCallUsersChats(const MTPphone_GroupCall &call) {
|
void GroupCall::processFullCallUsersChats(const MTPphone_GroupCall &call) {
|
||||||
|
@ -293,7 +301,7 @@ void GroupCall::processFullCallFields(const MTPphone_GroupCall &call) {
|
||||||
|
|
||||||
applyCallFields(data);
|
applyCallFields(data);
|
||||||
}, [&](const MTPDgroupCallDiscarded &data) {
|
}, [&](const MTPDgroupCallDiscarded &data) {
|
||||||
discard();
|
discard(data);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -343,7 +351,7 @@ void GroupCall::applyEnqueuedUpdate(const MTPUpdate &update) {
|
||||||
applyCallFields(data);
|
applyCallFields(data);
|
||||||
computeParticipantsCount();
|
computeParticipantsCount();
|
||||||
}, [&](const MTPDgroupCallDiscarded &data) {
|
}, [&](const MTPDgroupCallDiscarded &data) {
|
||||||
discard();
|
discard(data);
|
||||||
});
|
});
|
||||||
}, [&](const MTPDupdateGroupCallParticipants &data) {
|
}, [&](const MTPDupdateGroupCallParticipants &data) {
|
||||||
DEBUG_LOG(("Group Call Participants: "
|
DEBUG_LOG(("Group Call Participants: "
|
||||||
|
|
|
@ -120,7 +120,7 @@ private:
|
||||||
};
|
};
|
||||||
[[nodiscard]] ApiWrap &api() const;
|
[[nodiscard]] ApiWrap &api() const;
|
||||||
|
|
||||||
void discard();
|
void discard(const MTPDgroupCallDiscarded &data);
|
||||||
[[nodiscard]] bool inCall() const;
|
[[nodiscard]] bool inCall() const;
|
||||||
void applyParticipantsSlice(
|
void applyParticipantsSlice(
|
||||||
const QVector<MTPGroupCallParticipant> &list,
|
const QVector<MTPGroupCallParticipant> &list,
|
||||||
|
|
Loading…
Add table
Reference in a new issue