Skip to content

Commit

Permalink
Made need_delete_message_files const.
Browse files Browse the repository at this point in the history
GitOrigin-RevId: b547551f6968766447e448c00c0bd65333316886
  • Loading branch information
levlam committed Apr 29, 2019
1 parent a33a620 commit b49e312
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions td/telegram/MessagesManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23149,16 +23149,17 @@ bool MessagesManager::need_delete_file(FullMessageId full_message_id, FileId fil
return true;
}

bool MessagesManager::need_delete_message_files(Dialog *d, const Message *m) {
bool MessagesManager::need_delete_message_files(Dialog *d, const Message *m) const {
CHECK(d != nullptr);
if (m == nullptr || !m->message_id.is_server()) {
return false;
}

if (m->forward_info != nullptr && m->forward_info->from_dialog_id.is_valid() &&
m->forward_info->from_message_id.is_valid()) {
const Message *old_m = get_message_force({m->forward_info->from_dialog_id, m->forward_info->from_message_id},
"need_delete_message_files");
// this function must not try to load the message, because it can be called from
// do_delete_message or add_message_to_dialog
const Message *old_m = get_message({m->forward_info->from_dialog_id, m->forward_info->from_message_id});
if (old_m != nullptr && get_message_file_ids(old_m) == get_message_file_ids(m)) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion td/telegram/MessagesManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -1560,7 +1560,7 @@ class MessagesManager : public Actor {

bool need_delete_file(FullMessageId full_message_id, FileId file_id) const;

bool need_delete_message_files(Dialog *d, const Message *m);
bool need_delete_message_files(Dialog *d, const Message *m) const;

void add_message_to_database(const Dialog *d, const Message *m, const char *source);

Expand Down

0 comments on commit b49e312

Please sign in to comment.