Skip to content

Commit 050a11e

Browse files
committed
Update layer to 152.
1 parent 758ced9 commit 050a11e

18 files changed

+128
-49
lines changed

td/generate/scheme/telegram_api.tl

Lines changed: 54 additions & 16 deletions
Large diffs are not rendered by default.

td/telegram/AuthManager.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,13 @@ void AuthManager::start_net_query(NetQueryType net_query_type, NetQueryPtr net_q
555555
G()->net_query_dispatcher().dispatch_with_callback(std::move(net_query), actor_shared(this));
556556
}
557557

558-
void AuthManager::on_sent_code(telegram_api::object_ptr<telegram_api::auth_sentCode> &&sent_code) {
558+
void AuthManager::on_sent_code(telegram_api::object_ptr<telegram_api::auth_SentCode> &&sent_code_ptr) {
559+
auto sent_code_id = sent_code_ptr->get_id();
560+
if (sent_code_id != telegram_api::auth_sentCode::ID) {
561+
CHECK(sent_code_id == telegram_api::auth_sentCodeSuccess::ID);
562+
return on_query_error(Status::Error(500, "Receive unsupported response"));
563+
}
564+
auto sent_code = telegram_api::move_object_as<telegram_api::auth_sentCode>(sent_code_ptr);
559565
auto code_type_id = sent_code->type_->get_id();
560566
if (code_type_id == telegram_api::auth_sentCodeTypeSetUpEmailRequired::ID) {
561567
auto code_type = move_tl_object_as<telegram_api::auth_sentCodeTypeSetUpEmailRequired>(std::move(sent_code->type_));

td/telegram/AuthManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ class AuthManager final : public NetActor {
296296
void send_log_out_query();
297297
void destroy_auth_keys();
298298

299-
void on_sent_code(telegram_api::object_ptr<telegram_api::auth_sentCode> &&sent_code);
299+
void on_sent_code(telegram_api::object_ptr<telegram_api::auth_SentCode> &&sent_code_ptr);
300300

301301
void on_send_code_result(NetQueryPtr &result);
302302
void on_send_email_code_result(NetQueryPtr &result);

td/telegram/ContactsManager.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ class UploadProfilePhotoQuery final : public Td::ResultHandler {
487487
}
488488
send_query(G()->net_query_creator().create(
489489
telegram_api::photos_uploadProfilePhoto(flags, false /*ignored*/, std::move(photo_input_file),
490-
std::move(video_input_file), main_frame_timestamp),
490+
std::move(video_input_file), main_frame_timestamp, nullptr),
491491
{{"me"}}));
492492
} else {
493493
if (only_suggest) {
@@ -502,7 +502,7 @@ class UploadProfilePhotoQuery final : public Td::ResultHandler {
502502
send_query(G()->net_query_creator().create(
503503
telegram_api::photos_uploadContactProfilePhoto(flags, false /*ignored*/, false /*ignored*/,
504504
r_input_user.move_as_ok(), std::move(photo_input_file),
505-
std::move(video_input_file), main_frame_timestamp),
505+
std::move(video_input_file), main_frame_timestamp, nullptr),
506506
{{user_id}}));
507507
}
508508
}
@@ -611,7 +611,7 @@ class DeleteContactProfilePhotoQuery final : public Td::ResultHandler {
611611
flags |= telegram_api::photos_uploadContactProfilePhoto::SAVE_MASK;
612612
send_query(G()->net_query_creator().create(
613613
telegram_api::photos_uploadContactProfilePhoto(flags, false /*ignored*/, false /*ignored*/,
614-
std::move(input_user), nullptr, nullptr, 0),
614+
std::move(input_user), nullptr, nullptr, 0, nullptr),
615615
{{user_id}}));
616616
}
617617

td/telegram/DialogParticipant.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ RestrictedRights::RestrictedRights(const tl_object_ptr<telegram_api::chatBannedR
198198
<< "Have until date " << rights->until_date_ << " in restricted rights";
199199

200200
*this =
201-
RestrictedRights(!rights->send_messages_, !rights->send_media_, !rights->send_stickers_, !rights->send_gifs_,
201+
RestrictedRights(!rights->send_plain_, !rights->send_media_, !rights->send_stickers_, !rights->send_gifs_,
202202
!rights->send_games_, !rights->send_inline_, !rights->embed_links_, !rights->send_polls_,
203203
!rights->change_info_, !rights->invite_users_, !rights->pin_messages_, !rights->manage_topics_);
204204
}
@@ -290,7 +290,8 @@ tl_object_ptr<telegram_api::chatBannedRights> RestrictedRights::get_chat_banned_
290290
return make_tl_object<telegram_api::chatBannedRights>(
291291
flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
292292
false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
293-
false /*ignored*/, false /*ignored*/, 0);
293+
false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
294+
false /*ignored*/, false /*ignored*/, false /*ignored*/, 0);
294295
}
295296

296297
bool operator==(const RestrictedRights &lhs, const RestrictedRights &rhs) {

td/telegram/DocumentsManager.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,11 @@ Document DocumentsManager::on_get_document(RemoteDocument remote_document, Dialo
332332
}
333333
}
334334
}
335-
for (auto &thumb : document->video_thumbs_) {
335+
for (auto &thumb_ptr : document->video_thumbs_) {
336+
if (thumb_ptr->get_id() != telegram_api::videoSize::ID) {
337+
continue;
338+
}
339+
auto thumb = move_tl_object_as<telegram_api::videoSize>(thumb_ptr);
336340
if (thumb->type_ == "v") {
337341
if (!animated_thumbnail.file_id.is_valid()) {
338342
animated_thumbnail =

td/telegram/MessageContent.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5324,6 +5324,8 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
53245324
}
53255325
case telegram_api::messageActionAttachMenuBotAllowed::ID:
53265326
return td::make_unique<MessageWriteAccessAllowed>();
5327+
case telegram_api::messageActionRequestedPeer::ID:
5328+
return td::make_unique<MessageUnsupported>();
53275329
default:
53285330
UNREACHABLE();
53295331
}

td/telegram/MessagesManager.cpp

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -717,11 +717,10 @@ class TranslateTextQuery final : public Td::ResultHandler {
717717

718718
void send(const string &text, const string &from_language_code, const string &to_language_code) {
719719
int flags = telegram_api::messages_translateText::TEXT_MASK;
720-
if (!from_language_code.empty()) {
721-
flags |= telegram_api::messages_translateText::FROM_LANG_MASK;
722-
}
720+
vector<telegram_api::object_ptr<telegram_api::textWithEntities>> texts;
721+
texts.push_back(telegram_api::make_object<telegram_api::textWithEntities>(text, Auto()));
723722
send_query(G()->net_query_creator().create(
724-
telegram_api::messages_translateText(flags, nullptr, 0, text, from_language_code, to_language_code)));
723+
telegram_api::messages_translateText(flags, nullptr, vector<int32>{0}, std::move(texts), to_language_code)));
725724
}
726725

727726
void on_result(BufferSlice packet) final {
@@ -732,16 +731,10 @@ class TranslateTextQuery final : public Td::ResultHandler {
732731

733732
auto ptr = result_ptr.move_as_ok();
734733
LOG(INFO) << "Receive result for TranslateTextQuery: " << to_string(ptr);
735-
switch (ptr->get_id()) {
736-
case telegram_api::messages_translateNoResult::ID:
737-
return promise_.set_value(nullptr);
738-
case telegram_api::messages_translateResultText::ID: {
739-
auto text = telegram_api::move_object_as<telegram_api::messages_translateResultText>(ptr);
740-
return promise_.set_value(td_api::make_object<td_api::text>(text->text_));
741-
}
742-
default:
743-
UNREACHABLE();
734+
if (ptr->result_.empty()) {
735+
return promise_.set_value(nullptr);
744736
}
737+
promise_.set_value(td_api::make_object<td_api::text>(ptr->result_[0]->text_));
745738
}
746739

747740
void on_error(Status status) final {
@@ -1061,8 +1054,8 @@ class CreateChannelQuery final : public Td::ResultHandler {
10611054

10621055
random_id_ = random_id;
10631056
send_query(G()->net_query_creator().create(telegram_api::channels_createChannel(
1064-
flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, title, about, location.get_input_geo_point(),
1065-
location.get_address(), message_ttl.get_input_ttl_period())));
1057+
flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, title, about,
1058+
location.get_input_geo_point(), location.get_address(), message_ttl.get_input_ttl_period())));
10661059
}
10671060

10681061
void on_result(BufferSlice packet) final {
@@ -9482,7 +9475,7 @@ void MessagesManager::on_upload_dialog_photo(FileId file_id, tl_object_ptr<teleg
94829475
}
94839476

94849477
auto input_chat_photo = make_tl_object<telegram_api::inputChatUploadedPhoto>(
9485-
flags, std::move(photo_input_file), std::move(video_input_file), main_frame_timestamp);
9478+
flags, std::move(photo_input_file), std::move(video_input_file), main_frame_timestamp, nullptr);
94869479
send_edit_dialog_photo_query(dialog_id, file_id, std::move(input_chat_photo), std::move(promise));
94879480
}
94889481

td/telegram/PhoneNumberManager.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,13 @@ void PhoneNumberManager::on_send_code_result(NetQueryPtr &result) {
209209
if (r_sent_code.is_error()) {
210210
return on_query_error(r_sent_code.move_as_error());
211211
}
212-
auto sent_code = r_sent_code.move_as_ok();
212+
auto sent_code_ptr = r_sent_code.move_as_ok();
213+
auto sent_code_id = sent_code_ptr->get_id();
214+
if (sent_code_id != telegram_api::auth_sentCode::ID) {
215+
CHECK(sent_code_id == telegram_api::auth_sentCodeSuccess::ID);
216+
return on_query_error(Status::Error(500, "Receive invalid response"));
217+
}
218+
auto sent_code = telegram_api::move_object_as<telegram_api::auth_sentCode>(sent_code_ptr);
213219

214220
LOG(INFO) << "Receive " << to_string(sent_code);
215221

td/telegram/PhotoSize.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,12 @@ Variant<PhotoSize, string> get_photo_size(FileManager *file_manager, PhotoSizeSo
260260

261261
AnimationSize get_animation_size(FileManager *file_manager, PhotoSizeSource source, int64 id, int64 access_hash,
262262
std::string file_reference, DcId dc_id, DialogId owner_dialog_id,
263-
tl_object_ptr<telegram_api::videoSize> &&size) {
264-
CHECK(size != nullptr);
263+
tl_object_ptr<telegram_api::VideoSize> &&size_ptr) {
264+
CHECK(size_ptr != nullptr);
265+
if (size_ptr->get_id() != telegram_api::videoSize::ID) {
266+
return {};
267+
}
268+
auto size = move_tl_object_as<telegram_api::videoSize>(size_ptr);
265269
AnimationSize res;
266270
if (size->type_ != "p" && size->type_ != "u" && size->type_ != "v") {
267271
LOG(ERROR) << "Unsupported videoSize \"" << size->type_ << "\" in " << to_string(size);

0 commit comments

Comments
 (0)