Add compare_message_contents function.

This commit is contained in:
levlam 2023-10-26 18:50:16 +03:00
parent 72c29377b7
commit e113fb47f1
3 changed files with 544 additions and 443 deletions

File diff suppressed because it is too large Load Diff

View File

@ -47,7 +47,7 @@ struct Photo;
class Td;
class Venue;
// Do not forget to update merge_message_contents when one of the inheritors of this class changes
// Do not forget to update merge_message_contents and compare_message_contents when one of the inheritors of this class changes
class MessageContent {
public:
MessageContent() = default;
@ -191,6 +191,9 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
bool merge_message_content_file_id(Td *td, MessageContent *message_content, FileId new_file_id);
void compare_message_contents(Td *td, const MessageContent *lhs_content, const MessageContent *rhs_content,
bool &is_content_changed, bool &need_update);
void register_message_content(Td *td, const MessageContent *content, MessageFullId message_full_id, const char *source);
void reregister_message_content(Td *td, const MessageContent *old_content, const MessageContent *new_content,

View File

@ -15424,6 +15424,7 @@ void MessagesManager::on_update_sent_text_message(int64 random_id,
bool is_content_changed = false;
merge_message_contents(td_, m->content.get(), new_content.get(), need_message_changed_warning(m), dialog_id, false,
is_content_changed, need_update);
compare_message_contents(td_, m->content.get(), new_content.get(), is_content_changed, need_update);
if (is_content_changed || need_update) {
reregister_message_content(td_, m->content.get(), new_content.get(), message_full_id,
@ -36207,6 +36208,7 @@ bool MessagesManager::update_message_content(DialogId dialog_id, Message *old_me
} else {
merge_message_contents(td_, old_content.get(), new_content.get(), need_message_changed_warning(old_message),
dialog_id, need_merge_files, is_content_changed, need_update);
compare_message_contents(td_, old_content.get(), new_content.get(), is_content_changed, need_update);
}
if (need_finish_upload) {
// the file is likely to be already merged with a server file, but if not we need to