diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 21398acb..6818dc38 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -878,12 +878,12 @@ date day:int32 month:int32 year:int32 = Date; personalDetails first_name:string middle_name:string last_name:string birthdate:date gender:string country_code:string residence_country_code:string = PersonalDetails; //@description An identity document @number Document number; 1-24 characters @expiry_date Document expiry date; may be null @front_side Front side of the document -//@reverse_side Reverse side of the document; only for driver license and identity card @selfie Selfie with the document; may be null @translations List of files with the document translation -identityDocument number:string expiry_date:date front_side:datedFile reverse_side:datedFile selfie:datedFile translations:vector = IdentityDocument; +//@reverse_side Reverse side of the document; only for driver license and identity card @selfie Selfie with the document; may be null @translation List of files with the document translation +identityDocument number:string expiry_date:date front_side:datedFile reverse_side:datedFile selfie:datedFile translation:vector = IdentityDocument; //@description An identity document to be saved @number Document number; 1-24 characters @expiry_date Document expiry date, if available @front_side Front side of the document -//@reverse_side Reverse side of the document; only for driver license and identity card @selfie Selfie with the document, if available @translations List of files with the document translation -inputIdentityDocument number:string expiry_date:date front_side:InputFile reverse_side:InputFile selfie:InputFile translations:vector = InputIdentityDocument; +//@reverse_side Reverse side of the document; only for driver license and identity card @selfie Selfie with the document, if available @translation List of files with the document translation +inputIdentityDocument number:string expiry_date:date front_side:InputFile reverse_side:InputFile selfie:InputFile translation:vector = InputIdentityDocument; //@class PassportElement @description Contains information about a Telegram Passport element @@ -991,11 +991,11 @@ passportElementErrorSourceReverseSide = PassportElementErrorSource; //@description The selfie with the document contains an error. The error will be considered resolved when the file with the selfie changes passportElementErrorSourceSelfie = PassportElementErrorSource; -//@description The translation of the document contains an error. The error will be considered resolved when the file with the translation changes -passportElementErrorSourceTranslation = PassportElementErrorSource; +//@description One of files with the translation of the document contains an error. The error will be considered resolved when the file changes +passportElementErrorSourceTranslationFile = PassportElementErrorSource; -//@description The list of translations of the document contains an error. The error will be considered resolved when the list of translations changes -passportElementErrorSourceTranslations = PassportElementErrorSource; +//@description The translation of the document contains an error. The error will be considered resolved when the list of translation files changes +passportElementErrorSourceTranslationFiles = PassportElementErrorSource; //@description The file contains an error. The error will be considered resolved when the file changes passportElementErrorSourceFile = PassportElementErrorSource; @@ -1019,8 +1019,8 @@ passportAuthorizationForm id:int32 required_types:vector el encryptedCredentials data:bytes hash:bytes secret:bytes = EncryptedCredentials; -//@description Contains information about encrypted Telegram Passport element; for bots only @type Type of Telegram Passport element @data Encrypted JSON-encoded data about the user @front_side The front side of an identity document @reverse_side The reverse side of an identity document; may be null @selfie Selfie with the document; may be null @translations List of files with the document translation @files List of attached files @value Unencrypted data, phone number or email address @hash Hash of the whole element -encryptedPassportElement type:PassportElementType data:bytes front_side:datedFile reverse_side:datedFile selfie:datedFile translations:vector files:vector value:string hash:string = EncryptedPassportElement; +//@description Contains information about encrypted Telegram Passport element; for bots only @type Type of Telegram Passport element @data Encrypted JSON-encoded data about the user @front_side The front side of an identity document @reverse_side The reverse side of an identity document; may be null @selfie Selfie with the document; may be null @translation List of files with the document translation @files List of attached files @value Unencrypted data, phone number or email address @hash Hash of the whole element +encryptedPassportElement type:PassportElementType data:bytes front_side:datedFile reverse_side:datedFile selfie:datedFile translation:vector files:vector value:string hash:string = EncryptedPassportElement; //@class InputPassportElementErrorSource @description Contains the description of an error in Telegram Passport element; for bots only @@ -1040,11 +1040,11 @@ inputPassportElementErrorSourceReverseSide file_hash:bytes = InputPassportElemen //@description The selfie contains an error. The error is considered resolved when the file with the selfie changes @file_hash Current hash of the file containing the selfie inputPassportElementErrorSourceSelfie file_hash:bytes = InputPassportElementErrorSource; -//@description The translation contains an error. The error is considered resolved when the file with the translation changes @file_hash Current hash of the file containing the translation -inputPassportElementErrorSourceTranslation file_hash:bytes = InputPassportElementErrorSource; +//@description One of files with the translation of the document contains an error. The error is considered resolved when the file with the translation changes @file_hash Current hash of the file containing the translation +inputPassportElementErrorSourceTranslationFile file_hash:bytes = InputPassportElementErrorSource; -//@description The list of translation files contains an error. The error is considered resolved when the file list changes @file_hashes Current hashes of all files with the translation -inputPassportElementErrorSourceTranslations file_hashes:vector = InputPassportElementErrorSource; +//@description The translation of the document contains an error. The error is considered resolved when the file list changes @file_hashes Current hashes of all files with the translation +inputPassportElementErrorSourceTranslationFiles file_hashes:vector = InputPassportElementErrorSource; //@description The file contains an error. The error is considered resolved when the file changes @file_hash Current hash of the file with an error inputPassportElementErrorSourceFile file_hash:bytes = InputPassportElementErrorSource; diff --git a/td/generate/scheme/td_api.tlo b/td/generate/scheme/td_api.tlo index 6d2b2079..1576b0a0 100644 Binary files a/td/generate/scheme/td_api.tlo and b/td/generate/scheme/td_api.tlo differ diff --git a/td/generate/scheme/telegram_api.tl b/td/generate/scheme/telegram_api.tl index 2459c306..21f317d5 100644 --- a/td/generate/scheme/telegram_api.tl +++ b/td/generate/scheme/telegram_api.tl @@ -886,8 +886,8 @@ secureValueErrorSelfie#e537ced6 type:SecureValueType file_hash:bytes text:string secureValueErrorFile#7a700873 type:SecureValueType file_hash:bytes text:string = SecureValueError; secureValueErrorFiles#666220e9 type:SecureValueType file_hash:Vector text:string = SecureValueError; secureValueError#869d758f type:SecureValueType hash:bytes text:string = SecureValueError; -secureValueErrorTranslation#5fbc1134 type:SecureValueType file_hash:bytes text:string = SecureValueError; -secureValueErrorTranslations#781e629b type:SecureValueType file_hash:Vector text:string = SecureValueError; +secureValueErrorTranslationFile#a1144770 type:SecureValueType file_hash:bytes text:string = SecureValueError; +secureValueErrorTranslationFiles#34636dd8 type:SecureValueType file_hash:Vector text:string = SecureValueError; secureCredentialsEncrypted#33f0ea47 data:bytes hash:bytes secret:bytes = SecureCredentialsEncrypted; diff --git a/td/generate/scheme/telegram_api.tlo b/td/generate/scheme/telegram_api.tlo index ba76627e..e3d39df9 100644 Binary files a/td/generate/scheme/telegram_api.tlo and b/td/generate/scheme/telegram_api.tlo differ diff --git a/td/telegram/SecureManager.cpp b/td/telegram/SecureManager.cpp index 30250f3d..f9f22031 100644 --- a/td/telegram/SecureManager.cpp +++ b/td/telegram/SecureManager.cpp @@ -791,18 +791,18 @@ class GetPassportAuthorizationForm : public NetQueryCallback { source = td_api::make_object(); break; } - case telegram_api::secureValueErrorTranslation::ID: { - auto error = move_tl_object_as(error_ptr); + case telegram_api::secureValueErrorTranslationFile::ID: { + auto error = move_tl_object_as(error_ptr); type = get_secure_value_type(error->type_); message = std::move(error->text_); - source = td_api::make_object(); + source = td_api::make_object(); break; } - case telegram_api::secureValueErrorTranslations::ID: { - auto error = move_tl_object_as(error_ptr); + case telegram_api::secureValueErrorTranslationFiles::ID: { + auto error = move_tl_object_as(error_ptr); type = get_secure_value_type(error->type_); message = std::move(error->text_); - source = td_api::make_object(); + source = td_api::make_object(); break; } default: @@ -949,19 +949,19 @@ void SecureManager::set_secure_value_errors(Td *td, tl_object_ptrfile_hash_), error->message_)); break; } - case td_api::inputPassportElementErrorSourceTranslation::ID: { - auto source = td_api::move_object_as(error->source_); - input_errors.push_back(make_tl_object( + case td_api::inputPassportElementErrorSourceTranslationFile::ID: { + auto source = td_api::move_object_as(error->source_); + input_errors.push_back(make_tl_object( std::move(type), BufferSlice(source->file_hash_), error->message_)); break; } - case td_api::inputPassportElementErrorSourceTranslations::ID: { - auto source = td_api::move_object_as(error->source_); + case td_api::inputPassportElementErrorSourceTranslationFiles::ID: { + auto source = td_api::move_object_as(error->source_); if (source->file_hashes_.empty()) { return promise.set_error(Status::Error(400, "File hashes must be non-empty")); } auto file_hashes = transform(source->file_hashes_, [](Slice hash) { return BufferSlice(hash); }); - input_errors.push_back(make_tl_object( + input_errors.push_back(make_tl_object( std::move(type), std::move(file_hashes), error->message_)); break; } diff --git a/td/telegram/SecureValue.cpp b/td/telegram/SecureValue.cpp index 30eabe55..4681c706 100644 --- a/td/telegram/SecureValue.cpp +++ b/td/telegram/SecureValue.cpp @@ -874,8 +874,8 @@ static Result get_identity_document(SecureValueType type, FileManag TRY_RESULT(selfie, get_secure_file(file_manager, std::move(identity_document->selfie_))); res.selfie = std::move(selfie); } - if (!identity_document->translations_.empty()) { - TRY_RESULT(translations, get_secure_files(file_manager, std::move(identity_document->translations_))); + if (!identity_document->translation_.empty()) { + TRY_RESULT(translations, get_secure_files(file_manager, std::move(identity_document->translation_))); res.translations = std::move(translations); } return res; @@ -1406,7 +1406,7 @@ static auto credentials_as_jsonable(const std::vector &c o("selfie", as_jsonable(cred.selfie.value())); } if (!cred.translations.empty() && with_translations) { - o("translations", as_jsonable(cred.translations)); + o("translation", as_jsonable(cred.translations)); } })); } diff --git a/td/telegram/files/FileGenerateManager.cpp b/td/telegram/files/FileGenerateManager.cpp index 22472a24..db32d575 100644 --- a/td/telegram/files/FileGenerateManager.cpp +++ b/td/telegram/files/FileGenerateManager.cpp @@ -222,7 +222,7 @@ void FileGenerateManager::generate_file(uint64 query_id, const FullGenerateFileL Slice conversion = generate_location.conversion_; auto &query = it_flag.first->second; - if (conversion.copy().truncate(file_id_query.size()) == file_id_query) { + if (begins_with(conversion, file_id_query)) { auto file_id = FileId(to_integer(conversion.substr(file_id_query.size())), 0); query.worker_ = create_actor("FileDownloadGenerateActor", generate_location.file_type_, file_id, std::move(callback), std::move(parent));