Support "stories_venue_search_username" appConfig option.

This commit is contained in:
levlam 2023-08-02 13:59:40 +03:00
parent 0ba15e33dd
commit 0f39a16321
2 changed files with 11 additions and 5 deletions

View File

@ -1380,10 +1380,12 @@ void ConfigManager::process_config(tl_object_ptr<telegram_api::config> config) {
} else { } else {
options.set_option_string("animation_search_bot_username", config->gif_search_username_); options.set_option_string("animation_search_bot_username", config->gif_search_username_);
} }
if (config->venue_search_username_.empty()) { if (!options.have_option("venue_search_bot_username")) {
options.set_option_empty("venue_search_bot_username"); if (config->venue_search_username_.empty()) {
} else { options.set_option_empty("venue_search_bot_username");
options.set_option_string("venue_search_bot_username", config->venue_search_username_); } else {
options.set_option_string("venue_search_bot_username", config->venue_search_username_);
}
} }
if (config->img_search_username_.empty()) { if (config->img_search_username_.empty()) {
options.set_option_empty("photo_search_bot_username"); options.set_option_empty("photo_search_bot_username");
@ -1886,6 +1888,10 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
stories_changelog_user_id = get_json_value_long(std::move(key_value->value_), key); stories_changelog_user_id = get_json_value_long(std::move(key_value->value_), key);
continue; 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)); new_values.push_back(std::move(key_value));
} }

View File

@ -102,7 +102,7 @@ class ConfigManager final : public NetQueryCallback {
private: private:
struct AppConfig { struct AppConfig {
static constexpr int32 CURRENT_VERSION = 8; static constexpr int32 CURRENT_VERSION = 9;
int32 version_ = 0; int32 version_ = 0;
int32 hash_ = 0; int32 hash_ = 0;
telegram_api::object_ptr<telegram_api::JSONValue> config_; telegram_api::object_ptr<telegram_api::JSONValue> config_;