From 0f39a16321f2b2e9f468d9336593bc296d538044 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 2 Aug 2023 13:59:40 +0300 Subject: [PATCH] Support "stories_venue_search_username" appConfig option. --- td/telegram/ConfigManager.cpp | 14 ++++++++++---- td/telegram/ConfigManager.h | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/td/telegram/ConfigManager.cpp b/td/telegram/ConfigManager.cpp index 4669d386e..c4335a5d6 100644 --- a/td/telegram/ConfigManager.cpp +++ b/td/telegram/ConfigManager.cpp @@ -1380,10 +1380,12 @@ void ConfigManager::process_config(tl_object_ptr config) { } else { options.set_option_string("animation_search_bot_username", config->gif_search_username_); } - if (config->venue_search_username_.empty()) { - options.set_option_empty("venue_search_bot_username"); - } else { - options.set_option_string("venue_search_bot_username", config->venue_search_username_); + if (!options.have_option("venue_search_bot_username")) { + if (config->venue_search_username_.empty()) { + options.set_option_empty("venue_search_bot_username"); + } else { + options.set_option_string("venue_search_bot_username", config->venue_search_username_); + } } if (config->img_search_username_.empty()) { options.set_option_empty("photo_search_bot_username"); @@ -1886,6 +1888,10 @@ void ConfigManager::process_app_config(tl_object_ptr &c stories_changelog_user_id = get_json_value_long(std::move(key_value->value_), key); continue; } + if (key == "stories_venue_search_username") { + G()->set_option_string("venue_search_bot_username", get_json_value_string(std::move(key_value->value_), key)); + continue; + } new_values.push_back(std::move(key_value)); } diff --git a/td/telegram/ConfigManager.h b/td/telegram/ConfigManager.h index b4145faeb..89194024e 100644 --- a/td/telegram/ConfigManager.h +++ b/td/telegram/ConfigManager.h @@ -102,7 +102,7 @@ class ConfigManager final : public NetQueryCallback { private: struct AppConfig { - static constexpr int32 CURRENT_VERSION = 8; + static constexpr int32 CURRENT_VERSION = 9; int32 version_ = 0; int32 hash_ = 0; telegram_api::object_ptr config_;