diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 06b6aed40..0173c69a6 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -1070,6 +1070,7 @@ user id:int53 first_name:string last_name:string usernames:usernames phone_numbe //@animation Animation shown in the chat with the bot if the chat is empty; may be null //@menu_button Information about a button to show instead of the bot commands menu button; may be null if ordinary bot commands menu must be shown //@commands List of the bot commands +//@privacy_policy_url The HTTP link to the privacy policy of the bot. If empty, then /privacy command must be used if supported by the bot. If the command isn't supported, then https://telegram.org/privacy-tpa must be opened //@default_group_administrator_rights Default administrator rights for adding the bot to basic group and supergroup chats; may be null //@default_channel_administrator_rights Default administrator rights for adding the bot to channels; may be null //@has_media_previews True, if the bot has media previews @@ -1077,7 +1078,7 @@ user id:int53 first_name:string last_name:string usernames:usernames phone_numbe //@edit_description_link The internal link, which can be used to edit bot description; may be null //@edit_description_media_link The internal link, which can be used to edit the photo or animation shown in the chat with the bot if the chat is empty; may be null //@edit_settings_link The internal link, which can be used to edit bot settings; may be null -botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; +botInfo short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; //@description Contains full information about a user //@personal_photo User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. diff --git a/td/telegram/UserManager.cpp b/td/telegram/UserManager.cpp index ef0e8d512..ad034f8e6 100644 --- a/td/telegram/UserManager.cpp +++ b/td/telegram/UserManager.cpp @@ -1684,6 +1684,7 @@ void UserManager::UserFull::store(StorerT &storer) const { bool has_birthdate = !birthdate.is_empty(); bool has_personal_channel_id = personal_channel_id.is_valid(); bool has_flags2 = true; + bool has_privacy_policy_url = !privacy_policy_url.empty(); BEGIN_STORE_FLAGS(); STORE_FLAG(has_about); STORE_FLAG(is_blocked); @@ -1719,6 +1720,7 @@ void UserManager::UserFull::store(StorerT &storer) const { if (has_flags2) { BEGIN_STORE_FLAGS(); STORE_FLAG(has_preview_medias); + STORE_FLAG(has_privacy_policy_url); END_STORE_FLAGS(); } if (has_about) { @@ -1772,6 +1774,9 @@ void UserManager::UserFull::store(StorerT &storer) const { if (has_personal_channel_id) { store(personal_channel_id, storer); } + if (has_privacy_policy_url) { + store(privacy_policy_url, storer); + } } template @@ -1794,6 +1799,7 @@ void UserManager::UserFull::parse(ParserT &parser) { bool has_birthdate; bool has_personal_channel_id; bool has_flags2; + bool has_privacy_policy_url = false; BEGIN_PARSE_FLAGS(); PARSE_FLAG(has_about); PARSE_FLAG(is_blocked); @@ -1829,6 +1835,7 @@ void UserManager::UserFull::parse(ParserT &parser) { if (has_flags2) { BEGIN_PARSE_FLAGS(); PARSE_FLAG(has_preview_medias); + PARSE_FLAG(has_privacy_policy_url); END_PARSE_FLAGS(); } if (has_about) { @@ -1882,6 +1889,9 @@ void UserManager::UserFull::parse(ParserT &parser) { if (has_personal_channel_id) { parse(personal_channel_id, parser); } + if (has_privacy_policy_url) { + parse(privacy_policy_url, parser); + } } template @@ -6946,6 +6956,11 @@ void UserManager::on_get_user_full(telegram_api::object_ptrbot_info_->commands_)); on_update_user_full_menu_button(user_full, user_id, std::move(user->bot_info_->menu_button_)); on_update_user_full_has_preview_medias(user_full, user_id, std::move(user->bot_info_->has_preview_medias_)); + + if (user_full->privacy_policy_url != user->bot_info_->privacy_policy_url_) { + user_full->privacy_policy_url = std::move(user->bot_info_->privacy_policy_url_); + user_full->is_changed = true; + } } if (user_full->description != description) { user_full->description = std::move(description); @@ -7224,6 +7239,7 @@ void UserManager::drop_user_full(UserId user_id) { user_full->birthdate = {}; user_full->sponsored_enabled = false; user_full->has_preview_medias = false; + user_full->privacy_policy_url = string(); user_full->is_changed = true; update_user_full(user_full, user_id, "drop_user_full"); @@ -7956,7 +7972,7 @@ td_api::object_ptr UserManager::get_user_full_info_object( user_full->about, user_full->description, get_photo_object(td_->file_manager_.get(), user_full->description_photo), td_->animations_manager_->get_animation_object(user_full->description_animation_file_id), - std::move(menu_button), std::move(commands), + std::move(menu_button), std::move(commands), user_full->privacy_policy_url, user_full->group_administrator_rights == AdministratorRights() ? nullptr : user_full->group_administrator_rights.get_chat_administrator_rights_object(), diff --git a/td/telegram/UserManager.h b/td/telegram/UserManager.h index 3f7254aac..694821859 100644 --- a/td/telegram/UserManager.h +++ b/td/telegram/UserManager.h @@ -587,6 +587,7 @@ class UserManager final : public Actor { unique_ptr menu_button; vector commands; + string privacy_policy_url; AdministratorRights group_administrator_rights; AdministratorRights broadcast_administrator_rights;