Improve on_external_update_message_content.

This commit is contained in:
levlam 2024-06-10 20:10:05 +03:00
parent 97375f8a79
commit fdee1297df
3 changed files with 8 additions and 3 deletions

View File

@ -6762,10 +6762,14 @@ bool MessagesManager::need_skip_bot_commands(DialogId dialog_id, const Message *
td_->dialog_manager_->is_broadcast_channel(dialog_id); td_->dialog_manager_->is_broadcast_channel(dialog_id);
} }
void MessagesManager::on_external_update_message_content(MessageFullId message_full_id, const char *source) { void MessagesManager::on_external_update_message_content(MessageFullId message_full_id, const char *source,
bool expect_no_message) {
Dialog *d = get_dialog(message_full_id.get_dialog_id()); Dialog *d = get_dialog(message_full_id.get_dialog_id());
CHECK(d != nullptr); CHECK(d != nullptr);
Message *m = get_message(d, message_full_id.get_message_id()); Message *m = get_message(d, message_full_id.get_message_id());
if (expect_no_message && m == nullptr) {
return;
}
CHECK(m != nullptr); CHECK(m != nullptr);
send_update_message_content(d, m, true, source); send_update_message_content(d, m, true, source);
// must not call on_message_changed, because the message itself wasn't changed // must not call on_message_changed, because the message itself wasn't changed

View File

@ -343,7 +343,8 @@ class MessagesManager final : public Actor {
void on_update_message_extended_media(MessageFullId message_full_id, void on_update_message_extended_media(MessageFullId message_full_id,
telegram_api::object_ptr<telegram_api::MessageExtendedMedia> extended_media); telegram_api::object_ptr<telegram_api::MessageExtendedMedia> extended_media);
void on_external_update_message_content(MessageFullId message_full_id, const char *source); void on_external_update_message_content(MessageFullId message_full_id, const char *source,
bool expect_no_message = false);
void on_update_message_content(MessageFullId message_full_id); void on_update_message_content(MessageFullId message_full_id);

View File

@ -3810,7 +3810,7 @@ void StoryManager::on_story_changed(StoryFullId story_full_id, const Story *stor
CHECK(!message_full_ids.empty()); CHECK(!message_full_ids.empty());
for (const auto &message_full_id : message_full_ids) { for (const auto &message_full_id : message_full_ids) {
send_closure_later(G()->messages_manager(), &MessagesManager::on_external_update_message_content, send_closure_later(G()->messages_manager(), &MessagesManager::on_external_update_message_content,
message_full_id, "on_story_changed"); message_full_id, "on_story_changed", true);
} }
} }
} }