Add joinGroupCall.invite_hash.
This commit is contained in:
parent
0fb6c52cd4
commit
9bfd98c08d
@ -4569,7 +4569,8 @@ getGroupCall group_call_id:int32 = GroupCall;
|
||||
//@payload Group join payload; received from tgcalls
|
||||
//@source Caller synchronization source identifier; received from tgcalls
|
||||
//@is_muted True, if the user's microphone is muted
|
||||
joinGroupCall group_call_id:int32 participant_alias:MessageSender payload:groupCallPayload source:int32 is_muted:Bool = GroupCallJoinResponse;
|
||||
//@invite_hash If non-empty, invite hash to be used to join the group call without being muted by administrators
|
||||
joinGroupCall group_call_id:int32 participant_alias:MessageSender payload:groupCallPayload source:int32 is_muted:Bool invite_hash:string = GroupCallJoinResponse;
|
||||
|
||||
//@description Sets group call title. Requires groupCall.can_be_managed group call flag @group_call_id Group call identifier @title New group call title; 1-128 characters
|
||||
setGroupCallTitle group_call_id:int32 title:string = Ok;
|
||||
|
@ -283,7 +283,7 @@ class JoinGroupCallQuery : public Td::ResultHandler {
|
||||
}
|
||||
|
||||
NetQueryRef send(InputGroupCallId input_group_call_id, DialogId as_dialog_id, const string &payload, bool is_muted,
|
||||
uint64 generation) {
|
||||
const string &invite_hash, uint64 generation) {
|
||||
input_group_call_id_ = input_group_call_id;
|
||||
as_dialog_id_ = as_dialog_id;
|
||||
generation_ = generation;
|
||||
@ -300,9 +300,12 @@ class JoinGroupCallQuery : public Td::ResultHandler {
|
||||
if (is_muted) {
|
||||
flags |= telegram_api::phone_joinGroupCall::MUTED_MASK;
|
||||
}
|
||||
if (!invite_hash.empty()) {
|
||||
flags |= telegram_api::phone_joinGroupCall::INVITE_HASH_MASK;
|
||||
}
|
||||
auto query = G()->net_query_creator().create(telegram_api::phone_joinGroupCall(
|
||||
flags, false /*ignored*/, input_group_call_id.get_input_group_call(), std::move(join_as_input_peer), string(),
|
||||
make_tl_object<telegram_api::dataJSON>(payload)));
|
||||
flags, false /*ignored*/, input_group_call_id.get_input_group_call(), std::move(join_as_input_peer),
|
||||
invite_hash, make_tl_object<telegram_api::dataJSON>(payload)));
|
||||
auto join_query_ref = query.get_weak();
|
||||
send_query(std::move(query));
|
||||
return join_query_ref;
|
||||
@ -1766,7 +1769,7 @@ void GroupCallManager::get_group_call_stream_segment(GroupCallId group_call_id,
|
||||
|
||||
void GroupCallManager::join_group_call(GroupCallId group_call_id, DialogId as_dialog_id,
|
||||
td_api::object_ptr<td_api::groupCallPayload> &&payload, int32 audio_source,
|
||||
bool is_muted,
|
||||
bool is_muted, const string &invite_hash,
|
||||
Promise<td_api::object_ptr<td_api::groupCallJoinResponse>> &&promise) {
|
||||
TRY_RESULT_PROMISE(promise, input_group_call_id, get_input_group_call_id(group_call_id));
|
||||
|
||||
@ -1871,7 +1874,7 @@ void GroupCallManager::join_group_call(GroupCallId group_call_id, DialogId as_di
|
||||
result.move_as_error());
|
||||
});
|
||||
request->query_ref = td_->create_handler<JoinGroupCallQuery>(std::move(query_promise))
|
||||
->send(input_group_call_id, as_dialog_id, json_payload, is_muted, generation);
|
||||
->send(input_group_call_id, as_dialog_id, json_payload, is_muted, invite_hash, generation);
|
||||
|
||||
if (group_call->dialog_id.is_valid()) {
|
||||
td_->messages_manager_->on_update_dialog_default_join_group_call_as_dialog_id(group_call->dialog_id, as_dialog_id,
|
||||
@ -2133,6 +2136,11 @@ void GroupCallManager::set_group_call_title(GroupCallId group_call_id, string ti
|
||||
return promise.set_error(Status::Error(400, "Can't change group call title"));
|
||||
}
|
||||
|
||||
title = clean_name(title, MAX_TITLE_LENGTH);
|
||||
if (title.empty()) {
|
||||
return promise.set_error(Status::Error(3, "Title can't be empty"));
|
||||
}
|
||||
|
||||
if (title == get_group_call_title(group_call)) {
|
||||
return promise.set_value(Unit());
|
||||
}
|
||||
@ -2291,6 +2299,8 @@ void GroupCallManager::toggle_group_call_recording(GroupCallId group_call_id, bo
|
||||
return promise.set_error(Status::Error(400, "Can't manage group call recording"));
|
||||
}
|
||||
|
||||
title = clean_name(title, MAX_TITLE_LENGTH);
|
||||
|
||||
if (is_enabled == get_group_call_has_recording(group_call)) {
|
||||
return promise.set_value(Unit());
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ class GroupCallManager : public Actor {
|
||||
|
||||
void join_group_call(GroupCallId group_call_id, DialogId as_dialog_id,
|
||||
td_api::object_ptr<td_api::groupCallPayload> &&payload, int32 audio_source, bool is_muted,
|
||||
Promise<td_api::object_ptr<td_api::groupCallJoinResponse>> &&promise);
|
||||
const string &invite_hash, Promise<td_api::object_ptr<td_api::groupCallJoinResponse>> &&promise);
|
||||
|
||||
void set_group_call_title(GroupCallId group_call_id, string title, Promise<Unit> &&promise);
|
||||
|
||||
@ -113,6 +113,7 @@ class GroupCallManager : public Actor {
|
||||
|
||||
static constexpr int32 RECENT_SPEAKER_TIMEOUT = 60 * 60;
|
||||
static constexpr int32 CHECK_GROUP_CALL_IS_JOINED_TIMEOUT = 10;
|
||||
static constexpr size_t MAX_TITLE_LENGTH = 128; // server side limit for group call/group call record title
|
||||
|
||||
void tear_down() override;
|
||||
|
||||
|
@ -5990,11 +5990,12 @@ void Td::on_request(uint64 id, const td_api::getGroupCall &request) {
|
||||
|
||||
void Td::on_request(uint64 id, td_api::joinGroupCall &request) {
|
||||
CHECK_IS_USER();
|
||||
CLEAN_INPUT_STRING(request.invite_hash_);
|
||||
CREATE_REQUEST_PROMISE();
|
||||
group_call_manager_->join_group_call(GroupCallId(request.group_call_id_),
|
||||
group_call_manager_->get_group_call_participant_id(request.participant_alias_),
|
||||
std::move(request.payload_), request.source_, request.is_muted_,
|
||||
std::move(promise));
|
||||
request.invite_hash_, std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::setGroupCallTitle &request) {
|
||||
|
@ -2677,16 +2677,15 @@ class CliClient final : public Actor {
|
||||
} else if (op == "jgc") {
|
||||
string group_call_id;
|
||||
string participant_alias;
|
||||
get_args(args, group_call_id, participant_alias);
|
||||
string invite_hash;
|
||||
get_args(args, group_call_id, participant_alias, invite_hash);
|
||||
vector<td_api::object_ptr<td_api::groupCallPayloadFingerprint>> fingerprints;
|
||||
fingerprints.push_back(td_api::make_object<td_api::groupCallPayloadFingerprint>("hash", "setup", "fingerprint"));
|
||||
fingerprints.push_back(td_api::make_object<td_api::groupCallPayloadFingerprint>("h2", "s2", "fingerprint2"));
|
||||
send_request(td_api::make_object<td_api::joinGroupCall>(
|
||||
as_group_call_id(group_call_id), as_message_sender(participant_alias),
|
||||
td_api::make_object<td_api::groupCallPayload>("ufrag", "pwd", std::move(fingerprints)), group_call_source_,
|
||||
true));
|
||||
} else if (op == "jgcc") {
|
||||
send_request(td_api::make_object<td_api::joinGroupCall>(as_group_call_id(args), nullptr, nullptr, 0, true));
|
||||
true, invite_hash));
|
||||
} else if (op == "sgct") {
|
||||
string chat_id;
|
||||
string title;
|
||||
|
Loading…
Reference in New Issue
Block a user