From 5e5aa950606c7b0a8b28d995699ce4a92768c0b2 Mon Sep 17 00:00:00 2001 From: levlam Date: Fri, 5 Mar 2021 16:44:43 +0300 Subject: [PATCH] Add groupCallParticipant.is_hand_raised. --- td/generate/scheme/td_api.tl | 3 ++- td/telegram/GroupCallParticipant.cpp | 16 ++++++++++++++-- td/telegram/GroupCallParticipant.h | 7 +++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 22084f42d..cab850466 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -2139,6 +2139,7 @@ groupCallJoinResponse payload:groupCallPayload candidates:vectorflags_ & telegram_api::groupCallParticipant::RAISE_HAND_RATING_MASK) != 0) { + raise_hand_rating = participant->raise_hand_rating_; + } } is_just_joined = participant->just_joined_; is_min = participant->min_; @@ -69,6 +72,10 @@ int32 GroupCallParticipant::get_volume_level() const { return pending_volume_level != 0 ? pending_volume_level : volume_level; } +bool GroupCallParticipant::get_is_hand_raised() const { + return have_pending_is_hand_raised ? pending_is_hand_raised : raise_hand_rating != 0; +} + void GroupCallParticipant::update_from(const GroupCallParticipant &old_participant) { CHECK(!old_participant.is_min); if (joined_date < old_participant.joined_date) { @@ -102,6 +109,10 @@ void GroupCallParticipant::update_from(const GroupCallParticipant &old_participa pending_is_muted_by_admin = old_participant.pending_is_muted_by_admin; pending_is_muted_locally = old_participant.pending_is_muted_locally; pending_is_muted_generation = old_participant.pending_is_muted_generation; + + have_pending_is_hand_raised = old_participant.have_pending_is_hand_raised; + pending_is_hand_raised = old_participant.pending_is_hand_raised; + pending_is_hand_raised_generation = old_participant.pending_is_hand_raised_generation; } bool GroupCallParticipant::update_can_be_muted(bool can_manage, bool is_admin) { @@ -215,20 +226,21 @@ td_api::object_ptr GroupCallParticipant::get_group return td_api::make_object( td->messages_manager_->get_message_sender_object(dialog_id), audio_source, about, is_speaking, - can_be_muted_for_all_users, can_be_unmuted_for_all_users, can_be_muted_only_for_self, + get_is_hand_raised(), can_be_muted_for_all_users, can_be_unmuted_for_all_users, can_be_muted_only_for_self, can_be_unmuted_only_for_self, get_is_muted_for_all_users(), get_is_muted_locally(), get_is_muted_by_themselves(), get_volume_level(), order); } bool operator==(const GroupCallParticipant &lhs, const GroupCallParticipant &rhs) { return lhs.dialog_id == rhs.dialog_id && lhs.audio_source == rhs.audio_source && lhs.about == rhs.about && + lhs.is_speaking == rhs.is_speaking && lhs.get_is_hand_raised() == rhs.get_is_hand_raised() && lhs.can_be_muted_for_all_users == rhs.can_be_muted_for_all_users && lhs.can_be_unmuted_for_all_users == rhs.can_be_unmuted_for_all_users && lhs.can_be_muted_only_for_self == rhs.can_be_muted_only_for_self && lhs.can_be_unmuted_only_for_self == rhs.can_be_unmuted_only_for_self && lhs.get_is_muted_for_all_users() == rhs.get_is_muted_for_all_users() && lhs.get_is_muted_locally() == rhs.get_is_muted_locally() && - lhs.get_is_muted_by_themselves() == rhs.get_is_muted_by_themselves() && lhs.is_speaking == rhs.is_speaking && + lhs.get_is_muted_by_themselves() == rhs.get_is_muted_by_themselves() && lhs.get_volume_level() == rhs.get_volume_level() && lhs.order == rhs.order; } diff --git a/td/telegram/GroupCallParticipant.h b/td/telegram/GroupCallParticipant.h index 4dcc498a5..36fcd89ee 100644 --- a/td/telegram/GroupCallParticipant.h +++ b/td/telegram/GroupCallParticipant.h @@ -24,6 +24,7 @@ struct GroupCallParticipant { int32 joined_date = 0; int32 active_date = 0; int32 volume_level = 10000; + int64 raise_hand_rating = 0; bool is_volume_level_local = false; bool server_is_muted_by_themselves = false; bool server_is_muted_by_admin = false; @@ -51,6 +52,10 @@ struct GroupCallParticipant { bool pending_is_muted_locally = false; uint64 pending_is_muted_generation = 0; + bool have_pending_is_hand_raised = false; + bool pending_is_hand_raised = false; + uint64 pending_is_hand_raised_generation = 0; + static constexpr int32 MIN_VOLUME_LEVEL = 1; static constexpr int32 MAX_VOLUME_LEVEL = 20000; @@ -84,6 +89,8 @@ struct GroupCallParticipant { int32 get_volume_level() const; + bool get_is_hand_raised() const; + td_api::object_ptr get_group_call_participant_object(Td *td) const; };