Add userFullInfo.has_sponsored_messages_enabled.

This commit is contained in:
levlam 2024-04-23 22:32:18 +03:00
parent 9fa1656557
commit 0d2a6ccf14
3 changed files with 12 additions and 4 deletions

View File

@ -954,6 +954,7 @@ botInfo short_description:string description:string photo:photo animation:animat
//@has_private_forwards True, if the user can't be linked in forwarded messages due to their privacy settings
//@has_restricted_voice_and_video_note_messages True, if voice and video notes can't be sent or forwarded to the user
//@has_pinned_stories True, if the user has pinned stories
//@has_sponsored_messages_enabled True, if the user always enabled sponsored messages; known only for the current user
//@need_phone_number_privacy_exception True, if the current user needs to explicitly allow to share their phone number with the user when the method addContact is used
//@set_chat_background True, if the user set chat background for both chat users and it wasn't reverted yet
//@bio A short user bio; may be null for bots
@ -963,7 +964,7 @@ botInfo short_description:string description:string photo:photo animation:animat
//@group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user
//@business_info Information about business settings for Telegram Business accounts; may be null if none
//@bot_info For bots, information about the bot; may be null if the user isn't a bot
userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_pinned_stories:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 premium_gift_options:vector<premiumPaymentOption> group_in_common_count:int32 business_info:businessInfo bot_info:botInfo = UserFullInfo;
userFullInfo personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_pinned_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 premium_gift_options:vector<premiumPaymentOption> group_in_common_count:int32 business_info:businessInfo bot_info:botInfo = UserFullInfo;
//@description Represents a list of users @total_count Approximate total number of users found @user_ids A list of user identifiers
users total_count:int32 user_ids:vector<int53> = Users;

View File

@ -1641,6 +1641,7 @@ void UserManager::UserFull::store(StorerT &storer) const {
STORE_FLAG(has_business_info); // 25
STORE_FLAG(has_birthdate);
STORE_FLAG(has_personal_channel_id);
STORE_FLAG(sponsored_enabled);
END_STORE_FLAGS();
if (has_about) {
store(about, storer);
@ -1743,6 +1744,7 @@ void UserManager::UserFull::parse(ParserT &parser) {
PARSE_FLAG(has_business_info);
PARSE_FLAG(has_birthdate);
PARSE_FLAG(has_personal_channel_id);
PARSE_FLAG(sponsored_enabled);
END_PARSE_FLAGS();
if (has_about) {
parse(about, parser);
@ -6729,13 +6731,15 @@ void UserManager::on_get_user_full(telegram_api::object_ptr<telegram_api::userFu
bool has_pinned_stories = user->stories_pinned_available_;
auto birthdate = Birthdate(std::move(user->birthday_));
auto personal_channel_id = ChannelId(user->personal_channel_id_);
auto sponsored_enabled = user->sponsored_enabled_;
if (user_full->can_be_called != can_be_called || user_full->supports_video_calls != supports_video_calls ||
user_full->has_private_calls != has_private_calls ||
user_full->group_administrator_rights != group_administrator_rights ||
user_full->broadcast_administrator_rights != broadcast_administrator_rights ||
user_full->premium_gift_options != premium_gift_options ||
user_full->voice_messages_forbidden != voice_messages_forbidden ||
user_full->can_pin_messages != can_pin_messages || user_full->has_pinned_stories != has_pinned_stories) {
user_full->can_pin_messages != can_pin_messages || user_full->has_pinned_stories != has_pinned_stories ||
user_full->sponsored_enabled != sponsored_enabled) {
user_full->can_be_called = can_be_called;
user_full->supports_video_calls = supports_video_calls;
user_full->has_private_calls = has_private_calls;
@ -6745,6 +6749,7 @@ void UserManager::on_get_user_full(telegram_api::object_ptr<telegram_api::userFu
user_full->voice_messages_forbidden = voice_messages_forbidden;
user_full->can_pin_messages = can_pin_messages;
user_full->has_pinned_stories = has_pinned_stories;
user_full->sponsored_enabled = sponsored_enabled;
user_full->is_changed = true;
}
@ -7071,6 +7076,7 @@ void UserManager::drop_user_full(UserId user_id) {
user_full->read_dates_private = false;
user_full->contact_require_premium = false;
user_full->birthdate = {};
user_full->sponsored_enabled = false;
user_full->is_changed = true;
update_user_full(user_full, user_id, "drop_user_full");
@ -7852,8 +7858,8 @@ td_api::object_ptr<td_api::userFullInfo> UserManager::get_user_full_info_object(
get_chat_photo_object(td_->file_manager_.get(), user_full->fallback_photo), block_list_id.get_block_list_object(),
user_full->can_be_called, user_full->supports_video_calls, user_full->has_private_calls,
!user_full->private_forward_name.empty(), voice_messages_forbidden, user_full->has_pinned_stories,
user_full->need_phone_number_privacy_exception, user_full->wallpaper_overridden, std::move(bio_object),
user_full->birthdate.get_birthdate_object(), personal_chat_id,
user_full->sponsored_enabled, user_full->need_phone_number_privacy_exception, user_full->wallpaper_overridden,
std::move(bio_object), user_full->birthdate.get_birthdate_object(), personal_chat_id,
get_premium_payment_options_object(user_full->premium_gift_options), user_full->common_chat_count,
std::move(business_info), std::move(bot_info));
}

View File

@ -598,6 +598,7 @@ class UserManager final : public Actor {
bool has_pinned_stories = false;
bool read_dates_private = false;
bool contact_require_premium = false;
bool sponsored_enabled = false;
bool is_common_chat_count_changed = true;
bool is_being_updated = false;