From 0823f5b169caa4f3649b52fd2ae9615e9b5a8c51 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 5 Jun 2023 15:20:24 +0300 Subject: [PATCH] Add user.stories_are_archived flag. --- td/generate/scheme/td_api.tl | 3 ++- td/telegram/ContactsManager.cpp | 14 +++++++++----- td/telegram/ContactsManager.h | 1 + 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index eaaa3086a..e0e810de5 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -713,11 +713,12 @@ usernames active_usernames:vector disabled_usernames:vector edit //@restriction_reason If non-empty, it contains a human-readable description of the reason why access to this user must be restricted //@is_scam True, if many users reported this user as a scam //@is_fake True, if many users reported this user as a fake account +//@stories_are_archived True, if stories of the user aren't available on the main chat list //@have_access If false, the user is inaccessible, and the only information known about the user is inside this class. Identifier of the user can't be passed to any method //@type Type of the user //@language_code IETF language tag of the user's language; only available to bots //@added_to_attachment_menu True, if the user added the current bot to attachment menu; only available to bots -user id:int53 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool is_verified:Bool is_premium:Bool is_support:Bool restriction_reason:string is_scam:Bool is_fake:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; +user id:int53 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool is_verified:Bool is_premium:Bool is_support:Bool restriction_reason:string is_scam:Bool is_fake:Bool stories_are_archived:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; //@description Contains information about a bot diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 9889c092a..b49d0f9d9 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -4462,6 +4462,7 @@ void ContactsManager::User::store(StorerT &storer) const { if (has_flags2) { BEGIN_STORE_FLAGS(); STORE_FLAG(is_close_friend); + STORE_FLAG(stories_hidden); END_STORE_FLAGS(); } store(first_name, storer); @@ -4549,6 +4550,7 @@ void ContactsManager::User::parse(ParserT &parser) { if (has_flags2) { BEGIN_PARSE_FLAGS(); PARSE_FLAG(is_close_friend); + PARSE_FLAG(stories_hidden); END_PARSE_FLAGS(); } parse(first_name, parser); @@ -10284,6 +10286,7 @@ void ContactsManager::on_get_user(tl_object_ptr &&user_ptr, bool has_bot_info_version = (flags & USER_FLAG_HAS_BOT_INFO_VERSION) != 0; bool need_apply_min_photo = (flags & USER_FLAG_NEED_APPLY_MIN_PHOTO) != 0; bool is_fake = (flags & USER_FLAG_IS_FAKE) != 0; + bool stories_hidden = user->stories_hidden_; LOG_IF(ERROR, !can_join_groups && !is_bot) << "Receive not bot " << user_id << " which can't join groups from " << source; @@ -10345,8 +10348,9 @@ void ContactsManager::on_get_user(tl_object_ptr &&user_ptr, LOG(DEBUG) << "Info has changed for " << user_id; u->is_changed = true; } - if (is_received && attach_menu_enabled != u->attach_menu_enabled) { + if (is_received && (attach_menu_enabled != u->attach_menu_enabled || stories_hidden != u->stories_hidden)) { u->attach_menu_enabled = attach_menu_enabled; + u->stories_hidden = stories_hidden; u->is_changed = true; } if (is_premium != u->is_premium) { @@ -18709,8 +18713,8 @@ td_api::object_ptr ContactsManager::get_update_unknown_user_ auto have_access = user_id == get_my_id() || user_messages_.count(user_id) != 0; return td_api::make_object(td_api::make_object( user_id.get(), "", "", nullptr, "", td_api::make_object(), nullptr, nullptr, false, - false, false, false, false, false, "", false, false, have_access, td_api::make_object(), - "", false)); + false, false, false, false, false, "", false, false, false, have_access, + td_api::make_object(), "", false)); } int64 ContactsManager::get_user_id_object(UserId user_id, const char *source) const { @@ -18747,8 +18751,8 @@ tl_object_ptr ContactsManager::get_user_object(UserId user_id, con user_id.get(), u->first_name, u->last_name, u->usernames.get_usernames_object(), u->phone_number, get_user_status_object(user_id, u), get_profile_photo_object(td_->file_manager_.get(), u->photo), std::move(emoji_status), u->is_contact, u->is_mutual_contact, u->is_close_friend, u->is_verified, u->is_premium, - u->is_support, get_restriction_reason_description(u->restriction_reasons), u->is_scam, u->is_fake, have_access, - std::move(type), u->language_code, u->attach_menu_enabled); + u->is_support, get_restriction_reason_description(u->restriction_reasons), u->is_scam, u->is_fake, + u->stories_hidden, have_access, std::move(type), u->language_code, u->attach_menu_enabled); } vector ContactsManager::get_user_ids_object(const vector &user_ids, const char *source) const { diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h index ecab949ca..f2f73ea4b 100644 --- a/td/telegram/ContactsManager.h +++ b/td/telegram/ContactsManager.h @@ -781,6 +781,7 @@ class ContactsManager final : public Actor { bool need_apply_min_photo = false; bool can_be_added_to_attach_menu = false; bool attach_menu_enabled = false; + bool stories_hidden = false; bool is_photo_inited = false;