tg_cli: add as_group_call_id.
This commit is contained in:
parent
f10db772f5
commit
daf93cd157
@ -311,7 +311,7 @@ void GroupCallManager::join_group_call(InputGroupCallId group_call_id,
|
||||
o("ssrc", source);
|
||||
}));
|
||||
|
||||
auto generation = join_group_request_generation_++;
|
||||
auto generation = ++join_group_request_generation_;
|
||||
auto &request = pending_join_requests_[group_call_id];
|
||||
request = make_unique<PendingJoinRequest>();
|
||||
request->generation = generation;
|
||||
@ -426,7 +426,7 @@ void GroupCallManager::on_join_group_call_response(InputGroupCallId group_call_i
|
||||
void GroupCallManager::finish_join_group_call(InputGroupCallId group_call_id, uint64 generation, Status error) {
|
||||
CHECK(error.is_error());
|
||||
auto it = pending_join_requests_.find(group_call_id);
|
||||
if (it == pending_join_requests_.end() || it->second->generation != generation) {
|
||||
if (it == pending_join_requests_.end() || (generation != 0 && it->second->generation != generation)) {
|
||||
return;
|
||||
}
|
||||
it->second->promise.set_error(std::move(error));
|
||||
@ -487,6 +487,7 @@ InputGroupCallId GroupCallManager::update_group_call(const tl_object_ptr<telegra
|
||||
auto group_call = static_cast<const telegram_api::groupCallDiscarded *>(group_call_ptr.get());
|
||||
call_id = InputGroupCallId(group_call->id_, group_call->access_hash_);
|
||||
call.duration = group_call->duration_;
|
||||
finish_join_group_call(call_id, 0, Status::Error(400, "Group call ended"));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -632,6 +632,10 @@ class CliClient final : public Actor {
|
||||
return to_integer<int32>(trim(std::move(str)));
|
||||
}
|
||||
|
||||
static string as_group_call_id(string str) {
|
||||
return trim(std::move(str));
|
||||
}
|
||||
|
||||
static int32 as_proxy_id(string str) {
|
||||
return to_integer<int32>(trim(std::move(str)));
|
||||
}
|
||||
@ -2841,20 +2845,22 @@ class CliClient final : public Actor {
|
||||
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>(
|
||||
args, td_api::make_object<td_api::groupCallPayload>("ufrag", "pwd", std::move(fingerprints)), 123, true));
|
||||
as_group_call_id(args),
|
||||
td_api::make_object<td_api::groupCallPayload>("ufrag", "pwd", std::move(fingerprints)), 123, true));
|
||||
} else if (op == "jgcc") {
|
||||
send_request(td_api::make_object<td_api::joinGroupCall>(args, nullptr, 123, true));
|
||||
send_request(td_api::make_object<td_api::joinGroupCall>(as_group_call_id(args), nullptr, 123, true));
|
||||
} else if (op == "tgcmnm" || op == "tgcmnme") {
|
||||
send_request(td_api::make_object<td_api::toggleGroupCallMuteNewMembers>(args, op == "tgcmnme"));
|
||||
send_request(td_api::make_object<td_api::toggleGroupCallMuteNewMembers>(as_group_call_id(args), op == "tgcmnme"));
|
||||
} else if (op == "igcm") {
|
||||
string group_call_id;
|
||||
string user_id;
|
||||
std::tie(group_call_id, user_id) = split(args);
|
||||
send_request(td_api::make_object<td_api::inviteGroupCallMember>(group_call_id, as_user_id(user_id)));
|
||||
send_request(
|
||||
td_api::make_object<td_api::inviteGroupCallMember>(as_group_call_id(group_call_id), as_user_id(user_id)));
|
||||
} else if (op == "lgc") {
|
||||
send_request(td_api::make_object<td_api::leaveGroupCall>(args, 123));
|
||||
send_request(td_api::make_object<td_api::leaveGroupCall>(as_group_call_id(args), 123));
|
||||
} else if (op == "dgc") {
|
||||
send_request(td_api::make_object<td_api::discardGroupCall>(args));
|
||||
send_request(td_api::make_object<td_api::discardGroupCall>(as_group_call_id(args)));
|
||||
} else if (op == "gcil") {
|
||||
send_request(td_api::make_object<td_api::generateChatInviteLink>(as_chat_id(args)));
|
||||
} else if (op == "ccil") {
|
||||
|
Loading…
Reference in New Issue
Block a user