Add user.profile_accent_color_id/profile_background_custom_emoji_id.
This commit is contained in:
parent
fb03b92fa2
commit
45ca900759
@ -786,8 +786,10 @@ usernames active_usernames:vector<string> disabled_usernames:vector<string> edit
|
|||||||
//@phone_number Phone number of the user
|
//@phone_number Phone number of the user
|
||||||
//@status Current online status of the user
|
//@status Current online status of the user
|
||||||
//@profile_photo Profile photo of the user; may be null
|
//@profile_photo Profile photo of the user; may be null
|
||||||
//@accent_color_id Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview
|
//@accent_color_id Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview. For Telegram Premium users only
|
||||||
//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header background; 0 if none. For Telegram Premium users only
|
//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header background; 0 if none. For Telegram Premium users only
|
||||||
|
//@profile_accent_color_id Identifier of the accent color for the user's profile; -1 if none. For Telegram Premium users only
|
||||||
|
//@profile_background_custom_emoji_id Identifier of a custom emoji to be shown on the background of the user's profile; 0 if none. For Telegram Premium users only
|
||||||
//@emoji_status Emoji status to be shown instead of the default Telegram Premium badge; may be null. For Telegram Premium users only
|
//@emoji_status Emoji status to be shown instead of the default Telegram Premium badge; may be null. For Telegram Premium users only
|
||||||
//@is_contact The user is a contact of the current user
|
//@is_contact The user is a contact of the current user
|
||||||
//@is_mutual_contact The user is a contact of the current user and the current user is a contact of the user
|
//@is_mutual_contact The user is a contact of the current user and the current user is a contact of the user
|
||||||
@ -804,7 +806,7 @@ usernames active_usernames:vector<string> disabled_usernames:vector<string> edit
|
|||||||
//@type Type of the user
|
//@type Type of the user
|
||||||
//@language_code IETF language tag of the user's language; only available to bots
|
//@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
|
//@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 accent_color_id:int32 background_custom_emoji_id:int64 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 has_active_stories:Bool has_unread_active_stories: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 accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 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 has_active_stories:Bool has_unread_active_stories:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User;
|
||||||
|
|
||||||
|
|
||||||
//@description Contains information about a bot
|
//@description Contains information about a bot
|
||||||
|
@ -4324,6 +4324,8 @@ void ContactsManager::User::store(StorerT &storer) const {
|
|||||||
bool has_max_active_story_id_next_reload_time = max_active_story_id_next_reload_time > Time::now();
|
bool has_max_active_story_id_next_reload_time = max_active_story_id_next_reload_time > Time::now();
|
||||||
bool has_accent_color_id = accent_color_id.is_valid();
|
bool has_accent_color_id = accent_color_id.is_valid();
|
||||||
bool has_background_custom_emoji_id = background_custom_emoji_id.is_valid();
|
bool has_background_custom_emoji_id = background_custom_emoji_id.is_valid();
|
||||||
|
bool has_profile_accent_color_id = profile_accent_color_id.is_valid();
|
||||||
|
bool has_profile_background_custom_emoji_id = profile_background_custom_emoji_id.is_valid();
|
||||||
BEGIN_STORE_FLAGS();
|
BEGIN_STORE_FLAGS();
|
||||||
STORE_FLAG(is_received);
|
STORE_FLAG(is_received);
|
||||||
STORE_FLAG(is_verified);
|
STORE_FLAG(is_verified);
|
||||||
@ -4366,6 +4368,8 @@ void ContactsManager::User::store(StorerT &storer) const {
|
|||||||
STORE_FLAG(has_max_active_story_id_next_reload_time);
|
STORE_FLAG(has_max_active_story_id_next_reload_time);
|
||||||
STORE_FLAG(has_accent_color_id);
|
STORE_FLAG(has_accent_color_id);
|
||||||
STORE_FLAG(has_background_custom_emoji_id);
|
STORE_FLAG(has_background_custom_emoji_id);
|
||||||
|
STORE_FLAG(has_profile_accent_color_id);
|
||||||
|
STORE_FLAG(has_profile_background_custom_emoji_id);
|
||||||
END_STORE_FLAGS();
|
END_STORE_FLAGS();
|
||||||
}
|
}
|
||||||
store(first_name, storer);
|
store(first_name, storer);
|
||||||
@ -4416,6 +4420,12 @@ void ContactsManager::User::store(StorerT &storer) const {
|
|||||||
if (has_background_custom_emoji_id) {
|
if (has_background_custom_emoji_id) {
|
||||||
store(background_custom_emoji_id, storer);
|
store(background_custom_emoji_id, storer);
|
||||||
}
|
}
|
||||||
|
if (has_profile_accent_color_id) {
|
||||||
|
store(profile_accent_color_id, storer);
|
||||||
|
}
|
||||||
|
if (has_profile_background_custom_emoji_id) {
|
||||||
|
store(profile_background_custom_emoji_id, storer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ParserT>
|
template <class ParserT>
|
||||||
@ -4439,6 +4449,8 @@ void ContactsManager::User::parse(ParserT &parser) {
|
|||||||
bool has_max_active_story_id_next_reload_time = false;
|
bool has_max_active_story_id_next_reload_time = false;
|
||||||
bool has_accent_color_id = false;
|
bool has_accent_color_id = false;
|
||||||
bool has_background_custom_emoji_id = false;
|
bool has_background_custom_emoji_id = false;
|
||||||
|
bool has_profile_accent_color_id = false;
|
||||||
|
bool has_profile_background_custom_emoji_id = false;
|
||||||
BEGIN_PARSE_FLAGS();
|
BEGIN_PARSE_FLAGS();
|
||||||
PARSE_FLAG(is_received);
|
PARSE_FLAG(is_received);
|
||||||
PARSE_FLAG(is_verified);
|
PARSE_FLAG(is_verified);
|
||||||
@ -4481,6 +4493,8 @@ void ContactsManager::User::parse(ParserT &parser) {
|
|||||||
PARSE_FLAG(has_max_active_story_id_next_reload_time);
|
PARSE_FLAG(has_max_active_story_id_next_reload_time);
|
||||||
PARSE_FLAG(has_accent_color_id);
|
PARSE_FLAG(has_accent_color_id);
|
||||||
PARSE_FLAG(has_background_custom_emoji_id);
|
PARSE_FLAG(has_background_custom_emoji_id);
|
||||||
|
PARSE_FLAG(has_profile_accent_color_id);
|
||||||
|
PARSE_FLAG(has_profile_background_custom_emoji_id);
|
||||||
END_PARSE_FLAGS();
|
END_PARSE_FLAGS();
|
||||||
}
|
}
|
||||||
parse(first_name, parser);
|
parse(first_name, parser);
|
||||||
@ -4559,6 +4573,12 @@ void ContactsManager::User::parse(ParserT &parser) {
|
|||||||
if (has_background_custom_emoji_id) {
|
if (has_background_custom_emoji_id) {
|
||||||
parse(background_custom_emoji_id, parser);
|
parse(background_custom_emoji_id, parser);
|
||||||
}
|
}
|
||||||
|
if (has_profile_accent_color_id) {
|
||||||
|
parse(profile_accent_color_id, parser);
|
||||||
|
}
|
||||||
|
if (has_profile_background_custom_emoji_id) {
|
||||||
|
parse(profile_background_custom_emoji_id, parser);
|
||||||
|
}
|
||||||
|
|
||||||
if (!check_utf8(first_name)) {
|
if (!check_utf8(first_name)) {
|
||||||
LOG(ERROR) << "Have invalid first name \"" << first_name << '"';
|
LOG(ERROR) << "Have invalid first name \"" << first_name << '"';
|
||||||
@ -10747,6 +10767,14 @@ void ContactsManager::on_get_user(tl_object_ptr<telegram_api::User> &&user_ptr,
|
|||||||
: AccentColorId()));
|
: AccentColorId()));
|
||||||
on_update_user_background_custom_emoji_id(
|
on_update_user_background_custom_emoji_id(
|
||||||
u, user_id, (user->color_ != nullptr ? CustomEmojiId(user->color_->background_emoji_id_) : CustomEmojiId()));
|
u, user_id, (user->color_ != nullptr ? CustomEmojiId(user->color_->background_emoji_id_) : CustomEmojiId()));
|
||||||
|
on_update_user_profile_accent_color_id(
|
||||||
|
u, user_id,
|
||||||
|
(user->profile_color_ != nullptr && (user->profile_color_->flags_ & telegram_api::peerColor::COLOR_MASK) != 0
|
||||||
|
? AccentColorId(user->profile_color_->color_)
|
||||||
|
: AccentColorId()));
|
||||||
|
on_update_user_profile_background_custom_emoji_id(
|
||||||
|
u, user_id,
|
||||||
|
(user->profile_color_ != nullptr ? CustomEmojiId(user->profile_color_->background_emoji_id_) : CustomEmojiId()));
|
||||||
if (is_me_regular_user && is_received) {
|
if (is_me_regular_user && is_received) {
|
||||||
on_update_user_stories_hidden(u, user_id, stories_hidden);
|
on_update_user_stories_hidden(u, user_id, stories_hidden);
|
||||||
}
|
}
|
||||||
@ -12301,6 +12329,12 @@ void ContactsManager::update_user(User *u, UserId user_id, bool from_binlog, boo
|
|||||||
});
|
});
|
||||||
u->is_background_custom_emoji_id_changed = false;
|
u->is_background_custom_emoji_id_changed = false;
|
||||||
}
|
}
|
||||||
|
if (u->is_profile_accent_color_id_changed) {
|
||||||
|
u->is_profile_accent_color_id_changed = false;
|
||||||
|
}
|
||||||
|
if (u->is_profile_background_custom_emoji_id_changed) {
|
||||||
|
u->is_profile_background_custom_emoji_id_changed = false;
|
||||||
|
}
|
||||||
if (u->is_phone_number_changed) {
|
if (u->is_phone_number_changed) {
|
||||||
if (!u->phone_number.empty() && !td_->auth_manager_->is_bot()) {
|
if (!u->phone_number.empty() && !td_->auth_manager_->is_bot()) {
|
||||||
resolved_phone_numbers_[u->phone_number] = user_id;
|
resolved_phone_numbers_[u->phone_number] = user_id;
|
||||||
@ -13937,6 +13971,26 @@ void ContactsManager::on_update_user_background_custom_emoji_id(User *u, UserId
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContactsManager::on_update_user_profile_accent_color_id(User *u, UserId user_id, AccentColorId accent_color_id) {
|
||||||
|
if (!accent_color_id.is_valid()) {
|
||||||
|
accent_color_id = AccentColorId();
|
||||||
|
}
|
||||||
|
if (u->profile_accent_color_id != accent_color_id) {
|
||||||
|
u->profile_accent_color_id = accent_color_id;
|
||||||
|
u->is_profile_accent_color_id_changed = true;
|
||||||
|
u->is_changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContactsManager::on_update_user_profile_background_custom_emoji_id(User *u, UserId user_id,
|
||||||
|
CustomEmojiId background_custom_emoji_id) {
|
||||||
|
if (u->profile_background_custom_emoji_id != background_custom_emoji_id) {
|
||||||
|
u->profile_background_custom_emoji_id = background_custom_emoji_id;
|
||||||
|
u->is_profile_background_custom_emoji_id_changed = true;
|
||||||
|
u->is_changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ContactsManager::on_update_user_emoji_status(UserId user_id,
|
void ContactsManager::on_update_user_emoji_status(UserId user_id,
|
||||||
tl_object_ptr<telegram_api::EmojiStatus> &&emoji_status) {
|
tl_object_ptr<telegram_api::EmojiStatus> &&emoji_status) {
|
||||||
if (!user_id.is_valid()) {
|
if (!user_id.is_valid()) {
|
||||||
@ -19823,9 +19877,9 @@ td_api::object_ptr<td_api::updateUser> ContactsManager::get_update_unknown_user_
|
|||||||
auto have_access = user_id == get_my_id() || user_messages_.count(user_id) != 0;
|
auto have_access = user_id == get_my_id() || user_messages_.count(user_id) != 0;
|
||||||
return td_api::make_object<td_api::updateUser>(td_api::make_object<td_api::user>(
|
return td_api::make_object<td_api::updateUser>(td_api::make_object<td_api::user>(
|
||||||
user_id.get(), "", "", nullptr, "", td_api::make_object<td_api::userStatusEmpty>(), nullptr,
|
user_id.get(), "", "", nullptr, "", td_api::make_object<td_api::userStatusEmpty>(), nullptr,
|
||||||
td_->theme_manager_->get_accent_color_id_object(AccentColorId(user_id)), 0, nullptr, false, false, false, false,
|
td_->theme_manager_->get_accent_color_id_object(AccentColorId(user_id)), 0, -1, 0, nullptr, false, false, false,
|
||||||
false, false, "", false, false, false, false, have_access, td_api::make_object<td_api::userTypeUnknown>(), "",
|
false, false, false, "", false, false, false, false, have_access, td_api::make_object<td_api::userTypeUnknown>(),
|
||||||
false));
|
"", false));
|
||||||
}
|
}
|
||||||
|
|
||||||
int64 ContactsManager::get_user_id_object(UserId user_id, const char *source) const {
|
int64 ContactsManager::get_user_id_object(UserId user_id, const char *source) const {
|
||||||
@ -19865,7 +19919,9 @@ tl_object_ptr<td_api::user> ContactsManager::get_user_object(UserId user_id, con
|
|||||||
get_user_status_object(user_id, u, G()->unix_time()),
|
get_user_status_object(user_id, u, G()->unix_time()),
|
||||||
get_profile_photo_object(td_->file_manager_.get(), u->photo),
|
get_profile_photo_object(td_->file_manager_.get(), u->photo),
|
||||||
td_->theme_manager_->get_accent_color_id_object(accent_color_id, AccentColorId(user_id)),
|
td_->theme_manager_->get_accent_color_id_object(accent_color_id, AccentColorId(user_id)),
|
||||||
u->background_custom_emoji_id.get(), std::move(emoji_status), u->is_contact, u->is_mutual_contact,
|
u->background_custom_emoji_id.get(),
|
||||||
|
td_->theme_manager_->get_profile_accent_color_id_object(u->profile_accent_color_id),
|
||||||
|
u->profile_background_custom_emoji_id.get(), std::move(emoji_status), u->is_contact, u->is_mutual_contact,
|
||||||
u->is_close_friend, u->is_verified, u->is_premium, u->is_support,
|
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,
|
get_restriction_reason_description(u->restriction_reasons), u->is_scam, u->is_fake,
|
||||||
u->max_active_story_id.is_valid(), get_user_has_unread_stories(u), have_access, std::move(type), u->language_code,
|
u->max_active_story_id.is_valid(), get_user_has_unread_stories(u), have_access, std::move(type), u->language_code,
|
||||||
|
@ -768,6 +768,8 @@ class ContactsManager final : public Actor {
|
|||||||
|
|
||||||
AccentColorId accent_color_id;
|
AccentColorId accent_color_id;
|
||||||
CustomEmojiId background_custom_emoji_id;
|
CustomEmojiId background_custom_emoji_id;
|
||||||
|
AccentColorId profile_accent_color_id;
|
||||||
|
CustomEmojiId profile_background_custom_emoji_id;
|
||||||
|
|
||||||
int32 was_online = 0;
|
int32 was_online = 0;
|
||||||
int32 local_was_online = 0;
|
int32 local_was_online = 0;
|
||||||
@ -818,6 +820,8 @@ class ContactsManager final : public Actor {
|
|||||||
bool is_photo_changed = true;
|
bool is_photo_changed = true;
|
||||||
bool is_accent_color_id_changed = true;
|
bool is_accent_color_id_changed = true;
|
||||||
bool is_background_custom_emoji_id_changed = true;
|
bool is_background_custom_emoji_id_changed = true;
|
||||||
|
bool is_profile_accent_color_id_changed = true;
|
||||||
|
bool is_profile_background_custom_emoji_id_changed = true;
|
||||||
bool is_phone_number_changed = true;
|
bool is_phone_number_changed = true;
|
||||||
bool is_emoji_status_changed = true;
|
bool is_emoji_status_changed = true;
|
||||||
bool is_is_contact_changed = true;
|
bool is_is_contact_changed = true;
|
||||||
@ -1460,6 +1464,9 @@ class ContactsManager final : public Actor {
|
|||||||
const char *source);
|
const char *source);
|
||||||
void on_update_user_accent_color_id(User *u, UserId user_id, AccentColorId accent_color_id);
|
void on_update_user_accent_color_id(User *u, UserId user_id, AccentColorId accent_color_id);
|
||||||
void on_update_user_background_custom_emoji_id(User *u, UserId user_id, CustomEmojiId background_custom_emoji_id);
|
void on_update_user_background_custom_emoji_id(User *u, UserId user_id, CustomEmojiId background_custom_emoji_id);
|
||||||
|
void on_update_user_profile_accent_color_id(User *u, UserId user_id, AccentColorId accent_color_id);
|
||||||
|
void on_update_user_profile_background_custom_emoji_id(User *u, UserId user_id,
|
||||||
|
CustomEmojiId background_custom_emoji_id);
|
||||||
void on_update_user_emoji_status(User *u, UserId user_id, EmojiStatus emoji_status);
|
void on_update_user_emoji_status(User *u, UserId user_id, EmojiStatus emoji_status);
|
||||||
void on_update_user_story_ids_impl(User *u, UserId user_id, StoryId max_active_story_id, StoryId max_read_story_id);
|
void on_update_user_story_ids_impl(User *u, UserId user_id, StoryId max_active_story_id, StoryId max_read_story_id);
|
||||||
void on_update_user_max_read_story_id(User *u, UserId user_id, StoryId max_read_story_id);
|
void on_update_user_max_read_story_id(User *u, UserId user_id, StoryId max_read_story_id);
|
||||||
|
@ -595,11 +595,13 @@ int32 ThemeManager::get_accent_color_id_object(AccentColorId accent_color_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32 ThemeManager::get_profile_accent_color_id_object(AccentColorId accent_color_id) const {
|
int32 ThemeManager::get_profile_accent_color_id_object(AccentColorId accent_color_id) const {
|
||||||
CHECK(accent_color_id.is_valid());
|
if (!accent_color_id.is_valid()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
if (td_->auth_manager_->is_bot() || profile_accent_colors_.light_colors_.count(accent_color_id) != 0) {
|
if (td_->auth_manager_->is_bot() || profile_accent_colors_.light_colors_.count(accent_color_id) != 0) {
|
||||||
return accent_color_id.get();
|
return accent_color_id.get();
|
||||||
}
|
}
|
||||||
return 5; // blue
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
td_api::object_ptr<td_api::themeSettings> ThemeManager::get_theme_settings_object(const ThemeSettings &settings) const {
|
td_api::object_ptr<td_api::themeSettings> ThemeManager::get_theme_settings_object(const ThemeSettings &settings) const {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user