Skip to content

Commit 13b6c59

Browse files
committed
Process 11 more options as generic integer options.
1 parent bc285e8 commit 13b6c59

File tree

1 file changed

+11
-88
lines changed

1 file changed

+11
-88
lines changed

td/telegram/ConfigManager.cpp

Lines changed: 11 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,26 +1332,16 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
13321332
string animation_search_provider;
13331333
string animation_search_emojis;
13341334
bool can_archive_and_mute_new_chats_from_unknown_users = false;
1335-
int32 chat_read_mark_expire_period = 0;
1336-
int32 chat_read_mark_size_threshold = 0;
13371335
double animated_emoji_zoom = 0.0;
1338-
int32 reactions_uniq_max = 0;
13391336
vector<string> premium_features;
13401337
auto &premium_limit_keys = get_premium_limit_keys();
13411338
string premium_bot_username;
13421339
string premium_invoice_slug;
13431340
bool is_premium_available = false;
1344-
int32 stickers_premium_by_emoji_num = 0;
1345-
int32 stickers_normal_by_emoji_per_premium_num = 2;
1346-
int32 telegram_antispam_group_size_min = 100;
1347-
int32 topics_pinned_limit = -1;
13481341
vector<string> fragment_prefixes;
13491342
bool premium_gift_attach_menu_icon = false;
13501343
bool premium_gift_text_field_icon = false;
1351-
int32 dialog_filter_update_period = 300;
13521344
// bool archive_all_stories = false;
1353-
int32 story_viewers_expire_period = 86400;
1354-
int64 stories_changelog_user_id = UserManager::get_service_notifications_user_id().get();
13551345
int32 transcribe_audio_trial_weekly_number = 0;
13561346
int32 transcribe_audio_trial_duration_max = 0;
13571347
int32 transcribe_audio_trial_cooldown_until = 0;
@@ -1380,6 +1370,9 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
13801370
{"channel_profile_bg_icon_level_min", ""},
13811371
{"channel_restrict_sponsored_level_min", ""},
13821372
{"channel_wallpaper_level_min", ""},
1373+
{"chat_read_mark_expire_period", ""},
1374+
{"chat_read_mark_size_threshold", ""},
1375+
{"chatlist_update_period", "chat_folder_new_chats_update_period"},
13831376
{"conference_call_size_limit", "group_call_participant_count_max"},
13841377
{"factcheck_length_limit", "fact_check_length_max"},
13851378
{"giveaway_add_peers_max", "giveaway_additional_chat_count_max"},
@@ -1401,6 +1394,7 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
14011394
{"quick_reply_messages_limit", "quick_reply_shortcut_message_count_max"},
14021395
{"quote_length_max", "message_reply_quote_length_max"},
14031396
{"reactions_in_chat_max", "chat_available_reaction_count_max"},
1397+
{"reactions_uniq_max", ""},
14041398
{"reactions_user_max_default", ""},
14051399
{"reactions_user_max_premium", ""},
14061400
{"ringtone_duration_max", "notification_sound_duration_max"},
@@ -1423,12 +1417,18 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
14231417
{"stars_subscription_amount_max", "subscription_star_count_max"},
14241418
{"stars_usd_sell_rate_x1000", "usd_to_thousand_star_rate"},
14251419
{"stars_usd_withdraw_rate_x1000", "thousand_star_to_usd_rate"},
1420+
{"stickers_premium_by_emoji_num", ""},
1421+
{"stickers_normal_by_emoji_per_premium_num", ""},
14261422
{"stories_area_url_max", "story_link_area_count_max"},
1423+
{"stories_changelog_user_id", ""},
14271424
{"stories_pinned_to_top_count_max", "pinned_story_count_max"},
14281425
{"stories_stealth_cooldown_period", "story_stealth_mode_cooldown_period"},
14291426
{"stories_stealth_future_period", "story_stealth_mode_future_period"},
14301427
{"stories_stealth_past_period", "story_stealth_mode_past_period"},
1428+
{"story_viewers_expire_period", "story_viewers_expiration_delay"},
1429+
{"telegram_antispam_group_size_min", "aggressive_anti_spam_supergroup_member_count_min"},
14311430
{"telegram_antispam_user_id", "anti_spam_bot_user_id"},
1431+
{"topics_pinned_limit", "pinned_forum_topic_count_max"},
14321432
{"upload_premium_speedup_download", "premium_download_speedup"},
14331433
{"upload_premium_speedup_notify_period", ""},
14341434
{"upload_premium_speedup_upload", "premium_upload_speedup"}};
@@ -1678,18 +1678,6 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
16781678
}
16791679
continue;
16801680
}
1681-
if (key == "chat_read_mark_expire_period") {
1682-
chat_read_mark_expire_period = get_json_value_int(std::move(key_value->value_), key);
1683-
continue;
1684-
}
1685-
if (key == "chat_read_mark_size_threshold") {
1686-
chat_read_mark_size_threshold = get_json_value_int(std::move(key_value->value_), key);
1687-
continue;
1688-
}
1689-
if (key == "reactions_uniq_max") {
1690-
reactions_uniq_max = get_json_value_int(std::move(key_value->value_), key);
1691-
continue;
1692-
}
16931681
if (key == "premium_promo_order") {
16941682
if (value->get_id() == telegram_api::jsonArray::ID) {
16951683
auto features = std::move(static_cast<telegram_api::jsonArray *>(value)->value_);
@@ -1735,18 +1723,6 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
17351723
is_premium_available = !get_json_value_bool(std::move(key_value->value_), key);
17361724
continue;
17371725
}
1738-
if (key == "stickers_premium_by_emoji_num") {
1739-
stickers_premium_by_emoji_num = get_json_value_int(std::move(key_value->value_), key);
1740-
continue;
1741-
}
1742-
if (key == "stickers_normal_by_emoji_per_premium_num") {
1743-
stickers_normal_by_emoji_per_premium_num = get_json_value_int(std::move(key_value->value_), key);
1744-
continue;
1745-
}
1746-
if (key == "telegram_antispam_group_size_min") {
1747-
telegram_antispam_group_size_min = get_json_value_int(std::move(key_value->value_), key);
1748-
continue;
1749-
}
17501726
if (key == "fragment_prefixes") {
17511727
if (value->get_id() == telegram_api::jsonArray::ID) {
17521728
auto prefixes = std::move(static_cast<telegram_api::jsonArray *>(value)->value_);
@@ -1764,10 +1740,6 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
17641740
}
17651741
continue;
17661742
}
1767-
if (key == "topics_pinned_limit") {
1768-
topics_pinned_limit = get_json_value_int(std::move(key_value->value_), key);
1769-
continue;
1770-
}
17711743
if (key == "premium_gift_attach_menu_icon") {
17721744
premium_gift_attach_menu_icon = get_json_value_bool(std::move(key_value->value_), key);
17731745
continue;
@@ -1776,22 +1748,10 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
17761748
premium_gift_text_field_icon = get_json_value_bool(std::move(key_value->value_), key);
17771749
continue;
17781750
}
1779-
if (key == "chatlist_update_period") {
1780-
dialog_filter_update_period = get_json_value_int(std::move(key_value->value_), key);
1781-
continue;
1782-
}
17831751
if (key == "stories_all_hidden") {
17841752
// archive_all_stories = get_json_value_bool(std::move(key_value->value_), key);
17851753
continue;
17861754
}
1787-
if (key == "story_viewers_expire_period") {
1788-
story_viewers_expire_period = get_json_value_int(std::move(key_value->value_), key);
1789-
continue;
1790-
}
1791-
if (key == "stories_changelog_user_id") {
1792-
stories_changelog_user_id = get_json_value_long(std::move(key_value->value_), key);
1793-
continue;
1794-
}
17951755
if (key == "stories_venue_search_username") {
17961756
G()->set_option_string("venue_search_bot_username", get_json_value_string(std::move(key_value->value_), key));
17971757
continue;
@@ -2005,27 +1965,7 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
20051965
options.set_option_boolean("can_archive_and_mute_new_chats_from_unknown_users",
20061966
can_archive_and_mute_new_chats_from_unknown_users);
20071967
}
2008-
if (chat_read_mark_expire_period <= 0) {
2009-
options.set_option_empty("chat_read_mark_expire_period");
2010-
} else {
2011-
options.set_option_integer("chat_read_mark_expire_period", chat_read_mark_expire_period);
2012-
}
2013-
if (chat_read_mark_size_threshold <= 0) {
2014-
options.set_option_empty("chat_read_mark_size_threshold");
2015-
} else {
2016-
options.set_option_integer("chat_read_mark_size_threshold", chat_read_mark_size_threshold);
2017-
}
2018-
if (reactions_uniq_max <= 0 || reactions_uniq_max == 11) {
2019-
options.set_option_empty("reactions_uniq_max");
2020-
} else {
2021-
options.set_option_integer("reactions_uniq_max", reactions_uniq_max);
2022-
}
2023-
if (telegram_antispam_group_size_min >= 0) {
2024-
options.set_option_integer("aggressive_anti_spam_supergroup_member_count_min", telegram_antispam_group_size_min);
2025-
}
2026-
if (dialog_filter_update_period > 0) {
2027-
options.set_option_integer("chat_folder_new_chats_update_period", dialog_filter_update_period);
2028-
}
1968+
20291969
options.set_option_boolean("can_accept_calls", can_accept_calls);
20301970

20311971
if (!is_premium_available) {
@@ -2049,11 +1989,6 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
20491989
} else {
20501990
options.set_option_string("premium_invoice_slug", premium_invoice_slug);
20511991
}
2052-
if (topics_pinned_limit >= 0) {
2053-
options.set_option_integer("pinned_forum_topic_count_max", topics_pinned_limit);
2054-
} else {
2055-
options.set_option_empty("pinned_forum_topic_count_max");
2056-
}
20571992

20581993
if (premium_gift_attach_menu_icon) {
20591994
options.set_option_boolean("gift_premium_from_attachment_menu", premium_gift_attach_menu_icon);
@@ -2065,29 +2000,17 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
20652000
} else {
20662001
options.set_option_empty("gift_premium_from_input_field");
20672002
}
2068-
if (stories_changelog_user_id != UserManager::get_service_notifications_user_id().get()) {
2069-
options.set_option_integer("stories_changelog_user_id", stories_changelog_user_id);
2070-
} else {
2071-
options.set_option_empty("stories_changelog_user_id");
2072-
}
20732003
if (can_edit_fact_check) {
20742004
options.set_option_boolean("can_edit_fact_check", can_edit_fact_check);
20752005
} else {
20762006
options.set_option_empty("can_edit_fact_check");
20772007
}
20782008

2079-
if (story_viewers_expire_period >= 0) {
2080-
options.set_option_integer("story_viewers_expiration_delay", story_viewers_expire_period);
2081-
}
2082-
20832009
if (!options.get_option_boolean("need_synchronize_archive_all_stories")) {
20842010
// options.set_option_boolean("archive_all_stories", archive_all_stories);
20852011
}
20862012
options.set_option_empty("archive_all_stories");
20872013

2088-
options.set_option_integer("stickers_premium_by_emoji_num", stickers_premium_by_emoji_num);
2089-
options.set_option_integer("stickers_normal_by_emoji_per_premium_num", stickers_normal_by_emoji_per_premium_num);
2090-
20912014
options.set_option_boolean("can_withdraw_chat_revenue", channel_revenue_withdrawal_enabled);
20922015
options.set_option_boolean("need_premium_for_new_chat_privacy", need_premium_for_new_chat_privacy);
20932016

0 commit comments

Comments
 (0)