From 086df4db4e686796c9c6254fbd9be4c193fd1ee7 Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 3 Aug 2023 17:38:56 +0300 Subject: [PATCH] Add options related to stealth mode. --- td/telegram/ConfigManager.cpp | 15 +++++++++++++++ td/telegram/ConfigManager.h | 2 +- td/telegram/OptionManager.cpp | 9 +++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/td/telegram/ConfigManager.cpp b/td/telegram/ConfigManager.cpp index c4335a5d6..575bce80f 100644 --- a/td/telegram/ConfigManager.cpp +++ b/td/telegram/ConfigManager.cpp @@ -1892,6 +1892,21 @@ void ConfigManager::process_app_config(tl_object_ptr &c G()->set_option_string("venue_search_bot_username", get_json_value_string(std::move(key_value->value_), key)); continue; } + if (key == "stories_stealth_past_period") { + G()->set_option_integer("story_stealth_mode_past_period", + get_json_value_int(std::move(key_value->value_), key)); + continue; + } + if (key == "stories_stealth_future_period") { + G()->set_option_integer("story_stealth_mode_future_period", + get_json_value_int(std::move(key_value->value_), key)); + continue; + } + if (key == "stories_stealth_cooldown_period") { + G()->set_option_integer("story_stealth_mode_cooldown_period", + get_json_value_int(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 89194024e..d65b8e4b4 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 = 9; + static constexpr int32 CURRENT_VERSION = 10; int32 version_ = 0; int32 hash_ = 0; telegram_api::object_ptr config_; diff --git a/td/telegram/OptionManager.cpp b/td/telegram/OptionManager.cpp index 111905ba2..bfd961ad7 100644 --- a/td/telegram/OptionManager.cpp +++ b/td/telegram/OptionManager.cpp @@ -118,6 +118,15 @@ OptionManager::OptionManager(Td *td) if (!have_option("archive_all_stories")) { // set_option_boolean("archive_all_stories", false); } + if (!have_option("story_stealth_mode_past_period")) { + set_option_integer("story_stealth_mode_past_period", 300); + } + if (!have_option("story_stealth_mode_future_period")) { + set_option_integer("story_stealth_mode_future_period", 1500); + } + if (!have_option("story_stealth_mode_cooldown_period")) { + set_option_integer("story_stealth_mode_cooldown_period", 3600); + } set_option_empty("archive_and_mute_new_chats_from_unknown_users"); set_option_empty("chat_filter_count_max");