Update recent speakers by updateGroupParticipants.

This commit is contained in:
levlam 2020-12-15 14:54:47 +03:00
parent db99c9817d
commit 1c02363418
2 changed files with 19 additions and 0 deletions

View File

@ -1106,6 +1106,7 @@ int GroupCallManager::process_group_call_participant(InputGroupCallId input_grou
if (need_update) {
send_update_group_call_participant(input_group_call_id, old_participant);
}
on_participant_speaking_in_group_call(input_group_call_id, participant);
}
return 0;
}
@ -1128,6 +1129,7 @@ int GroupCallManager::process_group_call_participant(InputGroupCallId input_grou
if (participants->participants.back().order != 0) {
send_update_group_call_participant(input_group_call_id, participants->participants.back());
}
on_participant_speaking_in_group_call(input_group_call_id, participants->participants.back());
return diff;
}
@ -1694,6 +1696,20 @@ void GroupCallManager::on_receive_group_call_version(InputGroupCallId input_grou
sync_participants_timeout_.add_timeout_in(group_call->group_call_id.get(), 1.0);
}
void GroupCallManager::on_participant_speaking_in_group_call(InputGroupCallId input_group_call_id,
const GroupCallParticipant &participant) {
if (participant.active_date < G()->unix_time() - RECENT_SPEAKER_TIMEOUT) {
return;
}
auto *group_call = get_group_call(input_group_call_id);
if (group_call == nullptr) {
return;
}
on_user_speaking_in_group_call(group_call->group_call_id, participant.user_id, participant.active_date, true);
}
void GroupCallManager::on_user_speaking_in_group_call(GroupCallId group_call_id, UserId user_id, int32 date,
bool recursive) {
if (G()->close_flag()) {

View File

@ -144,6 +144,9 @@ class GroupCallManager : public Actor {
void on_receive_group_call_version(InputGroupCallId input_group_call_id, int32 version);
void on_participant_speaking_in_group_call(InputGroupCallId input_group_call_id,
const GroupCallParticipant &participant);
void remove_recent_group_call_speaker(InputGroupCallId input_group_call_id, UserId user_id);
void on_group_call_recent_speakers_updated(const GroupCall *group_call, GroupCallRecentSpeakers *recent_speakers);