Add version to GroupCallParticipant.
This commit is contained in:
parent
b6f900b74f
commit
6656cd29f9
@ -1148,7 +1148,11 @@ void GroupCallManager::finish_get_group_call(InputGroupCallId input_group_call_i
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto call = result.move_as_ok();
|
auto call = result.move_as_ok();
|
||||||
process_group_call_participants(input_group_call_id, std::move(call->participants_), string(), true, false);
|
int32 version = 0;
|
||||||
|
if (call->call_->get_id() == telegram_api::groupCall::ID) {
|
||||||
|
version = static_cast<const telegram_api::groupCall *>(call->call_.get())->version_;
|
||||||
|
}
|
||||||
|
process_group_call_participants(input_group_call_id, std::move(call->participants_), version, string(), true, false);
|
||||||
if (need_group_call_participants(input_group_call_id)) {
|
if (need_group_call_participants(input_group_call_id)) {
|
||||||
auto participants_it = group_call_participants_.find(input_group_call_id);
|
auto participants_it = group_call_participants_.find(input_group_call_id);
|
||||||
if (participants_it != group_call_participants_.end()) {
|
if (participants_it != group_call_participants_.end()) {
|
||||||
@ -1267,8 +1271,8 @@ void GroupCallManager::on_get_group_call_participants(
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto is_empty = participants->participants_.empty();
|
auto is_empty = participants->participants_.empty();
|
||||||
process_group_call_participants(input_group_call_id, std::move(participants->participants_), offset, is_load,
|
process_group_call_participants(input_group_call_id, std::move(participants->participants_), participants->version_,
|
||||||
is_sync);
|
offset, is_load, is_sync);
|
||||||
|
|
||||||
if (!is_sync) {
|
if (!is_sync) {
|
||||||
on_receive_group_call_version(input_group_call_id, participants->version_);
|
on_receive_group_call_version(input_group_call_id, participants->version_);
|
||||||
@ -1380,7 +1384,7 @@ void GroupCallManager::on_update_group_call_participants(
|
|||||||
bool need_update = false;
|
bool need_update = false;
|
||||||
auto group_call = get_group_call(input_group_call_id);
|
auto group_call = get_group_call(input_group_call_id);
|
||||||
for (auto &group_call_participant : participants) {
|
for (auto &group_call_participant : participants) {
|
||||||
GroupCallParticipant participant(group_call_participant);
|
GroupCallParticipant participant(group_call_participant, version);
|
||||||
if (!participant.is_valid()) {
|
if (!participant.is_valid()) {
|
||||||
LOG(ERROR) << "Receive invalid " << to_string(group_call_participant);
|
LOG(ERROR) << "Receive invalid " << to_string(group_call_participant);
|
||||||
continue;
|
continue;
|
||||||
@ -1425,7 +1429,7 @@ void GroupCallManager::on_update_group_call_participants(
|
|||||||
if (!is_recursive) {
|
if (!is_recursive) {
|
||||||
vector<DialogId> missing_participants;
|
vector<DialogId> missing_participants;
|
||||||
for (auto &group_call_participant : participants) {
|
for (auto &group_call_participant : participants) {
|
||||||
GroupCallParticipant participant(group_call_participant);
|
GroupCallParticipant participant(group_call_participant, version);
|
||||||
if (participant.is_valid() && participant.is_min && participant.joined_date != 0 &&
|
if (participant.is_valid() && participant.is_min && participant.joined_date != 0 &&
|
||||||
get_group_call_participant(group_call_participants, participant.dialog_id) == nullptr) {
|
get_group_call_participant(group_call_participants, participant.dialog_id) == nullptr) {
|
||||||
missing_participants.push_back(participant.dialog_id);
|
missing_participants.push_back(participant.dialog_id);
|
||||||
@ -1448,7 +1452,7 @@ void GroupCallManager::on_update_group_call_participants(
|
|||||||
auto &pending_version_updates = group_call_participants->pending_version_updates_[version].updates;
|
auto &pending_version_updates = group_call_participants->pending_version_updates_[version].updates;
|
||||||
auto &pending_mute_updates = group_call_participants->pending_mute_updates_[version].updates;
|
auto &pending_mute_updates = group_call_participants->pending_mute_updates_[version].updates;
|
||||||
for (auto &group_call_participant : participants) {
|
for (auto &group_call_participant : participants) {
|
||||||
GroupCallParticipant participant(group_call_participant);
|
GroupCallParticipant participant(group_call_participant, version);
|
||||||
if (!participant.is_valid()) {
|
if (!participant.is_valid()) {
|
||||||
LOG(ERROR) << "Receive invalid " << to_string(group_call_participant);
|
LOG(ERROR) << "Receive invalid " << to_string(group_call_participant);
|
||||||
continue;
|
continue;
|
||||||
@ -1644,9 +1648,9 @@ GroupCallParticipantOrder GroupCallManager::get_real_participant_order(
|
|||||||
|
|
||||||
void GroupCallManager::process_group_call_participants(
|
void GroupCallManager::process_group_call_participants(
|
||||||
InputGroupCallId input_group_call_id, vector<tl_object_ptr<telegram_api::groupCallParticipant>> &&participants,
|
InputGroupCallId input_group_call_id, vector<tl_object_ptr<telegram_api::groupCallParticipant>> &&participants,
|
||||||
const string &offset, bool is_load, bool is_sync) {
|
int32 version, const string &offset, bool is_load, bool is_sync) {
|
||||||
if (offset.empty() && is_load && !participants.empty() && participants[0]->self_) {
|
if (offset.empty() && is_load && !participants.empty() && participants[0]->self_) {
|
||||||
GroupCallParticipant participant(participants[0]);
|
GroupCallParticipant participant(participants[0], version);
|
||||||
if (participant.is_valid()) {
|
if (participant.is_valid()) {
|
||||||
process_my_group_call_participant(input_group_call_id, std::move(participant));
|
process_my_group_call_participant(input_group_call_id, std::move(participant));
|
||||||
}
|
}
|
||||||
@ -1654,7 +1658,7 @@ void GroupCallManager::process_group_call_participants(
|
|||||||
}
|
}
|
||||||
if (!need_group_call_participants(input_group_call_id)) {
|
if (!need_group_call_participants(input_group_call_id)) {
|
||||||
for (auto &group_call_participant : participants) {
|
for (auto &group_call_participant : participants) {
|
||||||
GroupCallParticipant participant(group_call_participant);
|
GroupCallParticipant participant(group_call_participant, version);
|
||||||
if (!participant.is_valid()) {
|
if (!participant.is_valid()) {
|
||||||
LOG(ERROR) << "Receive invalid " << to_string(group_call_participant);
|
LOG(ERROR) << "Receive invalid " << to_string(group_call_participant);
|
||||||
continue;
|
continue;
|
||||||
@ -1684,7 +1688,7 @@ void GroupCallManager::process_group_call_participants(
|
|||||||
bool can_manage = can_manage_group_call(input_group_call_id);
|
bool can_manage = can_manage_group_call(input_group_call_id);
|
||||||
bool joined_date_asc = get_group_call_joined_date_asc(input_group_call_id);
|
bool joined_date_asc = get_group_call_joined_date_asc(input_group_call_id);
|
||||||
for (auto &group_call_participant : participants) {
|
for (auto &group_call_participant : participants) {
|
||||||
GroupCallParticipant participant(group_call_participant);
|
GroupCallParticipant participant(group_call_participant, version);
|
||||||
if (!participant.is_valid()) {
|
if (!participant.is_valid()) {
|
||||||
LOG(ERROR) << "Receive invalid " << to_string(group_call_participant);
|
LOG(ERROR) << "Receive invalid " << to_string(group_call_participant);
|
||||||
continue;
|
continue;
|
||||||
|
@ -197,7 +197,7 @@ class GroupCallManager : public Actor {
|
|||||||
|
|
||||||
void process_group_call_participants(InputGroupCallId group_call_id,
|
void process_group_call_participants(InputGroupCallId group_call_id,
|
||||||
vector<tl_object_ptr<telegram_api::groupCallParticipant>> &&participants,
|
vector<tl_object_ptr<telegram_api::groupCallParticipant>> &&participants,
|
||||||
const string &offset, bool is_load, bool is_sync);
|
int32 version, const string &offset, bool is_load, bool is_sync);
|
||||||
|
|
||||||
bool update_group_call_participant_can_be_muted(bool can_manage, const GroupCallParticipants *participants,
|
bool update_group_call_participant_can_be_muted(bool can_manage, const GroupCallParticipants *participants,
|
||||||
GroupCallParticipant &participant);
|
GroupCallParticipant &participant);
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
|
||||||
GroupCallParticipant::GroupCallParticipant(const tl_object_ptr<telegram_api::groupCallParticipant> &participant) {
|
GroupCallParticipant::GroupCallParticipant(const tl_object_ptr<telegram_api::groupCallParticipant> &participant,
|
||||||
|
int32 call_version) {
|
||||||
CHECK(participant != nullptr);
|
CHECK(participant != nullptr);
|
||||||
dialog_id = DialogId(participant->peer_);
|
dialog_id = DialogId(participant->peer_);
|
||||||
about = std::move(participant->about_);
|
about = std::move(participant->about_);
|
||||||
@ -51,6 +52,7 @@ GroupCallParticipant::GroupCallParticipant(const tl_object_ptr<telegram_api::gro
|
|||||||
}
|
}
|
||||||
is_just_joined = participant->just_joined_;
|
is_just_joined = participant->just_joined_;
|
||||||
is_min = participant->min_;
|
is_min = participant->min_;
|
||||||
|
version = call_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GroupCallParticipant::is_versioned_update(const tl_object_ptr<telegram_api::groupCallParticipant> &participant) {
|
bool GroupCallParticipant::is_versioned_update(const tl_object_ptr<telegram_api::groupCallParticipant> &participant) {
|
||||||
|
@ -43,6 +43,7 @@ struct GroupCallParticipant {
|
|||||||
bool is_speaking = false;
|
bool is_speaking = false;
|
||||||
int32 local_active_date = 0;
|
int32 local_active_date = 0;
|
||||||
GroupCallParticipantOrder order;
|
GroupCallParticipantOrder order;
|
||||||
|
int32 version = 0;
|
||||||
|
|
||||||
int32 pending_volume_level = 0;
|
int32 pending_volume_level = 0;
|
||||||
uint64 pending_volume_level_generation = 0;
|
uint64 pending_volume_level_generation = 0;
|
||||||
@ -62,7 +63,7 @@ struct GroupCallParticipant {
|
|||||||
|
|
||||||
GroupCallParticipant() = default;
|
GroupCallParticipant() = default;
|
||||||
|
|
||||||
explicit GroupCallParticipant(const tl_object_ptr<telegram_api::groupCallParticipant> &participant);
|
GroupCallParticipant(const tl_object_ptr<telegram_api::groupCallParticipant> &participant, int32 call_version);
|
||||||
|
|
||||||
static bool is_versioned_update(const tl_object_ptr<telegram_api::groupCallParticipant> &participant);
|
static bool is_versioned_update(const tl_object_ptr<telegram_api::groupCallParticipant> &participant);
|
||||||
|
|
||||||
|
@ -31573,7 +31573,7 @@ tl_object_ptr<td_api::ChatEventAction> MessagesManager::get_chat_event_action_ob
|
|||||||
}
|
}
|
||||||
case telegram_api::channelAdminLogEventActionParticipantMute::ID: {
|
case telegram_api::channelAdminLogEventActionParticipantMute::ID: {
|
||||||
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionParticipantMute>(action_ptr);
|
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionParticipantMute>(action_ptr);
|
||||||
GroupCallParticipant participant(std::move(action->participant_));
|
GroupCallParticipant participant(std::move(action->participant_), 0);
|
||||||
if (!participant.is_valid()) {
|
if (!participant.is_valid()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -31582,7 +31582,7 @@ tl_object_ptr<td_api::ChatEventAction> MessagesManager::get_chat_event_action_ob
|
|||||||
}
|
}
|
||||||
case telegram_api::channelAdminLogEventActionParticipantUnmute::ID: {
|
case telegram_api::channelAdminLogEventActionParticipantUnmute::ID: {
|
||||||
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionParticipantUnmute>(action_ptr);
|
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionParticipantUnmute>(action_ptr);
|
||||||
GroupCallParticipant participant(std::move(action->participant_));
|
GroupCallParticipant participant(std::move(action->participant_), 0);
|
||||||
if (!participant.is_valid()) {
|
if (!participant.is_valid()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -31591,7 +31591,7 @@ tl_object_ptr<td_api::ChatEventAction> MessagesManager::get_chat_event_action_ob
|
|||||||
}
|
}
|
||||||
case telegram_api::channelAdminLogEventActionParticipantVolume::ID: {
|
case telegram_api::channelAdminLogEventActionParticipantVolume::ID: {
|
||||||
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionParticipantVolume>(action_ptr);
|
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionParticipantVolume>(action_ptr);
|
||||||
GroupCallParticipant participant(std::move(action->participant_));
|
GroupCallParticipant participant(std::move(action->participant_), 0);
|
||||||
if (!participant.is_valid()) {
|
if (!participant.is_valid()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user