diff --git a/td/telegram/GroupCallManager.cpp b/td/telegram/GroupCallManager.cpp index 0dca4f85c..766a0a4b5 100644 --- a/td/telegram/GroupCallManager.cpp +++ b/td/telegram/GroupCallManager.cpp @@ -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(); 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(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: diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index 53df3a611..5a47f09a0 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -632,6 +632,10 @@ class CliClient final : public Actor { return to_integer(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(trim(std::move(str))); } @@ -2841,20 +2845,22 @@ class CliClient final : public Actor { fingerprints.push_back(td_api::make_object("hash", "setup", "fingerprint")); fingerprints.push_back(td_api::make_object("h2", "s2", "fingerprint2")); send_request(td_api::make_object( - args, td_api::make_object("ufrag", "pwd", std::move(fingerprints)), 123, true)); + as_group_call_id(args), + td_api::make_object("ufrag", "pwd", std::move(fingerprints)), 123, true)); } else if (op == "jgcc") { - send_request(td_api::make_object(args, nullptr, 123, true)); + send_request(td_api::make_object(as_group_call_id(args), nullptr, 123, true)); } else if (op == "tgcmnm" || op == "tgcmnme") { - send_request(td_api::make_object(args, op == "tgcmnme")); + send_request(td_api::make_object(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(group_call_id, as_user_id(user_id))); + send_request( + td_api::make_object(as_group_call_id(group_call_id), as_user_id(user_id))); } else if (op == "lgc") { - send_request(td_api::make_object(args, 123)); + send_request(td_api::make_object(as_group_call_id(args), 123)); } else if (op == "dgc") { - send_request(td_api::make_object(args)); + send_request(td_api::make_object(as_group_call_id(args))); } else if (op == "gcil") { send_request(td_api::make_object(as_chat_id(args))); } else if (op == "ccil") {