Apply chat background set by the other user.

This commit is contained in:
levlam 2023-11-30 21:49:32 +03:00
parent 6f3180aeaf
commit 072f811a9c
3 changed files with 13 additions and 7 deletions

View File

@ -3623,13 +3623,19 @@ MessageId get_message_content_pinned_message_id(const MessageContent *content) {
}
}
BackgroundInfo get_message_content_background_info(const MessageContent *content) {
BackgroundInfo get_message_content_my_background_info(const MessageContent *content, bool is_outgoing) {
switch (content->get_type()) {
case MessageContentType::SetBackground:
return static_cast<const MessageSetBackground *>(content)->background_info;
case MessageContentType::SetBackground: {
const auto *set_background = static_cast<const MessageSetBackground *>(content);
if (is_outgoing || set_background->for_both) {
return set_background->background_info;
}
break;
}
default:
return BackgroundInfo();
break;
}
return BackgroundInfo();
}
string get_message_content_theme_name(const MessageContent *content) {

View File

@ -149,7 +149,7 @@ StickerType get_message_content_sticker_type(const Td *td, const MessageContent
MessageId get_message_content_pinned_message_id(const MessageContent *content);
BackgroundInfo get_message_content_background_info(const MessageContent *content);
BackgroundInfo get_message_content_my_background_info(const MessageContent *content, bool is_outgoing);
string get_message_content_theme_name(const MessageContent *content);

View File

@ -35421,8 +35421,8 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq
set_dialog_last_pinned_message_id(d, pinned_message_id);
}
}
if (message_content_type == MessageContentType::SetBackground && m->is_outgoing) {
set_dialog_background(d, get_message_content_background_info(m->content.get()));
if (message_content_type == MessageContentType::SetBackground) {
set_dialog_background(d, get_message_content_my_background_info(m->content.get(), m->is_outgoing));
}
if (message_content_type == MessageContentType::ChatSetTheme) {
set_dialog_theme_name(d, get_message_content_theme_name(m->content.get()));