Support user/chat.background_custom_emoji_id.
This commit is contained in:
parent
364b058508
commit
7df8a8f3d0
@ -772,6 +772,7 @@ usernames active_usernames:vector<string> disabled_usernames:vector<string> edit
|
|||||||
//@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
|
||||||
|
//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header background. 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
|
||||||
@ -788,7 +789,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:accentColorId 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:accentColorId 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
|
||||||
@ -1571,6 +1572,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa
|
|||||||
//@title Chat title
|
//@title Chat title
|
||||||
//@photo Chat photo; may be null
|
//@photo Chat photo; may be null
|
||||||
//@accent_color_id Identifier of the accent color for message sender name, and backgrounds of chat photo, reply header, and link preview
|
//@accent_color_id Identifier of the accent color for message sender name, and backgrounds of chat photo, reply header, and link preview
|
||||||
|
//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header background in replies to messages sent by the chat
|
||||||
//@permissions Actions that non-administrator chat members are allowed to take in the chat
|
//@permissions Actions that non-administrator chat members are allowed to take in the chat
|
||||||
//@last_message Last message in the chat; may be null if none or unknown
|
//@last_message Last message in the chat; may be null if none or unknown
|
||||||
//@positions Positions of the chat in chat lists
|
//@positions Positions of the chat in chat lists
|
||||||
@ -1600,7 +1602,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa
|
|||||||
//@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat
|
//@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat
|
||||||
//@draft_message A draft of a message in the chat; may be null if none
|
//@draft_message A draft of a message in the chat; may be null if none
|
||||||
//@client_data Application-specific data associated with the chat. (For example, the chat scroll position or local chat notification settings can be stored here.) Persistent if the message database is used
|
//@client_data Application-specific data associated with the chat. (For example, the chat scroll position or local chat notification settings can be stored here.) Persistent if the message database is used
|
||||||
chat id:int53 type:ChatType title:string photo:chatPhotoInfo accent_color_id:accentColorId permissions:chatPermissions last_message:message positions:vector<chatPosition> message_sender_id:MessageSender block_list:BlockList has_protected_content:Bool is_translatable:Bool is_marked_as_unread:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time:int32 background:chatBackground theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat;
|
chat id:int53 type:ChatType title:string photo:chatPhotoInfo accent_color_id:accentColorId background_custom_emoji_id:int64 permissions:chatPermissions last_message:message positions:vector<chatPosition> message_sender_id:MessageSender block_list:BlockList has_protected_content:Bool is_translatable:Bool is_marked_as_unread:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time:int32 background:chatBackground theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat;
|
||||||
|
|
||||||
//@description Represents a list of chats @total_count Approximate total number of chats found @chat_ids List of chat identifiers
|
//@description Represents a list of chats @total_count Approximate total number of chats found @chat_ids List of chat identifiers
|
||||||
chats total_count:int32 chat_ids:vector<int53> = Chats;
|
chats total_count:int32 chat_ids:vector<int53> = Chats;
|
||||||
@ -4197,8 +4199,8 @@ chatEventActiveUsernamesChanged old_usernames:vector<string> new_usernames:vecto
|
|||||||
//@description The chat accent color was changed @old_accent_color_id Previous identifier of chat accent color @new_accent_color_id New identifier of chat accent color
|
//@description The chat accent color was changed @old_accent_color_id Previous identifier of chat accent color @new_accent_color_id New identifier of chat accent color
|
||||||
chatEventAccentColorChanged old_accent_color_id:accentColorId new_accent_color_id:accentColorId = ChatEventAction;
|
chatEventAccentColorChanged old_accent_color_id:accentColorId new_accent_color_id:accentColorId = ChatEventAction;
|
||||||
|
|
||||||
//@description The chat's custom emoji for reply background was changed @old_reply_background_custom_emoji_id Previous identifier of the custom emoji @new_reply_background_custom_emoji_id New identifier of the custom emoji
|
//@description The chat's custom emoji for reply background was changed @old_background_custom_emoji_id Previous identifier of the custom emoji @new_background_custom_emoji_id New identifier of the custom emoji
|
||||||
chatEventReplyBackgroundCustomEmojiChanged old_reply_background_custom_emoji_id:int64 new_reply_background_custom_emoji_id:int64 = ChatEventAction;
|
chatEventBackgroundCustomEmojiChanged old_background_custom_emoji_id:int64 new_background_custom_emoji_id:int64 = ChatEventAction;
|
||||||
|
|
||||||
//@description The has_protected_content setting of a channel was toggled @has_protected_content New value of has_protected_content
|
//@description The has_protected_content setting of a channel was toggled @has_protected_content New value of has_protected_content
|
||||||
chatEventHasProtectedContentToggled has_protected_content:Bool = ChatEventAction;
|
chatEventHasProtectedContentToggled has_protected_content:Bool = ChatEventAction;
|
||||||
@ -5999,7 +6001,10 @@ updateChatTitle chat_id:int53 title:string = Update;
|
|||||||
updateChatPhoto chat_id:int53 photo:chatPhotoInfo = Update;
|
updateChatPhoto chat_id:int53 photo:chatPhotoInfo = Update;
|
||||||
|
|
||||||
//@description A chat accent color has changed @chat_id Chat identifier @accent_color_id The new chat accent color identifier
|
//@description A chat accent color has changed @chat_id Chat identifier @accent_color_id The new chat accent color identifier
|
||||||
updateChatAccentColorId chat_id:int53 accent_color_id:accentColorId = Update;
|
updateChatAccentColor chat_id:int53 accent_color_id:accentColorId = Update;
|
||||||
|
|
||||||
|
//@description A chat's custom emoji for reply background has changed @chat_id Chat identifier @background_custom_emoji_id The new tdentifier of a custom emoji to be shown on the reply header background
|
||||||
|
updateChatBackgroundCustomEmoji chat_id:int53 background_custom_emoji_id:int64 = Update;
|
||||||
|
|
||||||
//@description Chat permissions was changed @chat_id Chat identifier @permissions The new chat permissions
|
//@description Chat permissions was changed @chat_id Chat identifier @permissions The new chat permissions
|
||||||
updateChatPermissions chat_id:int53 permissions:chatPermissions = Update;
|
updateChatPermissions chat_id:int53 permissions:chatPermissions = Update;
|
||||||
|
@ -4185,6 +4185,7 @@ void ContactsManager::User::store(StorerT &storer) const {
|
|||||||
bool has_max_read_story_id = max_read_story_id.is_valid();
|
bool has_max_read_story_id = max_read_story_id.is_valid();
|
||||||
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();
|
||||||
BEGIN_STORE_FLAGS();
|
BEGIN_STORE_FLAGS();
|
||||||
STORE_FLAG(is_received);
|
STORE_FLAG(is_received);
|
||||||
STORE_FLAG(is_verified);
|
STORE_FLAG(is_verified);
|
||||||
@ -4226,6 +4227,7 @@ void ContactsManager::User::store(StorerT &storer) const {
|
|||||||
STORE_FLAG(has_max_read_story_id);
|
STORE_FLAG(has_max_read_story_id);
|
||||||
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);
|
||||||
END_STORE_FLAGS();
|
END_STORE_FLAGS();
|
||||||
}
|
}
|
||||||
store(first_name, storer);
|
store(first_name, storer);
|
||||||
@ -4273,6 +4275,9 @@ void ContactsManager::User::store(StorerT &storer) const {
|
|||||||
if (has_accent_color_id) {
|
if (has_accent_color_id) {
|
||||||
store(accent_color_id, storer);
|
store(accent_color_id, storer);
|
||||||
}
|
}
|
||||||
|
if (has_background_custom_emoji_id) {
|
||||||
|
store(background_custom_emoji_id, storer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ParserT>
|
template <class ParserT>
|
||||||
@ -4295,6 +4300,7 @@ void ContactsManager::User::parse(ParserT &parser) {
|
|||||||
bool has_max_read_story_id = false;
|
bool has_max_read_story_id = false;
|
||||||
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;
|
||||||
BEGIN_PARSE_FLAGS();
|
BEGIN_PARSE_FLAGS();
|
||||||
PARSE_FLAG(is_received);
|
PARSE_FLAG(is_received);
|
||||||
PARSE_FLAG(is_verified);
|
PARSE_FLAG(is_verified);
|
||||||
@ -4336,6 +4342,7 @@ void ContactsManager::User::parse(ParserT &parser) {
|
|||||||
PARSE_FLAG(has_max_read_story_id);
|
PARSE_FLAG(has_max_read_story_id);
|
||||||
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);
|
||||||
END_PARSE_FLAGS();
|
END_PARSE_FLAGS();
|
||||||
}
|
}
|
||||||
parse(first_name, parser);
|
parse(first_name, parser);
|
||||||
@ -4411,6 +4418,9 @@ void ContactsManager::User::parse(ParserT &parser) {
|
|||||||
if (has_accent_color_id) {
|
if (has_accent_color_id) {
|
||||||
parse(accent_color_id, parser);
|
parse(accent_color_id, parser);
|
||||||
}
|
}
|
||||||
|
if (has_background_custom_emoji_id) {
|
||||||
|
parse(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 << '"';
|
||||||
@ -4821,6 +4831,7 @@ void ContactsManager::Channel::store(StorerT &storer) const {
|
|||||||
bool has_max_read_story_id = max_read_story_id.is_valid();
|
bool has_max_read_story_id = max_read_story_id.is_valid();
|
||||||
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();
|
||||||
BEGIN_STORE_FLAGS();
|
BEGIN_STORE_FLAGS();
|
||||||
STORE_FLAG(false);
|
STORE_FLAG(false);
|
||||||
STORE_FLAG(false);
|
STORE_FLAG(false);
|
||||||
@ -4861,6 +4872,7 @@ void ContactsManager::Channel::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(stories_hidden);
|
STORE_FLAG(stories_hidden);
|
||||||
STORE_FLAG(has_accent_color_id);
|
STORE_FLAG(has_accent_color_id);
|
||||||
|
STORE_FLAG(has_background_custom_emoji_id);
|
||||||
END_STORE_FLAGS();
|
END_STORE_FLAGS();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4898,6 +4910,9 @@ void ContactsManager::Channel::store(StorerT &storer) const {
|
|||||||
if (has_accent_color_id) {
|
if (has_accent_color_id) {
|
||||||
store(accent_color_id, storer);
|
store(accent_color_id, storer);
|
||||||
}
|
}
|
||||||
|
if (has_background_custom_emoji_id) {
|
||||||
|
store(background_custom_emoji_id, storer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ParserT>
|
template <class ParserT>
|
||||||
@ -4924,6 +4939,7 @@ void ContactsManager::Channel::parse(ParserT &parser) {
|
|||||||
bool has_max_read_story_id = false;
|
bool has_max_read_story_id = false;
|
||||||
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;
|
||||||
BEGIN_PARSE_FLAGS();
|
BEGIN_PARSE_FLAGS();
|
||||||
PARSE_FLAG(left);
|
PARSE_FLAG(left);
|
||||||
PARSE_FLAG(kicked);
|
PARSE_FLAG(kicked);
|
||||||
@ -4964,6 +4980,7 @@ void ContactsManager::Channel::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(stories_hidden);
|
PARSE_FLAG(stories_hidden);
|
||||||
PARSE_FLAG(has_accent_color_id);
|
PARSE_FLAG(has_accent_color_id);
|
||||||
|
PARSE_FLAG(has_background_custom_emoji_id);
|
||||||
END_PARSE_FLAGS();
|
END_PARSE_FLAGS();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5031,6 +5048,9 @@ void ContactsManager::Channel::parse(ParserT &parser) {
|
|||||||
if (has_accent_color_id) {
|
if (has_accent_color_id) {
|
||||||
parse(accent_color_id, parser);
|
parse(accent_color_id, parser);
|
||||||
}
|
}
|
||||||
|
if (has_background_custom_emoji_id) {
|
||||||
|
parse(background_custom_emoji_id, parser);
|
||||||
|
}
|
||||||
|
|
||||||
if (!check_utf8(title)) {
|
if (!check_utf8(title)) {
|
||||||
LOG(ERROR) << "Have invalid title \"" << title << '"';
|
LOG(ERROR) << "Have invalid title \"" << title << '"';
|
||||||
@ -5694,6 +5714,36 @@ AccentColorId ContactsManager::get_secret_chat_accent_color_id(SecretChatId secr
|
|||||||
return get_user_accent_color_id(c->user_id);
|
return get_user_accent_color_id(c->user_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CustomEmojiId ContactsManager::get_user_background_custom_emoji_id(UserId user_id) const {
|
||||||
|
auto u = get_user(user_id);
|
||||||
|
if (u == nullptr) {
|
||||||
|
return CustomEmojiId();
|
||||||
|
}
|
||||||
|
|
||||||
|
return u->background_custom_emoji_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomEmojiId ContactsManager::get_chat_background_custom_emoji_id(ChatId chat_id) const {
|
||||||
|
return CustomEmojiId();
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomEmojiId ContactsManager::get_channel_background_custom_emoji_id(ChannelId channel_id) const {
|
||||||
|
auto c = get_channel(channel_id);
|
||||||
|
if (c == nullptr) {
|
||||||
|
return CustomEmojiId();
|
||||||
|
}
|
||||||
|
|
||||||
|
return c->background_custom_emoji_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomEmojiId ContactsManager::get_secret_chat_background_custom_emoji_id(SecretChatId secret_chat_id) const {
|
||||||
|
auto c = get_secret_chat(secret_chat_id);
|
||||||
|
if (c == nullptr) {
|
||||||
|
return CustomEmojiId();
|
||||||
|
}
|
||||||
|
return get_user_background_custom_emoji_id(c->user_id);
|
||||||
|
}
|
||||||
|
|
||||||
string ContactsManager::get_user_title(UserId user_id) const {
|
string ContactsManager::get_user_title(UserId user_id) const {
|
||||||
auto u = get_user(user_id);
|
auto u = get_user(user_id);
|
||||||
if (u == nullptr) {
|
if (u == nullptr) {
|
||||||
@ -10123,6 +10173,7 @@ void ContactsManager::on_get_user(tl_object_ptr<telegram_api::User> &&user_ptr,
|
|||||||
}
|
}
|
||||||
on_update_user_emoji_status(u, user_id, EmojiStatus(std::move(user->emoji_status_)));
|
on_update_user_emoji_status(u, user_id, EmojiStatus(std::move(user->emoji_status_)));
|
||||||
on_update_user_accent_color_id(u, user_id, AccentColorId(user->color_));
|
on_update_user_accent_color_id(u, user_id, AccentColorId(user->color_));
|
||||||
|
on_update_user_background_custom_emoji_id(u, user_id, CustomEmojiId(user->background_emoji_id_));
|
||||||
|
|
||||||
bool is_verified = (flags & USER_FLAG_IS_VERIFIED) != 0;
|
bool is_verified = (flags & USER_FLAG_IS_VERIFIED) != 0;
|
||||||
bool is_premium = (flags & USER_FLAG_IS_PREMIUM) != 0;
|
bool is_premium = (flags & USER_FLAG_IS_PREMIUM) != 0;
|
||||||
@ -11803,6 +11854,14 @@ void ContactsManager::update_user(User *u, UserId user_id, bool from_binlog, boo
|
|||||||
});
|
});
|
||||||
u->is_accent_color_id_changed = false;
|
u->is_accent_color_id_changed = false;
|
||||||
}
|
}
|
||||||
|
if (u->is_background_custom_emoji_id_changed) {
|
||||||
|
auto messages_manager = td_->messages_manager_.get();
|
||||||
|
messages_manager->on_dialog_background_custom_emoji_id_updated(DialogId(user_id));
|
||||||
|
for_each_secret_chat_with_user(user_id, [messages_manager](SecretChatId secret_chat_id) {
|
||||||
|
messages_manager->on_dialog_background_custom_emoji_id_updated(DialogId(secret_chat_id));
|
||||||
|
});
|
||||||
|
u->is_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;
|
||||||
@ -12047,6 +12106,10 @@ void ContactsManager::update_channel(Channel *c, ChannelId channel_id, bool from
|
|||||||
td_->messages_manager_->on_dialog_accent_color_id_updated(DialogId(channel_id));
|
td_->messages_manager_->on_dialog_accent_color_id_updated(DialogId(channel_id));
|
||||||
c->is_accent_color_id_changed = false;
|
c->is_accent_color_id_changed = false;
|
||||||
}
|
}
|
||||||
|
if (c->is_background_custom_emoji_id_changed) {
|
||||||
|
td_->messages_manager_->on_dialog_background_custom_emoji_id_updated(DialogId(channel_id));
|
||||||
|
c->is_background_custom_emoji_id_changed = false;
|
||||||
|
}
|
||||||
if (c->is_title_changed) {
|
if (c->is_title_changed) {
|
||||||
td_->messages_manager_->on_dialog_title_updated(DialogId(channel_id));
|
td_->messages_manager_->on_dialog_title_updated(DialogId(channel_id));
|
||||||
c->is_title_changed = false;
|
c->is_title_changed = false;
|
||||||
@ -13415,6 +13478,15 @@ void ContactsManager::on_update_user_accent_color_id(User *u, UserId user_id, Ac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContactsManager::on_update_user_background_custom_emoji_id(User *u, UserId user_id,
|
||||||
|
CustomEmojiId background_custom_emoji_id) {
|
||||||
|
if (u->background_custom_emoji_id != background_custom_emoji_id) {
|
||||||
|
u->background_custom_emoji_id = background_custom_emoji_id;
|
||||||
|
u->is_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()) {
|
||||||
@ -16093,6 +16165,15 @@ void ContactsManager::on_update_channel_accent_color_id(Channel *c, ChannelId ch
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContactsManager::on_update_channel_background_custom_emoji_id(Channel *c, ChannelId channel_id,
|
||||||
|
CustomEmojiId background_custom_emoji_id) {
|
||||||
|
if (c->background_custom_emoji_id != background_custom_emoji_id) {
|
||||||
|
c->background_custom_emoji_id = background_custom_emoji_id;
|
||||||
|
c->is_background_custom_emoji_id_changed = true;
|
||||||
|
c->need_save_to_database = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ContactsManager::on_update_channel_title(Channel *c, ChannelId channel_id, string &&title) {
|
void ContactsManager::on_update_channel_title(Channel *c, ChannelId channel_id, string &&title) {
|
||||||
if (c->title != title) {
|
if (c->title != title) {
|
||||||
c->title = std::move(title);
|
c->title = std::move(title);
|
||||||
@ -18930,6 +19011,7 @@ void ContactsManager::on_get_channel(telegram_api::channel &channel, const char
|
|||||||
}
|
}
|
||||||
on_update_channel_photo(c, channel_id, std::move(channel.photo_));
|
on_update_channel_photo(c, channel_id, std::move(channel.photo_));
|
||||||
on_update_channel_accent_color_id(c, channel_id, AccentColorId(channel.color_));
|
on_update_channel_accent_color_id(c, channel_id, AccentColorId(channel.color_));
|
||||||
|
on_update_channel_background_custom_emoji_id(c, channel_id, CustomEmojiId(channel.background_emoji_id_));
|
||||||
on_update_channel_status(c, channel_id, std::move(status));
|
on_update_channel_status(c, channel_id, std::move(status));
|
||||||
on_update_channel_usernames(
|
on_update_channel_usernames(
|
||||||
c, channel_id,
|
c, channel_id,
|
||||||
@ -19233,8 +19315,8 @@ 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,
|
||||||
AccentColorId(user_id).get_accent_color_id_object(), nullptr, false, false, false, false, false, false, "", false,
|
AccentColorId(user_id).get_accent_color_id_object(), 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, have_access, td_api::make_object<td_api::userTypeUnknown>(), "", 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 {
|
||||||
@ -19273,8 +19355,9 @@ tl_object_ptr<td_api::user> 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,
|
user_id.get(), u->first_name, u->last_name, u->usernames.get_usernames_object(), u->phone_number,
|
||||||
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), accent_color_id.get_accent_color_id_object(),
|
get_profile_photo_object(td_->file_manager_.get(), u->photo), accent_color_id.get_accent_color_id_object(),
|
||||||
std::move(emoji_status), u->is_contact, u->is_mutual_contact, u->is_close_friend, u->is_verified, u->is_premium,
|
u->background_custom_emoji_id.get(), std::move(emoji_status), u->is_contact, u->is_mutual_contact,
|
||||||
u->is_support, get_restriction_reason_description(u->restriction_reasons), u->is_scam, u->is_fake,
|
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,
|
||||||
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,
|
||||||
u->attach_menu_enabled);
|
u->attach_menu_enabled);
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "td/telegram/ChannelType.h"
|
#include "td/telegram/ChannelType.h"
|
||||||
#include "td/telegram/ChatId.h"
|
#include "td/telegram/ChatId.h"
|
||||||
#include "td/telegram/Contact.h"
|
#include "td/telegram/Contact.h"
|
||||||
|
#include "td/telegram/CustomEmojiId.h"
|
||||||
#include "td/telegram/DialogAdministrator.h"
|
#include "td/telegram/DialogAdministrator.h"
|
||||||
#include "td/telegram/DialogId.h"
|
#include "td/telegram/DialogId.h"
|
||||||
#include "td/telegram/DialogInviteLink.h"
|
#include "td/telegram/DialogInviteLink.h"
|
||||||
@ -122,6 +123,11 @@ class ContactsManager final : public Actor {
|
|||||||
AccentColorId get_channel_accent_color_id(ChannelId channel_id) const;
|
AccentColorId get_channel_accent_color_id(ChannelId channel_id) const;
|
||||||
AccentColorId get_secret_chat_accent_color_id(SecretChatId secret_chat_id) const;
|
AccentColorId get_secret_chat_accent_color_id(SecretChatId secret_chat_id) const;
|
||||||
|
|
||||||
|
CustomEmojiId get_user_background_custom_emoji_id(UserId user_id) const;
|
||||||
|
CustomEmojiId get_chat_background_custom_emoji_id(ChatId chat_id) const;
|
||||||
|
CustomEmojiId get_channel_background_custom_emoji_id(ChannelId channel_id) const;
|
||||||
|
CustomEmojiId get_secret_chat_background_custom_emoji_id(SecretChatId secret_chat_id) const;
|
||||||
|
|
||||||
string get_user_title(UserId user_id) const;
|
string get_user_title(UserId user_id) const;
|
||||||
string get_chat_title(ChatId chat_id) const;
|
string get_chat_title(ChatId chat_id) const;
|
||||||
string get_channel_title(ChannelId channel_id) const;
|
string get_channel_title(ChannelId channel_id) const;
|
||||||
@ -747,6 +753,7 @@ class ContactsManager final : public Actor {
|
|||||||
int32 bot_info_version = -1;
|
int32 bot_info_version = -1;
|
||||||
|
|
||||||
AccentColorId accent_color_id;
|
AccentColorId accent_color_id;
|
||||||
|
CustomEmojiId background_custom_emoji_id;
|
||||||
|
|
||||||
int32 was_online = 0;
|
int32 was_online = 0;
|
||||||
int32 local_was_online = 0;
|
int32 local_was_online = 0;
|
||||||
@ -796,6 +803,7 @@ class ContactsManager final : public Actor {
|
|||||||
bool is_username_changed = true;
|
bool is_username_changed = true;
|
||||||
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_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;
|
||||||
@ -962,6 +970,7 @@ class ContactsManager final : public Actor {
|
|||||||
string title;
|
string title;
|
||||||
DialogPhoto photo;
|
DialogPhoto photo;
|
||||||
AccentColorId accent_color_id;
|
AccentColorId accent_color_id;
|
||||||
|
CustomEmojiId background_custom_emoji_id;
|
||||||
Usernames usernames;
|
Usernames usernames;
|
||||||
vector<RestrictionReason> restriction_reasons;
|
vector<RestrictionReason> restriction_reasons;
|
||||||
DialogParticipantStatus status = DialogParticipantStatus::Banned(0);
|
DialogParticipantStatus status = DialogParticipantStatus::Banned(0);
|
||||||
@ -1000,6 +1009,7 @@ class ContactsManager final : public Actor {
|
|||||||
bool is_username_changed = true;
|
bool is_username_changed = true;
|
||||||
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_default_permissions_changed = true;
|
bool is_default_permissions_changed = true;
|
||||||
bool is_status_changed = true;
|
bool is_status_changed = true;
|
||||||
bool is_stories_hidden_changed = true;
|
bool is_stories_hidden_changed = true;
|
||||||
@ -1420,6 +1430,7 @@ class ContactsManager final : public Actor {
|
|||||||
void on_update_user_photo(User *u, UserId user_id, tl_object_ptr<telegram_api::UserProfilePhoto> &&photo,
|
void on_update_user_photo(User *u, UserId user_id, tl_object_ptr<telegram_api::UserProfilePhoto> &&photo,
|
||||||
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_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);
|
||||||
@ -1490,6 +1501,8 @@ class ContactsManager final : public Actor {
|
|||||||
tl_object_ptr<telegram_api::ChatPhoto> &&chat_photo_ptr);
|
tl_object_ptr<telegram_api::ChatPhoto> &&chat_photo_ptr);
|
||||||
void on_update_channel_photo(Channel *c, ChannelId channel_id, DialogPhoto &&photo, bool invalidate_photo_cache);
|
void on_update_channel_photo(Channel *c, ChannelId channel_id, DialogPhoto &&photo, bool invalidate_photo_cache);
|
||||||
void on_update_channel_accent_color_id(Channel *c, ChannelId channel_id, AccentColorId accent_color_id);
|
void on_update_channel_accent_color_id(Channel *c, ChannelId channel_id, AccentColorId accent_color_id);
|
||||||
|
void on_update_channel_background_custom_emoji_id(Channel *c, ChannelId channel_id,
|
||||||
|
CustomEmojiId background_custom_emoji_id);
|
||||||
static void on_update_channel_title(Channel *c, ChannelId channel_id, string &&title);
|
static void on_update_channel_title(Channel *c, ChannelId channel_id, string &&title);
|
||||||
void on_update_channel_usernames(Channel *c, ChannelId channel_id, Usernames &&usernames);
|
void on_update_channel_usernames(Channel *c, ChannelId channel_id, Usernames &&usernames);
|
||||||
void on_update_channel_status(Channel *c, ChannelId channel_id, DialogParticipantStatus &&status);
|
void on_update_channel_status(Channel *c, ChannelId channel_id, DialogParticipantStatus &&status);
|
||||||
|
@ -436,8 +436,8 @@ static td_api::object_ptr<td_api::ChatEventAction> get_chat_event_action_object(
|
|||||||
}
|
}
|
||||||
case telegram_api::channelAdminLogEventActionChangeBackgroundEmoji::ID: {
|
case telegram_api::channelAdminLogEventActionChangeBackgroundEmoji::ID: {
|
||||||
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionChangeBackgroundEmoji>(action_ptr);
|
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionChangeBackgroundEmoji>(action_ptr);
|
||||||
return td_api::make_object<td_api::chatEventReplyBackgroundCustomEmojiChanged>(action->prev_value_,
|
return td_api::make_object<td_api::chatEventBackgroundCustomEmojiChanged>(action->prev_value_,
|
||||||
action->new_value_);
|
action->new_value_);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
@ -20713,6 +20713,7 @@ td_api::object_ptr<td_api::chat> MessagesManager::get_chat_object(const Dialog *
|
|||||||
d->dialog_id.get(), get_chat_type_object(d->dialog_id), get_dialog_title(d->dialog_id),
|
d->dialog_id.get(), get_chat_type_object(d->dialog_id), get_dialog_title(d->dialog_id),
|
||||||
get_chat_photo_info_object(td_->file_manager_.get(), get_dialog_photo(d->dialog_id)),
|
get_chat_photo_info_object(td_->file_manager_.get(), get_dialog_photo(d->dialog_id)),
|
||||||
get_dialog_accent_color_id(d->dialog_id).get_accent_color_id_object(),
|
get_dialog_accent_color_id(d->dialog_id).get_accent_color_id_object(),
|
||||||
|
get_dialog_background_custom_emoji_id(d->dialog_id).get(),
|
||||||
get_dialog_default_permissions(d->dialog_id).get_chat_permissions_object(),
|
get_dialog_default_permissions(d->dialog_id).get_chat_permissions_object(),
|
||||||
get_message_object(d->dialog_id, get_message(d, d->last_message_id), "get_chat_object"),
|
get_message_object(d->dialog_id, get_message(d, d->last_message_id), "get_chat_object"),
|
||||||
get_chat_positions_object(d), get_default_message_sender_object(d), block_list_id.get_block_list_object(),
|
get_chat_positions_object(d), get_default_message_sender_object(d), block_list_id.get_block_list_object(),
|
||||||
@ -32271,12 +32272,22 @@ void MessagesManager::on_dialog_accent_color_id_updated(DialogId dialog_id) {
|
|||||||
auto d = get_dialog(dialog_id); // called from update_user, must not create the dialog
|
auto d = get_dialog(dialog_id); // called from update_user, must not create the dialog
|
||||||
if (d != nullptr && d->is_update_new_chat_sent) {
|
if (d != nullptr && d->is_update_new_chat_sent) {
|
||||||
send_closure(G()->td(), &Td::send_update,
|
send_closure(G()->td(), &Td::send_update,
|
||||||
td_api::make_object<td_api::updateChatAccentColorId>(
|
td_api::make_object<td_api::updateChatAccentColor>(
|
||||||
get_chat_id_object(dialog_id, "updateChatAccentColorId"),
|
get_chat_id_object(dialog_id, "updateChatAccentColor"),
|
||||||
get_dialog_accent_color_id(dialog_id).get_accent_color_id_object()));
|
get_dialog_accent_color_id(dialog_id).get_accent_color_id_object()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MessagesManager::on_dialog_background_custom_emoji_id_updated(DialogId dialog_id) {
|
||||||
|
auto d = get_dialog(dialog_id); // called from update_user, must not create the dialog
|
||||||
|
if (d != nullptr && d->is_update_new_chat_sent) {
|
||||||
|
send_closure(G()->td(), &Td::send_update,
|
||||||
|
td_api::make_object<td_api::updateChatBackgroundCustomEmoji>(
|
||||||
|
get_chat_id_object(dialog_id, "updateChatBackgroundCustomEmoji"),
|
||||||
|
get_dialog_background_custom_emoji_id(dialog_id).get()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MessagesManager::on_dialog_title_updated(DialogId dialog_id) {
|
void MessagesManager::on_dialog_title_updated(DialogId dialog_id) {
|
||||||
auto d = get_dialog(dialog_id); // called from update_user, must not create the dialog
|
auto d = get_dialog(dialog_id); // called from update_user, must not create the dialog
|
||||||
if (d != nullptr) {
|
if (d != nullptr) {
|
||||||
@ -32732,6 +32743,23 @@ AccentColorId MessagesManager::get_dialog_accent_color_id(DialogId dialog_id) co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CustomEmojiId MessagesManager::get_dialog_background_custom_emoji_id(DialogId dialog_id) const {
|
||||||
|
switch (dialog_id.get_type()) {
|
||||||
|
case DialogType::User:
|
||||||
|
return td_->contacts_manager_->get_user_background_custom_emoji_id(dialog_id.get_user_id());
|
||||||
|
case DialogType::Chat:
|
||||||
|
return td_->contacts_manager_->get_chat_background_custom_emoji_id(dialog_id.get_chat_id());
|
||||||
|
case DialogType::Channel:
|
||||||
|
return td_->contacts_manager_->get_channel_background_custom_emoji_id(dialog_id.get_channel_id());
|
||||||
|
case DialogType::SecretChat:
|
||||||
|
return td_->contacts_manager_->get_secret_chat_background_custom_emoji_id(dialog_id.get_secret_chat_id());
|
||||||
|
case DialogType::None:
|
||||||
|
default:
|
||||||
|
UNREACHABLE();
|
||||||
|
return CustomEmojiId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
string MessagesManager::get_dialog_title(DialogId dialog_id) const {
|
string MessagesManager::get_dialog_title(DialogId dialog_id) const {
|
||||||
switch (dialog_id.get_type()) {
|
switch (dialog_id.get_type()) {
|
||||||
case DialogType::User:
|
case DialogType::User:
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "td/telegram/BackgroundInfo.h"
|
#include "td/telegram/BackgroundInfo.h"
|
||||||
#include "td/telegram/ChannelId.h"
|
#include "td/telegram/ChannelId.h"
|
||||||
#include "td/telegram/ChatReactions.h"
|
#include "td/telegram/ChatReactions.h"
|
||||||
|
#include "td/telegram/CustomEmojiId.h"
|
||||||
#include "td/telegram/DialogAction.h"
|
#include "td/telegram/DialogAction.h"
|
||||||
#include "td/telegram/DialogDate.h"
|
#include "td/telegram/DialogDate.h"
|
||||||
#include "td/telegram/DialogDb.h"
|
#include "td/telegram/DialogDb.h"
|
||||||
@ -877,6 +878,7 @@ class MessagesManager final : public Actor {
|
|||||||
|
|
||||||
void on_dialog_photo_updated(DialogId dialog_id);
|
void on_dialog_photo_updated(DialogId dialog_id);
|
||||||
void on_dialog_accent_color_id_updated(DialogId dialog_id);
|
void on_dialog_accent_color_id_updated(DialogId dialog_id);
|
||||||
|
void on_dialog_background_custom_emoji_id_updated(DialogId dialog_id);
|
||||||
void on_dialog_title_updated(DialogId dialog_id);
|
void on_dialog_title_updated(DialogId dialog_id);
|
||||||
void on_dialog_usernames_updated(DialogId dialog_id, const Usernames &old_usernames, const Usernames &new_usernames);
|
void on_dialog_usernames_updated(DialogId dialog_id, const Usernames &old_usernames, const Usernames &new_usernames);
|
||||||
void on_dialog_usernames_received(DialogId dialog_id, const Usernames &usernames, bool from_database);
|
void on_dialog_usernames_received(DialogId dialog_id, const Usernames &usernames, bool from_database);
|
||||||
@ -2946,6 +2948,8 @@ class MessagesManager final : public Actor {
|
|||||||
|
|
||||||
AccentColorId get_dialog_accent_color_id(DialogId dialog_id) const;
|
AccentColorId get_dialog_accent_color_id(DialogId dialog_id) const;
|
||||||
|
|
||||||
|
CustomEmojiId get_dialog_background_custom_emoji_id(DialogId dialog_id) const;
|
||||||
|
|
||||||
RestrictedRights get_dialog_default_permissions(DialogId dialog_id) const;
|
RestrictedRights get_dialog_default_permissions(DialogId dialog_id) const;
|
||||||
|
|
||||||
bool get_dialog_has_protected_content(DialogId dialog_id) const;
|
bool get_dialog_has_protected_content(DialogId dialog_id) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user