diff --git a/td/telegram/LanguagePackManager.cpp b/td/telegram/LanguagePackManager.cpp index 5619a2d6a..6b98b37ad 100644 --- a/td/telegram/LanguagePackManager.cpp +++ b/td/telegram/LanguagePackManager.cpp @@ -272,6 +272,14 @@ void LanguagePackManager::on_language_pack_version_changed(int32 new_version) { std::move(request_promise)); } +void LanguagePackManager::on_language_pack_too_long(string language_code) { + if (language_code == language_code_) { + return on_language_pack_version_changed(std::numeric_limits::max()); + } + LOG(WARNING) << "Receive languagePackTooLong for language " << language_code << ", but use language " + << language_code_; +} + void LanguagePackManager::on_update_language_pack(tl_object_ptr difference) { LOG(INFO) << "Receive update language pack difference for language pack " << difference->lang_code_ << " from version " << difference->from_version_ << " with version " << difference->version_ << " of size " diff --git a/td/telegram/LanguagePackManager.h b/td/telegram/LanguagePackManager.h index 953473c7e..a67e058be 100644 --- a/td/telegram/LanguagePackManager.h +++ b/td/telegram/LanguagePackManager.h @@ -48,6 +48,8 @@ class LanguagePackManager : public NetQueryCallback { void on_language_pack_version_changed(int32 new_version); + void on_language_pack_too_long(string language_code); + void get_languages(bool only_local, Promise> promise); void get_language_pack_strings(string language_code, vector keys, diff --git a/td/telegram/UpdatesManager.cpp b/td/telegram/UpdatesManager.cpp index 708e3aa7d..08e3de534 100644 --- a/td/telegram/UpdatesManager.cpp +++ b/td/telegram/UpdatesManager.cpp @@ -1856,8 +1856,8 @@ void UpdatesManager::on_update(tl_object_ptr } void UpdatesManager::on_update(tl_object_ptr update, bool /*force_apply*/) { - send_closure(G()->language_pack_manager(), &LanguagePackManager::on_language_pack_version_changed, - std::numeric_limits::max()); + send_closure(G()->language_pack_manager(), &LanguagePackManager::on_language_pack_too_long, + std::move(update->lang_code_)); } void UpdatesManager::on_update(tl_object_ptr update, bool /*force_apply*/) {