From a29f4b43d40508e3b384c797e55f3f499ac564e6 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 1 Feb 2021 02:43:23 +0300 Subject: [PATCH] Load even known group call participant after receiving typing from them. --- td/telegram/GroupCallManager.cpp | 14 +++++++++++++- td/telegram/GroupCallManager.h | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/td/telegram/GroupCallManager.cpp b/td/telegram/GroupCallManager.cpp index 16586f373..04f2aa958 100644 --- a/td/telegram/GroupCallManager.cpp +++ b/td/telegram/GroupCallManager.cpp @@ -967,6 +967,16 @@ GroupCallManager::GroupCallParticipants *GroupCallManager::add_group_call_partic return participants.get(); } +const GroupCallParticipant *GroupCallManager::get_group_call_participant( + const GroupCallParticipants *group_call_participants, UserId user_id) { + for (auto &group_call_participant : group_call_participants->participants) { + if (group_call_participant.user_id == user_id) { + return &group_call_participant; + } + } + return nullptr; +} + void GroupCallManager::on_update_group_call_participants( InputGroupCallId input_group_call_id, vector> &&participants, int32 version) { @@ -2114,7 +2124,9 @@ void GroupCallManager::on_user_speaking_in_group_call(GroupCallId group_call_id, return; } - if (!td_->contacts_manager_->have_user_force(user_id)) { + if (!td_->contacts_manager_->have_user_force(user_id) || + (!recursive && need_group_call_participants(input_group_call_id, group_call) && + get_group_call_participant(add_group_call_participants(input_group_call_id), user_id) == nullptr)) { if (recursive) { LOG(ERROR) << "Failed to find speaking " << user_id << " from " << input_group_call_id; } else { diff --git a/td/telegram/GroupCallManager.h b/td/telegram/GroupCallManager.h index 462f46427..c4c885838 100644 --- a/td/telegram/GroupCallManager.h +++ b/td/telegram/GroupCallManager.h @@ -167,6 +167,9 @@ class GroupCallManager : public Actor { GroupCallParticipants *add_group_call_participants(InputGroupCallId input_group_call_id); + const GroupCallParticipant *get_group_call_participant(const GroupCallParticipants *group_call_participants, + UserId user_id); + void on_group_call_left(InputGroupCallId input_group_call_id, int32 audio_source, bool need_rejoin); void on_group_call_left_impl(GroupCall *group_call, bool need_rejoin);