Add GroupCallParticipant::update_from method.
This commit is contained in:
parent
658db2defd
commit
c05ece2cb5
|
@ -1350,32 +1350,14 @@ int GroupCallManager::process_group_call_participant(InputGroupCallId input_grou
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (participant.joined_date < old_participant.joined_date) {
|
||||
LOG(ERROR) << "Join date of " << participant.user_id << " in " << input_group_call_id << " decreased from "
|
||||
<< old_participant.joined_date << " to " << participant.joined_date;
|
||||
participant.joined_date = old_participant.joined_date;
|
||||
}
|
||||
if (participant.active_date < old_participant.active_date) {
|
||||
participant.active_date = old_participant.active_date;
|
||||
}
|
||||
participant.local_active_date = old_participant.local_active_date;
|
||||
participant.is_speaking = old_participant.is_speaking;
|
||||
participant.update_from(old_participant);
|
||||
|
||||
participant.is_just_joined = false;
|
||||
auto real_order = participant.get_real_order();
|
||||
if (real_order >= participants->min_order) {
|
||||
participant.order = real_order;
|
||||
}
|
||||
participant.is_just_joined = false;
|
||||
if (participant.is_min) {
|
||||
participant.is_muted_only_for_self = old_participant.is_muted_only_for_self;
|
||||
}
|
||||
update_group_call_participant_can_be_muted(can_manage, participants, participant);
|
||||
if (old_participant.is_volume_level_local && !participant.is_volume_level_local) {
|
||||
participant.is_volume_level_local = true;
|
||||
participant.volume_level = old_participant.volume_level;
|
||||
}
|
||||
participant.pending_volume_level = old_participant.pending_volume_level;
|
||||
participant.pending_volume_level_generation = old_participant.pending_volume_level_generation;
|
||||
participant.is_min = false;
|
||||
|
||||
LOG(INFO) << "Edit " << old_participant << " to " << participant;
|
||||
if (old_participant != participant && (old_participant.order != 0 || participant.order != 0)) {
|
||||
|
|
|
@ -50,6 +50,29 @@ int32 GroupCallParticipant::get_volume_level() const {
|
|||
return pending_volume_level != 0 ? pending_volume_level : volume_level;
|
||||
}
|
||||
|
||||
void GroupCallParticipant::update_from(const GroupCallParticipant &old_participant) {
|
||||
CHECK(!old_participant.is_min);
|
||||
if (joined_date < old_participant.joined_date) {
|
||||
LOG(ERROR) << "Join date decreased from " << old_participant.joined_date << " to " << joined_date;
|
||||
joined_date = old_participant.joined_date;
|
||||
}
|
||||
if (active_date < old_participant.active_date) {
|
||||
active_date = old_participant.active_date;
|
||||
}
|
||||
local_active_date = old_participant.local_active_date;
|
||||
is_speaking = old_participant.is_speaking;
|
||||
if (is_min) {
|
||||
is_muted_only_for_self = old_participant.is_muted_only_for_self;
|
||||
}
|
||||
if (old_participant.is_volume_level_local && !is_volume_level_local) {
|
||||
is_volume_level_local = true;
|
||||
volume_level = old_participant.volume_level;
|
||||
}
|
||||
pending_volume_level = old_participant.pending_volume_level;
|
||||
pending_volume_level_generation = old_participant.pending_volume_level_generation;
|
||||
is_min = false;
|
||||
}
|
||||
|
||||
bool GroupCallParticipant::update_can_be_muted(bool can_manage, bool is_self, bool is_admin) {
|
||||
bool new_can_be_muted_for_all_users = false;
|
||||
bool new_can_be_unmuted_for_all_users = false;
|
||||
|
|
|
@ -51,6 +51,8 @@ struct GroupCallParticipant {
|
|||
|
||||
static bool is_versioned_update(const tl_object_ptr<telegram_api::groupCallParticipant> &participant);
|
||||
|
||||
void update_from(const GroupCallParticipant &old_participant);
|
||||
|
||||
bool update_can_be_muted(bool can_manage, bool is_self, bool is_admin);
|
||||
|
||||
int64 get_real_order() const {
|
||||
|
|
Loading…
Reference in New Issue
Block a user