Make flag in td_api::groupCall more useful.

This commit is contained in:
levlam 2021-02-15 15:28:58 +03:00
parent c8157edf57
commit d519040cd9
3 changed files with 12 additions and 4 deletions

View File

@ -2104,9 +2104,9 @@ groupCallRecentSpeaker user_id:int32 is_speaking:Bool = GroupCallRecentSpeaker;
//@loaded_all_participants True, if all group call participants are loaded
//@recent_speakers Recently speaking users in the group call
//@mute_new_participants True, if only group call administrators can unmute new participants
//@allowed_change_mute_new_participants True, if group call administrators can enable or disable mute_new_participants setting
//@can_change_mute_new_participants True, if the current user can enable or disable mute_new_participants setting
//@duration Call duration; for ended calls only
groupCall id:int32 is_active:Bool is_joined:Bool need_rejoin:Bool can_unmute_self:Bool can_be_managed:Bool participant_count:int32 loaded_all_participants:Bool recent_speakers:vector<groupCallRecentSpeaker> mute_new_participants:Bool allowed_change_mute_new_participants:Bool duration:int32 = GroupCall;
groupCall id:int32 is_active:Bool is_joined:Bool need_rejoin:Bool can_unmute_self:Bool can_be_managed:Bool participant_count:int32 loaded_all_participants:Bool recent_speakers:vector<groupCallRecentSpeaker> mute_new_participants:Bool can_change_mute_new_participants:Bool duration:int32 = GroupCall;
//@description Describes a payload fingerprint for interaction with tgcalls @hash Value of the field hash @setup Value of the field setup @fingerprint Value of the field fingerprint
groupCallPayloadFingerprint hash:string setup:string fingerprint:string = GroupCallPayloadFingerprint;
@ -4455,7 +4455,7 @@ getGroupCall group_call_id:int32 = GroupCall;
//@description Joins a group call @group_call_id Group call identifier @payload Group join payload, received from tgcalls. Use null to cancel previous joinGroupCall request @source Caller synchronization source identifier; received from tgcalls @is_muted True, if the user's microphone is muted
joinGroupCall group_call_id:int32 payload:groupCallPayload source:int32 is_muted:Bool = GroupCallJoinResponse;
//@description Toggles whether new participants of a group call can be unmuted only by administrators of the group call. Requires groupCall.can_be_managed and allowed_change_mute_mew_participants group call flag
//@description Toggles whether new participants of a group call can be unmuted only by administrators of the group call. Requires groupCall.can_change_mute_new_participants group call flag
//@group_call_id Group call identifier @mute_new_participants New value of the mute_new_participants setting
toggleGroupCallMuteNewParticipants group_call_id:int32 mute_new_participants:Bool = Ok;

Binary file not shown.

View File

@ -1729,6 +1729,12 @@ void GroupCallManager::toggle_group_call_mute_new_participants(GroupCallId group
Promise<Unit> &&promise) {
TRY_RESULT_PROMISE(promise, input_group_call_id, get_input_group_call_id(group_call_id));
auto *group_call = get_group_call(input_group_call_id);
if (group_call == nullptr || !group_call->is_inited || !group_call->is_active || !group_call->can_be_managed ||
!group_call->allowed_change_mute_new_participants) {
return promise.set_error(Status::Error(400, "Can't change mute_new_participant setting"));
}
int32 flags = telegram_api::phone_toggleGroupCallSettings::JOIN_MUTED_MASK;
td_->create_handler<ToggleGroupCallSettingsQuery>(std::move(promise))
->send(flags, input_group_call_id, mute_new_participants);
@ -2502,11 +2508,13 @@ tl_object_ptr<td_api::groupCall> GroupCallManager::get_group_call_object(
bool is_joined = group_call->is_joined && !group_call->is_being_left;
bool can_self_unmute = is_joined && group_call->can_self_unmute;
bool can_change_mute_new_participants =
group_call->is_active && group_call->can_be_managed && group_call->allowed_change_mute_new_participants;
return td_api::make_object<td_api::groupCall>(group_call->group_call_id.get(), group_call->is_active, is_joined,
group_call->need_rejoin, can_self_unmute, group_call->can_be_managed,
group_call->participant_count, group_call->loaded_all_participants,
std::move(recent_speakers), group_call->mute_new_participants,
group_call->allowed_change_mute_new_participants, group_call->duration);
can_change_mute_new_participants, group_call->duration);
}
tl_object_ptr<td_api::updateGroupCall> GroupCallManager::get_update_group_call_object(