Add groupCallParticipant.is_hand_raised.

This commit is contained in:
levlam 2021-03-05 16:44:43 +03:00
parent 3bac31cc16
commit 5e5aa95060
3 changed files with 23 additions and 3 deletions

View File

@ -2139,6 +2139,7 @@ groupCallJoinResponse payload:groupCallPayload candidates:vector<groupCallJoinRe
//@source User's synchronization source
//@bio The participant user's bio or the participant chat's description
//@is_speaking True, if the participant is speaking as set by setGroupCallParticipantIsSpeaking
//@is_hand_raised True, if the participant hand is raised
//@can_be_muted_for_all_users True, if the current user can mute the participant for all other group call participants
//@can_be_unmuted_for_all_users True, if the current user can allow the participant to unmute themself or unmute the participant (if the participant is the current user)
//@can_be_muted_for_current_user True, if the current user can mute the participant only for self
@ -2148,7 +2149,7 @@ groupCallJoinResponse payload:groupCallPayload candidates:vector<groupCallJoinRe
//@can_unmute_self True, if the participant is muted for all users, but can unmute themself
//@volume_level Participant's volume level; 1-20000 in hundreds of percents
//@order User's order in the group call participant list. The bigger is order, the higher is user in the list. If order is 0, the user must be removed from the participant list
groupCallParticipant participant:MessageSender source:int32 bio:string is_speaking:Bool can_be_muted_for_all_users:Bool can_be_unmuted_for_all_users:Bool can_be_muted_for_current_user:Bool can_be_unmuted_for_current_user:Bool is_muted_for_all_users:Bool is_muted_for_current_user:Bool can_unmute_self:Bool volume_level:int32 order:int64 = GroupCallParticipant;
groupCallParticipant participant:MessageSender source:int32 bio:string is_speaking:Bool is_hand_raised:Bool can_be_muted_for_all_users:Bool can_be_unmuted_for_all_users:Bool can_be_muted_for_current_user:Bool can_be_unmuted_for_current_user:Bool is_muted_for_all_users:Bool is_muted_for_current_user:Bool can_unmute_self:Bool volume_level:int32 order:int64 = GroupCallParticipant;
//@class CallProblem @description Describes the exact type of a problem with a call

View File

@ -40,6 +40,9 @@ GroupCallParticipant::GroupCallParticipant(const tl_object_ptr<telegram_api::gro
joined_date = 0;
active_date = 0;
}
if ((participant->flags_ & 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<td_api::groupCallParticipant> GroupCallParticipant::get_group
return td_api::make_object<td_api::groupCallParticipant>(
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;
}

View File

@ -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<td_api::groupCallParticipant> get_group_call_participant_object(Td *td) const;
};