Update layer to 129.

This commit is contained in:
levlam 2021-04-30 17:07:01 +03:00
parent daef481ac0
commit d8b905a986
9 changed files with 70 additions and 43 deletions

View File

@ -346,7 +346,7 @@ updateDeleteScheduledMessages#90866cee peer:Peer messages:Vector<int> = Update;
updateTheme#8216fba3 theme:Theme = Update;
updateGeoLiveViewed#871fb939 peer:Peer msg_id:int = Update;
updateLoginToken#564fe691 = Update;
updateMessagePollVote#42f88f2c poll_id:long user_id:int options:Vector<bytes> = Update;
updateMessagePollVote#37f69f0b poll_id:long user_id:int options:Vector<bytes> qts:int = Update;
updateDialogFilter#26ffde7d flags:# id:int filter:flags.0?DialogFilter = Update;
updateDialogFilterOrder#a5d72105 order:Vector<int> = Update;
updateDialogFilters#3504914f = Update;
@ -365,6 +365,7 @@ updatePeerHistoryTTL#bb9bb9a5 flags:# peer:Peer ttl_period:flags.0?int = Update;
updateChatParticipant#f3b3781f flags:# chat_id:int date:int actor_id:int user_id:int prev_participant:flags.0?ChatParticipant new_participant:flags.1?ChatParticipant invite:flags.2?ExportedChatInvite qts:int = Update;
updateChannelParticipant#7fecb1ec flags:# channel_id:int date:int actor_id:int user_id:int prev_participant:flags.0?ChannelParticipant new_participant:flags.1?ChannelParticipant invite:flags.2?ExportedChatInvite qts:int = Update;
updateBotStopped#7f9488a user_id:int date:int stopped:Bool qts:int = Update;
updateGroupCallConnection#b783982 flags:# presentation:flags.0?true params:DataJSON = Update;
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
@ -395,7 +396,7 @@ config#330b4067 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:fla
nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc;
help.appUpdate#1da7158f flags:# can_not_skip:flags.0?true id:int version:string text:string entities:Vector<MessageEntity> document:flags.1?Document url:flags.2?string = help.AppUpdate;
help.appUpdate#ccbbce30 flags:# can_not_skip:flags.0?true id:int version:string text:string entities:Vector<MessageEntity> document:flags.1?Document url:flags.2?string sticker:flags.3?Document = help.AppUpdate;
help.noAppUpdate#c45a6536 = help.AppUpdate;
help.inviteText#18cb9f78 message:string = help.InviteText;
@ -1066,7 +1067,7 @@ account.wallPapers#702b65a9 hash:int wallpapers:Vector<WallPaper> = account.Wall
codeSettings#debebe83 flags:# allow_flashcall:flags.0?true current_number:flags.1?true allow_app_hash:flags.4?true = CodeSettings;
wallPaperSettings#5086cf8 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int second_background_color:flags.4?int intensity:flags.3?int rotation:flags.4?int = WallPaperSettings;
wallPaperSettings#1dc1bca4 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int second_background_color:flags.4?int third_background_color:flags.5?int fourth_background_color:flags.6?int intensity:flags.3?int rotation:flags.4?int = WallPaperSettings;
autoDownloadSettings#e04232f3 flags:# disabled:flags.0?true video_preload_large:flags.1?true audio_preload_next:flags.2?true phonecalls_less_data:flags.3?true photo_size_max:int video_size_max:int file_size_max:int video_upload_maxbitrate:int = AutoDownloadSettings;
@ -1194,11 +1195,11 @@ peerBlocked#e8fd8014 peer_id:Peer date:int = PeerBlocked;
stats.messageStats#8999f295 views_graph:StatsGraph = stats.MessageStats;
groupCallDiscarded#7780bcb4 id:long access_hash:long duration:int = GroupCall;
groupCall#c95c6654 flags:# join_muted:flags.1?true can_change_join_muted:flags.2?true join_date_asc:flags.6?true schedule_start_subscribed:flags.8?true id:long access_hash:long participants_count:int params:flags.0?DataJSON title:flags.3?string stream_dc_id:flags.4?int record_start_date:flags.5?int schedule_date:flags.7?int version:int = GroupCall;
groupCall#653dbaad flags:# join_muted:flags.1?true can_change_join_muted:flags.2?true join_date_asc:flags.6?true schedule_start_subscribed:flags.8?true can_start_video:flags.9?true id:long access_hash:long participants_count:int title:flags.3?string stream_dc_id:flags.4?int record_start_date:flags.5?int schedule_date:flags.7?int version:int = GroupCall;
inputGroupCall#d8aa840f id:long access_hash:long = InputGroupCall;
groupCallParticipant#b96b25ee flags:# muted:flags.0?true left:flags.1?true can_self_unmute:flags.2?true just_joined:flags.4?true versioned:flags.5?true min:flags.8?true muted_by_you:flags.9?true volume_by_admin:flags.10?true self:flags.12?true peer:Peer date:int active_date:flags.3?int source:int volume:flags.7?int about:flags.11?string raise_hand_rating:flags.13?long params:flags.6?DataJSON = GroupCallParticipant;
groupCallParticipant#a8ba51a7 flags:# muted:flags.0?true left:flags.1?true can_self_unmute:flags.2?true just_joined:flags.4?true versioned:flags.5?true min:flags.8?true muted_by_you:flags.9?true volume_by_admin:flags.10?true self:flags.12?true peer:Peer date:int active_date:flags.3?int source:int volume:flags.7?int about:flags.11?string raise_hand_rating:flags.13?long video:flags.6?DataJSON presentation:flags.14?DataJSON = GroupCallParticipant;
phone.groupCall#9e727aad call:GroupCall participants:Vector<GroupCallParticipant> participants_next_offset:string chats:Vector<Chat> users:Vector<User> = phone.GroupCall;
@ -1607,22 +1608,24 @@ phone.setCallRating#59ead627 flags:# user_initiative:flags.0?true peer:InputPhon
phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool;
phone.sendSignalingData#ff7a9383 peer:InputPhoneCall data:bytes = Bool;
phone.createGroupCall#48cdc6d8 flags:# peer:InputPeer random_id:int title:flags.0?string schedule_date:flags.1?int = Updates;
phone.joinGroupCall#b132ff7b flags:# muted:flags.0?true call:InputGroupCall join_as:InputPeer invite_hash:flags.1?string params:DataJSON = Updates;
phone.joinGroupCall#b132ff7b flags:# muted:flags.0?true video_muted:flags.2?true call:InputGroupCall join_as:InputPeer invite_hash:flags.1?string params:DataJSON = Updates;
phone.leaveGroupCall#500377f9 call:InputGroupCall source:int = Updates;
phone.inviteToGroupCall#7b393160 call:InputGroupCall users:Vector<InputUser> = Updates;
phone.discardGroupCall#7a777135 call:InputGroupCall = Updates;
phone.toggleGroupCallSettings#74bbb43d flags:# reset_invite_hash:flags.1?true call:InputGroupCall join_muted:flags.0?Bool = Updates;
phone.getGroupCall#c7cb017 call:InputGroupCall = phone.GroupCall;
phone.getGroupParticipants#c558d8ab call:InputGroupCall ids:Vector<InputPeer> sources:Vector<int> offset:string limit:int = phone.GroupParticipants;
phone.checkGroupCall#b74a7bea call:InputGroupCall source:int = Bool;
phone.checkGroupCall#b59cf977 call:InputGroupCall sources:Vector<int> = Vector<int>;
phone.toggleGroupCallRecord#c02a66d7 flags:# start:flags.0?true call:InputGroupCall title:flags.1?string = Updates;
phone.editGroupCallParticipant#d975eb80 flags:# muted:flags.0?true call:InputGroupCall participant:InputPeer volume:flags.1?int raise_hand:flags.2?Bool = Updates;
phone.editGroupCallParticipant#aec610e4 flags:# call:InputGroupCall participant:InputPeer muted:flags.0?Bool volume:flags.1?int raise_hand:flags.2?Bool video_muted:flags.3?Bool = Updates;
phone.editGroupCallTitle#1ca6ac0a call:InputGroupCall title:string = Updates;
phone.getGroupCallJoinAs#ef7c213a peer:InputPeer = phone.JoinAsPeers;
phone.exportGroupCallInvite#e6aa647f flags:# can_self_unmute:flags.0?true call:InputGroupCall = phone.ExportedGroupCallInvite;
phone.toggleGroupCallStartSubscription#219c34e6 call:InputGroupCall subscribed:Bool = Updates;
phone.startScheduledGroupCall#5680e342 call:InputGroupCall = Updates;
phone.saveDefaultGroupCallJoinAs#575e1f8c peer:InputPeer join_as:InputPeer = Bool;
phone.joinGroupCallPresentation#cbea6bc4 call:InputGroupCall params:DataJSON = Updates;
phone.leaveGroupCallPresentation#1c50d144 call:InputGroupCall = Updates;
langpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference;
langpack.getStrings#efea3803 lang_pack:string lang_code:string keys:Vector<string> = Vector<LangPackString>;

View File

@ -298,7 +298,7 @@ telegram_api::object_ptr<telegram_api::wallPaperSettings> get_input_wallpaper_se
flags |= telegram_api::wallPaperSettings::INTENSITY_MASK;
}
return telegram_api::make_object<telegram_api::wallPaperSettings>(flags, false /*ignored*/, false /*ignored*/,
type.fill.top_color, type.fill.bottom_color,
type.fill.top_color, type.fill.bottom_color, 0, 0,
type.intensity, type.fill.rotation_angle);
}

View File

@ -380,8 +380,8 @@ class JoinGroupCallQuery : public Td::ResultHandler {
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),
invite_hash, make_tl_object<telegram_api::dataJSON>(payload)));
flags, false /*ignored*/, 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;
@ -605,8 +605,8 @@ class EditGroupCallParticipantQuery : public Td::ResultHandler {
explicit EditGroupCallParticipantQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
}
void send(InputGroupCallId input_group_call_id, DialogId dialog_id, bool is_muted, int32 volume_level,
bool set_raise_hand, bool raise_hand) {
void send(InputGroupCallId input_group_call_id, DialogId dialog_id, bool set_is_mited, bool is_muted,
int32 volume_level, bool set_raise_hand, bool raise_hand, bool set_video_is_muted, bool video_is_muted) {
auto input_peer = td->messages_manager_->get_input_peer(dialog_id, AccessRights::Know);
if (input_peer == nullptr) {
return on_error(0, Status::Error(400, "Can't access the chat"));
@ -617,13 +617,15 @@ class EditGroupCallParticipantQuery : public Td::ResultHandler {
flags |= telegram_api::phone_editGroupCallParticipant::RAISE_HAND_MASK;
} else if (volume_level) {
flags |= telegram_api::phone_editGroupCallParticipant::VOLUME_MASK;
} else if (is_muted) {
} else if (set_is_mited) {
flags |= telegram_api::phone_editGroupCallParticipant::MUTED_MASK;
} else if (set_video_is_muted) {
flags |= telegram_api::phone_editGroupCallParticipant::VIDEO_MUTED_MASK;
}
send_query(G()->net_query_creator().create(telegram_api::phone_editGroupCallParticipant(
flags, false /*ignored*/, input_group_call_id.get_input_group_call(), std::move(input_peer), volume_level,
raise_hand)));
flags, input_group_call_id.get_input_group_call(), std::move(input_peer), is_muted, volume_level, raise_hand,
video_is_muted)));
}
void on_result(uint64 id, BufferSlice packet) override {
@ -649,10 +651,12 @@ class CheckGroupCallQuery : public Td::ResultHandler {
explicit CheckGroupCallQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
}
void send(InputGroupCallId input_group_call_id, int32 audio_source) {
CHECK(audio_source != 0);
void send(InputGroupCallId input_group_call_id, vector<int32> &&audio_sources) {
for (auto &audio_source : audio_sources) {
CHECK(audio_source != 0);
}
send_query(G()->net_query_creator().create(
telegram_api::phone_checkGroupCall(input_group_call_id.get_input_group_call(), audio_source)));
telegram_api::phone_checkGroupCall(input_group_call_id.get_input_group_call(), std::move(audio_sources))));
}
void on_result(uint64 id, BufferSlice packet) override {
@ -661,10 +665,10 @@ class CheckGroupCallQuery : public Td::ResultHandler {
return on_error(id, result_ptr.move_as_error());
}
bool success = result_ptr.move_as_ok();
LOG(INFO) << "Receive result for CheckGroupCallQuery: " << success;
vector<int32> active_audio_sources = result_ptr.move_as_ok();
LOG(INFO) << "Receive result for CheckGroupCallQuery: " << active_audio_sources;
if (success) {
if (!active_audio_sources.empty()) {
promise_.set_value(Unit());
} else {
promise_.set_error(Status::Error(400, "GROUPCALL_JOIN_MISSING"));
@ -905,7 +909,7 @@ void GroupCallManager::on_check_group_call_is_joined_timeout(GroupCallId group_c
send_closure(actor_id, &GroupCallManager::finish_check_group_call_is_joined, input_group_call_id, audio_source,
std::move(result));
});
td_->create_handler<CheckGroupCallQuery>(std::move(promise))->send(input_group_call_id, audio_source);
td_->create_handler<CheckGroupCallQuery>(std::move(promise))->send(input_group_call_id, {audio_source});
}
void GroupCallManager::on_pending_send_speaking_action_timeout_callback(void *group_call_manager_ptr,
@ -3119,7 +3123,7 @@ void GroupCallManager::toggle_group_call_participant_is_muted(GroupCallId group_
generation, std::move(promise));
});
td_->create_handler<EditGroupCallParticipantQuery>(std::move(query_promise))
->send(input_group_call_id, dialog_id, is_muted, 0, false, false);
->send(input_group_call_id, dialog_id, true, is_muted, 0, false, false, false, false);
}
void GroupCallManager::on_toggle_group_call_participant_is_muted(InputGroupCallId input_group_call_id,
@ -3214,7 +3218,7 @@ void GroupCallManager::set_group_call_participant_volume_level(GroupCallId group
dialog_id, generation, std::move(promise));
});
td_->create_handler<EditGroupCallParticipantQuery>(std::move(query_promise))
->send(input_group_call_id, dialog_id, false, volume_level, false, false);
->send(input_group_call_id, dialog_id, false, false, volume_level, false, false, false, false);
}
void GroupCallManager::on_set_group_call_participant_volume_level(InputGroupCallId input_group_call_id,
@ -3312,7 +3316,7 @@ void GroupCallManager::toggle_group_call_participant_is_hand_raised(GroupCallId
dialog_id, generation, std::move(promise));
});
td_->create_handler<EditGroupCallParticipantQuery>(std::move(query_promise))
->send(input_group_call_id, dialog_id, false, 0, true, is_hand_raised);
->send(input_group_call_id, dialog_id, false, false, 0, true, is_hand_raised, false, false);
}
void GroupCallManager::on_toggle_group_call_participant_is_hand_raised(InputGroupCallId input_group_call_id,
@ -3466,6 +3470,13 @@ void GroupCallManager::discard_group_call(GroupCallId group_call_id, Promise<Uni
td_->create_handler<DiscardGroupCallQuery>(std::move(promise))->send(input_group_call_id);
}
void GroupCallManager::on_update_group_call_connection(bool is_presentation, string &&connection_params) {
if (!pending_group_call_join_params_[is_presentation].empty()) {
LOG(ERROR) << "Receive duplicate connection params for " << (is_presentation ? "pesentation" : "video");
}
pending_group_call_join_params_[is_presentation] = std::move(connection_params);
}
void GroupCallManager::on_update_group_call(tl_object_ptr<telegram_api::GroupCall> group_call_ptr, DialogId dialog_id) {
if (td_->auth_manager_->is_bot()) {
return;
@ -3540,7 +3551,6 @@ InputGroupCallId GroupCallManager::update_group_call(const tl_object_ptr<telegra
GroupCall call;
call.is_inited = true;
string join_params;
switch (group_call_ptr->get_id()) {
case telegram_api::groupCall::ID: {
auto group_call = static_cast<const telegram_api::groupCall *>(group_call_ptr.get());
@ -3585,9 +3595,6 @@ InputGroupCallId GroupCallManager::update_group_call(const tl_object_ptr<telegra
call.stream_dc_id_version = group_call->version_;
call.record_start_date_version = group_call->version_;
call.scheduled_start_date_version = group_call->version_;
if (group_call->params_ != nullptr) {
join_params = std::move(group_call->params_->data_);
}
break;
}
case telegram_api::groupCallDiscarded::ID: {
@ -3604,6 +3611,9 @@ InputGroupCallId GroupCallManager::update_group_call(const tl_object_ptr<telegra
return {};
}
string join_params = std::move(pending_group_call_join_params_[0]);
pending_group_call_join_params_[0].clear();
bool need_update = false;
auto *group_call = add_group_call(input_group_call_id, dialog_id);
call.group_call_id = group_call->group_call_id;

View File

@ -104,6 +104,8 @@ class GroupCallManager : public Actor {
void on_update_dialog_about(DialogId dialog_id, const string &about, bool from_server);
void on_update_group_call_connection(bool is_presentation, string &&connection_params);
void on_update_group_call(tl_object_ptr<telegram_api::GroupCall> group_call_ptr, DialogId dialog_id);
void on_user_speaking_in_group_call(GroupCallId group_call_id, DialogId dialog_id, int32 date,
@ -325,6 +327,8 @@ class GroupCallManager : public Actor {
std::unordered_map<InputGroupCallId, unique_ptr<GroupCall>, InputGroupCallIdHash> group_calls_;
string pending_group_call_join_params_[2];
std::unordered_map<InputGroupCallId, unique_ptr<GroupCallParticipants>, InputGroupCallIdHash>
group_call_participants_;
std::unordered_map<DialogId, vector<InputGroupCallId>, DialogIdHash> participant_id_to_group_call_id_;

View File

@ -56,8 +56,8 @@ GroupCallParticipant::GroupCallParticipant(const tl_object_ptr<telegram_api::gro
is_min = participant->min_;
version = call_version;
if (participant->params_ != nullptr) {
auto r_video_payload = get_group_call_video_payload(participant->params_->data_, endpoint);
if (participant->video_ != nullptr) {
auto r_video_payload = get_group_call_video_payload(participant->video_->data_, endpoint);
if (r_video_payload.is_error()) {
LOG(ERROR) << "Failed to parse GroupCallParticipant params: " << r_video_payload.error();
} else {

View File

@ -182,19 +182,9 @@ Result<GroupCallVideoPayload> get_group_call_video_payload(string json, string &
auto &value_object = value.get_object();
TRY_RESULT_ASSIGN(endpoint, get_json_object_string_field(value_object, "endpoint", false));
TRY_RESULT(payload_types, get_json_object_field(value_object, "payload-types", JsonValue::Type::Array, false));
TRY_RESULT(extensions, get_json_object_field(value_object, "rtp-hdrexts", JsonValue::Type::Array, false));
TRY_RESULT(source_groups, get_json_object_field(value_object, "ssrc-groups", JsonValue::Type::Array, false));
GroupCallVideoPayload result;
for (auto &payload_type_object : payload_types.get_array()) {
TRY_RESULT(payload_type, get_group_call_video_payload_type(std::move(payload_type_object)));
result.payload_types.push_back(std::move(payload_type));
}
for (auto &extension_object : extensions.get_array()) {
TRY_RESULT(extension, get_group_call_video_extension(std::move(extension_object)));
result.extensions.push_back(std::move(extension));
}
for (auto &source_group_object : source_groups.get_array()) {
TRY_RESULT(source_group, get_group_call_video_source_group(std::move(source_group_object)));
result.source_groups.push_back(std::move(source_group));

View File

@ -969,6 +969,11 @@ const vector<tl_object_ptr<telegram_api::Update>> *UpdatesManager::get_updates(
}
}
vector<tl_object_ptr<telegram_api::Update>> *UpdatesManager::get_updates(telegram_api::Updates *updates_ptr) {
return const_cast<vector<tl_object_ptr<telegram_api::Update>> *>(
get_updates(static_cast<const telegram_api::Updates *>(updates_ptr)));
}
std::unordered_set<int64> UpdatesManager::get_sent_messages_random_ids(const telegram_api::Updates *updates_ptr) {
std::unordered_set<int64> random_ids;
auto updates = get_updates(updates_ptr);
@ -1737,6 +1742,12 @@ void UpdatesManager::process_updates(vector<tl_object_ptr<telegram_api::Update>>
continue;
}
// updateGroupCallConnection must be processed before updateGroupCall
if (constructor_id == telegram_api::updateGroupCallConnection::ID) {
on_update(move_tl_object_as<telegram_api::updateGroupCallConnection>(update), mpas.get_promise());
continue;
}
// updatePtsChanged forces get difference, so process it last
if (constructor_id == telegram_api::updatePtsChanged::ID) {
update_pts_changed = move_tl_object_as<telegram_api::updatePtsChanged>(update);
@ -2824,6 +2835,12 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updatePhoneCallSignal
promise.set_value(Unit());
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateGroupCallConnection> update, Promise<Unit> &&promise) {
send_closure(G()->group_call_manager(), &GroupCallManager::on_update_group_call_connection, update->presentation_,
std::move(update->params_->data_));
promise.set_value(Unit());
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateGroupCall> update, Promise<Unit> &&promise) {
DialogId dialog_id(ChatId(update->chat_id_));
if (!td_->messages_manager_->have_dialog_force(dialog_id, "updateGroupCall")) {

View File

@ -308,6 +308,8 @@ class UpdatesManager : public Actor {
static const vector<tl_object_ptr<telegram_api::Update>> *get_updates(const telegram_api::Updates *updates_ptr);
static vector<tl_object_ptr<telegram_api::Update>> *get_updates(telegram_api::Updates *updates_ptr);
bool is_acceptable_user(UserId user_id) const;
bool is_acceptable_chat(ChatId chat_id) const;
@ -434,6 +436,7 @@ class UpdatesManager : public Actor {
void on_update(tl_object_ptr<telegram_api::updatePhoneCall> update, Promise<Unit> &&promise);
void on_update(tl_object_ptr<telegram_api::updatePhoneCallSignalingData> update, Promise<Unit> &&promise);
void on_update(tl_object_ptr<telegram_api::updateGroupCallConnection> update, Promise<Unit> &&promise);
void on_update(tl_object_ptr<telegram_api::updateGroupCall> update, Promise<Unit> &&promise);
void on_update(tl_object_ptr<telegram_api::updateGroupCallParticipants> update, Promise<Unit> &&promise);

View File

@ -8,7 +8,7 @@
namespace td {
constexpr int32 MTPROTO_LAYER = 128;
constexpr int32 MTPROTO_LAYER = 129;
enum class Version : int32 {
Initial, // 0