Add resetGroupCallInviteHash method.

This commit is contained in:
levlam 2021-03-12 18:58:43 +03:00
parent 9bfd98c08d
commit 73bed3ed80
6 changed files with 28 additions and 0 deletions

View File

@ -4579,6 +4579,10 @@ setGroupCallTitle group_call_id:int32 title:string = Ok;
//@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;
//@description Resets group call invite hash. Requires groupCall.can_be_managed group call flag
//@group_call_id Group call identifier
resetGroupCallInviteHash group_call_id:int32 = Ok;
//@description Invites users to a group call. Sends a service message of type messageInviteToGroupCall for voice chats
//@group_call_id Group call identifier @user_ids User identifiers. At most 10 users can be invited simultaneously
inviteGroupCallParticipants group_call_id:int32 user_ids:vector<int32> = Ok;

View File

@ -2264,6 +2264,18 @@ void GroupCallManager::on_toggle_group_call_mute_new_participants(InputGroupCall
}
}
void GroupCallManager::reset_group_call_invite_hash(GroupCallId group_call_id, 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) {
return promise.set_error(Status::Error(400, "Can't reset invite hash in the group call"));
}
int32 flags = telegram_api::phone_toggleGroupCallSettings::RESET_INVITE_HASH_MASK;
td_->create_handler<ToggleGroupCallSettingsQuery>(std::move(promise))->send(flags, input_group_call_id, false);
}
void GroupCallManager::invite_group_call_participants(GroupCallId group_call_id, vector<UserId> &&user_ids,
Promise<Unit> &&promise) {
TRY_RESULT_PROMISE(promise, input_group_call_id, get_input_group_call_id(group_call_id));

View File

@ -68,6 +68,8 @@ class GroupCallManager : public Actor {
void toggle_group_call_mute_new_participants(GroupCallId group_call_id, bool mute_new_participants,
Promise<Unit> &&promise);
void reset_group_call_invite_hash(GroupCallId group_call_id, Promise<Unit> &&promise);
void invite_group_call_participants(GroupCallId group_call_id, vector<UserId> &&user_ids, Promise<Unit> &&promise);
void toggle_group_call_recording(GroupCallId group_call_id, bool is_enabled, string title, Promise<Unit> &&promise);

View File

@ -6013,6 +6013,12 @@ void Td::on_request(uint64 id, const td_api::toggleGroupCallMuteNewParticipants
request.mute_new_participants_, std::move(promise));
}
void Td::on_request(uint64 id, const td_api::resetGroupCallInviteHash &request) {
CHECK_IS_USER();
CREATE_OK_REQUEST_PROMISE();
group_call_manager_->reset_group_call_invite_hash(GroupCallId(request.group_call_id_), std::move(promise));
}
void Td::on_request(uint64 id, const td_api::inviteGroupCallParticipants &request) {
CHECK_IS_USER();
CREATE_OK_REQUEST_PROMISE();

View File

@ -711,6 +711,8 @@ class Td final : public NetQueryCallback {
void on_request(uint64 id, const td_api::toggleGroupCallMuteNewParticipants &request);
void on_request(uint64 id, const td_api::resetGroupCallInviteHash &request);
void on_request(uint64 id, const td_api::inviteGroupCallParticipants &request);
void on_request(uint64 id, td_api::startGroupCallRecording &request);

View File

@ -2694,6 +2694,8 @@ class CliClient final : public Actor {
} else if (op == "tgcmnp" || op == "tgcmnpe") {
send_request(
td_api::make_object<td_api::toggleGroupCallMuteNewParticipants>(as_group_call_id(args), op == "tgcmnpe"));
} else if (op == "rgcih") {
send_request(td_api::make_object<td_api::resetGroupCallInviteHash>(as_group_call_id(args)));
} else if (op == "sgcpis") {
string group_call_id;
int32 source;