Add source to on_external_update_message_content.

This commit is contained in:
levlam 2024-05-15 11:40:47 +03:00
parent 783033c430
commit 7ab118780a
7 changed files with 15 additions and 15 deletions

View File

@ -6632,15 +6632,15 @@ bool MessagesManager::need_skip_bot_commands(DialogId dialog_id, const Message *
td_->dialog_manager_->is_broadcast_channel(dialog_id);
}
void MessagesManager::on_external_update_message_content(MessageFullId message_full_id) {
void MessagesManager::on_external_update_message_content(MessageFullId message_full_id, const char *source) {
Dialog *d = get_dialog(message_full_id.get_dialog_id());
CHECK(d != nullptr);
Message *m = get_message(d, message_full_id.get_message_id());
CHECK(m != nullptr);
send_update_message_content(d, m, true, "on_external_update_message_content 1");
send_update_message_content(d, m, true, source);
// must not call on_message_changed, because the message itself wasn't changed
send_update_last_message_if_needed(d, m, "on_external_update_message_content 2");
on_message_notification_changed(d, m, "on_external_update_message_content 3");
send_update_last_message_if_needed(d, m, source);
on_message_notification_changed(d, m, source);
}
void MessagesManager::on_update_message_content(MessageFullId message_full_id) {

View File

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

View File

@ -340,13 +340,13 @@ void PollManager::notify_on_poll_update(PollId poll_id) {
if (server_poll_messages_.count(poll_id) > 0) {
server_poll_messages_[poll_id].foreach([&](const MessageFullId &message_full_id) {
td_->messages_manager_->on_external_update_message_content(message_full_id);
td_->messages_manager_->on_external_update_message_content(message_full_id, "notify_on_poll_update 1");
});
}
if (other_poll_messages_.count(poll_id) > 0) {
other_poll_messages_[poll_id].foreach([&](const MessageFullId &message_full_id) {
td_->messages_manager_->on_external_update_message_content(message_full_id);
td_->messages_manager_->on_external_update_message_content(message_full_id, "notify_on_poll_update 2");
});
}
}
@ -1335,7 +1335,7 @@ void PollManager::on_stop_poll_finished(PollId poll_id, MessageFullId message_fu
if (td_->auth_manager_->is_bot()) {
if ((server_poll_messages_.count(poll_id) > 0 && server_poll_messages_[poll_id].count(message_full_id) > 0) ||
(other_poll_messages_.count(poll_id) > 0 && other_poll_messages_[poll_id].count(message_full_id) > 0)) {
td_->messages_manager_->on_external_update_message_content(message_full_id);
td_->messages_manager_->on_external_update_message_content(message_full_id, "on_stop_poll_finished");
}
}

View File

@ -2013,7 +2013,7 @@ void StickersManager::on_load_special_sticker_set(const SpecialStickerSetType &t
it->second.foreach([&](const MessageFullId &message_full_id) { message_full_ids.push_back(message_full_id); });
CHECK(!message_full_ids.empty());
for (const auto &message_full_id : message_full_ids) {
td_->messages_manager_->on_external_update_message_content(message_full_id);
td_->messages_manager_->on_external_update_message_content(message_full_id, "on_load_special_sticker_set");
}
}
@ -5751,7 +5751,7 @@ void StickersManager::try_update_animated_emoji_messages() {
}
}
for (const auto &message_full_id : message_full_ids) {
td_->messages_manager_->on_external_update_message_content(message_full_id);
td_->messages_manager_->on_external_update_message_content(message_full_id, "try_update_animated_emoji_messages");
}
}
@ -5769,7 +5769,7 @@ void StickersManager::try_update_custom_emoji_messages(CustomEmojiId custom_emoj
[&](const MessageFullId &message_full_id) { message_full_ids.push_back(message_full_id); });
}
for (const auto &message_full_id : message_full_ids) {
td_->messages_manager_->on_external_update_message_content(message_full_id);
td_->messages_manager_->on_external_update_message_content(message_full_id, "try_update_custom_emoji_messages");
}
}
@ -5786,7 +5786,7 @@ void StickersManager::try_update_premium_gift_messages() {
}
}
for (const auto &message_full_id : message_full_ids) {
td_->messages_manager_->on_external_update_message_content(message_full_id);
td_->messages_manager_->on_external_update_message_content(message_full_id, "try_update_premium_gift_messages");
}
}

View File

@ -3809,7 +3809,7 @@ void StoryManager::on_story_changed(StoryFullId story_full_id, const Story *stor
[&message_full_ids](const MessageFullId &message_full_id) { message_full_ids.push_back(message_full_id); });
CHECK(!message_full_ids.empty());
for (const auto &message_full_id : message_full_ids) {
td_->messages_manager_->on_external_update_message_content(message_full_id);
td_->messages_manager_->on_external_update_message_content(message_full_id, "on_story_changed");
}
}
}

View File

@ -357,7 +357,7 @@ void TranscriptionManager::on_transcription_updated(FileId file_id) {
auto it = voice_messages_.find(file_id);
if (it != voice_messages_.end()) {
for (const auto &message_full_id : it->second) {
td_->messages_manager_->on_external_update_message_content(message_full_id);
td_->messages_manager_->on_external_update_message_content(message_full_id, "on_transcription_updated");
}
}
}

View File

@ -1508,7 +1508,7 @@ void WebPagesManager::on_web_page_changed(WebPageId web_page_id, bool have_web_p
if (!have_web_page) {
td_->messages_manager_->delete_pending_message_web_page(message_full_id);
} else {
td_->messages_manager_->on_external_update_message_content(message_full_id);
td_->messages_manager_->on_external_update_message_content(message_full_id, "on_web_page_changed");
}
}