Add struct UploadedFileInfo.
This commit is contained in:
parent
224ec33016
commit
ed26d0da16
@ -8266,8 +8266,8 @@ void MessagesManager::on_upload_media(FileId file_id, tl_object_ptr<telegram_api
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto message_full_id = it->second.first;
|
auto message_full_id = it->second.message_full_id;
|
||||||
auto thumbnail_file_id = it->second.second;
|
auto thumbnail_file_id = it->second.thumbnail_file_id;
|
||||||
|
|
||||||
being_uploaded_files_.erase(it);
|
being_uploaded_files_.erase(it);
|
||||||
|
|
||||||
@ -8395,7 +8395,7 @@ void MessagesManager::on_upload_media_error(FileId file_id, Status status) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto message_full_id = it->second.first;
|
auto message_full_id = it->second.message_full_id;
|
||||||
|
|
||||||
being_uploaded_files_.erase(it);
|
being_uploaded_files_.erase(it);
|
||||||
|
|
||||||
@ -12314,7 +12314,7 @@ void MessagesManager::hangup() {
|
|||||||
if (!G()->use_message_database()) {
|
if (!G()->use_message_database()) {
|
||||||
while (!being_uploaded_files_.empty()) {
|
while (!being_uploaded_files_.empty()) {
|
||||||
auto it = being_uploaded_files_.begin();
|
auto it = being_uploaded_files_.begin();
|
||||||
auto message_full_id = it->second.first;
|
auto message_full_id = it->second.message_full_id;
|
||||||
being_uploaded_files_.erase(it);
|
being_uploaded_files_.erase(it);
|
||||||
if (message_full_id.get_message_id().is_yet_unsent()) {
|
if (message_full_id.get_message_id().is_yet_unsent()) {
|
||||||
fail_send_message(message_full_id, Global::request_aborted_error());
|
fail_send_message(message_full_id, Global::request_aborted_error());
|
||||||
@ -23990,7 +23990,7 @@ void MessagesManager::do_send_message(DialogId dialog_id, const Message *m, vect
|
|||||||
CHECK(file_view.is_encrypted_secret());
|
CHECK(file_view.is_encrypted_secret());
|
||||||
bool is_inserted =
|
bool is_inserted =
|
||||||
being_uploaded_files_
|
being_uploaded_files_
|
||||||
.emplace(file_id, std::make_pair(MessageFullId(dialog_id, m->message_id), thumbnail_file_id))
|
.emplace(file_id, UploadedFileInfo{MessageFullId(dialog_id, m->message_id), thumbnail_file_id})
|
||||||
.second;
|
.second;
|
||||||
CHECK(is_inserted);
|
CHECK(is_inserted);
|
||||||
// need to call resume_upload synchronously to make upload process consistent with being_uploaded_files_
|
// need to call resume_upload synchronously to make upload process consistent with being_uploaded_files_
|
||||||
@ -24024,7 +24024,7 @@ void MessagesManager::do_send_message(DialogId dialog_id, const Message *m, vect
|
|||||||
LOG(INFO) << "Ask to upload file " << file_id << " with bad parts " << bad_parts;
|
LOG(INFO) << "Ask to upload file " << file_id << " with bad parts " << bad_parts;
|
||||||
bool is_inserted =
|
bool is_inserted =
|
||||||
being_uploaded_files_
|
being_uploaded_files_
|
||||||
.emplace(file_id, std::make_pair(MessageFullId(dialog_id, m->message_id), thumbnail_file_id))
|
.emplace(file_id, UploadedFileInfo{MessageFullId(dialog_id, m->message_id), thumbnail_file_id})
|
||||||
.second;
|
.second;
|
||||||
CHECK(is_inserted);
|
CHECK(is_inserted);
|
||||||
// need to call resume_upload synchronously to make upload process consistent with being_uploaded_files_
|
// need to call resume_upload synchronously to make upload process consistent with being_uploaded_files_
|
||||||
|
@ -3164,8 +3164,11 @@ class MessagesManager final : public Actor {
|
|||||||
|
|
||||||
double last_channel_pts_jump_warning_time_ = 0;
|
double last_channel_pts_jump_warning_time_ = 0;
|
||||||
|
|
||||||
FlatHashMap<FileId, std::pair<MessageFullId, FileId>, FileIdHash>
|
struct UploadedFileInfo {
|
||||||
being_uploaded_files_; // file_id -> message, thumbnail_file_id
|
MessageFullId message_full_id;
|
||||||
|
FileId thumbnail_file_id;
|
||||||
|
};
|
||||||
|
FlatHashMap<FileId, UploadedFileInfo, FileIdHash> being_uploaded_files_;
|
||||||
struct UploadedThumbnailInfo {
|
struct UploadedThumbnailInfo {
|
||||||
MessageFullId message_full_id;
|
MessageFullId message_full_id;
|
||||||
FileId file_id; // original file file_id
|
FileId file_id; // original file file_id
|
||||||
|
Loading…
Reference in New Issue
Block a user