Pass const Message to do_send_media.

This commit is contained in:
levlam 2024-06-17 19:08:37 +03:00
parent 204ceff1d0
commit f13b696cb6
4 changed files with 9 additions and 8 deletions

View File

@ -8277,7 +8277,7 @@ void MessagesManager::on_upload_media(FileId file_id, tl_object_ptr<telegram_api
being_uploaded_files_.erase(it);
Message *m = get_message(message_full_id);
const Message *m = get_message(message_full_id);
if (m == nullptr) {
// message has already been deleted by the user or sent to inaccessible channel, do not need to send or edit it
// file upload should be already canceled in cancel_send_message_query, it shouldn't happen
@ -8334,7 +8334,7 @@ void MessagesManager::on_upload_media(FileId file_id, tl_object_ptr<telegram_api
}
}
void MessagesManager::do_send_media(DialogId dialog_id, Message *m, FileId file_id, FileId thumbnail_file_id,
void MessagesManager::do_send_media(DialogId dialog_id, const Message *m, FileId file_id, FileId thumbnail_file_id,
tl_object_ptr<telegram_api::InputFile> input_file,
tl_object_ptr<telegram_api::InputFile> input_thumbnail) {
CHECK(m != nullptr);
@ -8365,7 +8365,8 @@ void MessagesManager::do_send_media(DialogId dialog_id, Message *m, FileId file_
on_message_media_uploaded(dialog_id, m, std::move(input_media), file_id, thumbnail_file_id);
}
void MessagesManager::do_send_secret_media(DialogId dialog_id, Message *m, FileId file_id, FileId thumbnail_file_id,
void MessagesManager::do_send_secret_media(DialogId dialog_id, const Message *m, FileId file_id,
FileId thumbnail_file_id,
tl_object_ptr<telegram_api::InputEncryptedFile> input_encrypted_file,
BufferSlice thumbnail) {
CHECK(dialog_id.get_type() == DialogType::SecretChat);

View File

@ -1843,11 +1843,11 @@ class MessagesManager final : public Actor {
td_api::object_ptr<td_api::messageSendOptions> &&options,
bool in_game_share, vector<MessageCopyOptions> &&copy_options);
void do_send_media(DialogId dialog_id, Message *m, FileId file_id, FileId thumbnail_file_id,
void do_send_media(DialogId dialog_id, const Message *m, FileId file_id, FileId thumbnail_file_id,
tl_object_ptr<telegram_api::InputFile> input_file,
tl_object_ptr<telegram_api::InputFile> input_thumbnail);
void do_send_secret_media(DialogId dialog_id, Message *m, FileId file_id, FileId thumbnail_file_id,
void do_send_secret_media(DialogId dialog_id, const Message *m, FileId file_id, FileId thumbnail_file_id,
tl_object_ptr<telegram_api::InputEncryptedFile> input_encrypted_file,
BufferSlice thumbnail);

View File

@ -2212,7 +2212,7 @@ void QuickReplyManager::on_upload_media(FileId file_id, telegram_api::object_ptr
being_uploaded_files_.erase(it);
auto *m = get_message(message_full_id);
const auto *m = get_message(message_full_id);
if (m == nullptr || (m->message_id.is_server() && m->edit_generation != edit_generation)) {
send_closure_later(G()->file_manager(), &FileManager::cancel_upload, file_id);
return;
@ -2232,7 +2232,7 @@ void QuickReplyManager::on_upload_media(FileId file_id, telegram_api::object_ptr
}
}
void QuickReplyManager::do_send_media(QuickReplyMessage *m, FileId file_id, FileId thumbnail_file_id,
void QuickReplyManager::do_send_media(const QuickReplyMessage *m, FileId file_id, FileId thumbnail_file_id,
telegram_api::object_ptr<telegram_api::InputFile> input_file,
telegram_api::object_ptr<telegram_api::InputFile> input_thumbnail) {
CHECK(m != nullptr);

View File

@ -373,7 +373,7 @@ class QuickReplyManager final : public Actor {
void on_upload_media(FileId file_id, telegram_api::object_ptr<telegram_api::InputFile> input_file);
void do_send_media(QuickReplyMessage *m, FileId file_id, FileId thumbnail_file_id,
void do_send_media(const QuickReplyMessage *m, FileId file_id, FileId thumbnail_file_id,
telegram_api::object_ptr<telegram_api::InputFile> input_file,
telegram_api::object_ptr<telegram_api::InputFile> input_thumbnail);