Add MessagesManager::update_forward_count.
This commit is contained in:
parent
5f02a34c34
commit
6af4338f8b
@ -9136,12 +9136,10 @@ void MessagesManager::on_get_history(DialogId dialog_id, MessageId from_message_
|
||||
set_dialog_last_new_message_id(
|
||||
d, last_added_message_id.is_valid() ? last_added_message_id : last_received_message_id, "on_get_history");
|
||||
}
|
||||
if (last_added_message_id.is_valid()) {
|
||||
if (last_added_message_id > d->last_message_id) {
|
||||
CHECK(d->last_new_message_id.is_valid());
|
||||
set_dialog_last_message_id(d, last_added_message_id, "on_get_history");
|
||||
send_update_chat_last_message(d, "on_get_history");
|
||||
}
|
||||
if (last_added_message_id.is_valid() && last_added_message_id > d->last_message_id) {
|
||||
CHECK(d->last_new_message_id.is_valid());
|
||||
set_dialog_last_message_id(d, last_added_message_id, "on_get_history");
|
||||
send_update_chat_last_message(d, "on_get_history");
|
||||
}
|
||||
}
|
||||
|
||||
@ -13163,14 +13161,6 @@ FullMessageId MessagesManager::on_get_message(MessageInfo &&message_info, bool f
|
||||
|
||||
CHECK(d != nullptr);
|
||||
|
||||
if (is_sent_message) {
|
||||
try_add_active_live_location(dialog_id, m);
|
||||
|
||||
// add_message_to_dialog will not update counts, because need_update == false
|
||||
update_message_count_by_index(d, +1, m);
|
||||
update_reply_count_by_message(d, +1, m);
|
||||
}
|
||||
|
||||
auto pcc_it = pending_created_dialogs_.find(dialog_id);
|
||||
if (from_update && pcc_it != pending_created_dialogs_.end()) {
|
||||
pcc_it->second.set_value(Unit());
|
||||
@ -13182,6 +13172,14 @@ FullMessageId MessagesManager::on_get_message(MessageInfo &&message_info, bool f
|
||||
send_update_new_message(d, m);
|
||||
}
|
||||
|
||||
if (is_sent_message) {
|
||||
try_add_active_live_location(dialog_id, m);
|
||||
|
||||
// add_message_to_dialog will not update counts, because need_update == false
|
||||
update_message_count_by_index(d, +1, m);
|
||||
update_reply_count_by_message(d, +1, m);
|
||||
}
|
||||
|
||||
if (dialog_id.get_type() == DialogType::Channel && !have_input_peer(dialog_id, AccessRights::Read)) {
|
||||
auto p = delete_message(d, message_id, false, &need_update_dialog_pos, "get a message in inaccessible chat");
|
||||
CHECK(p.get() == m);
|
||||
@ -31973,11 +31971,8 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!td_->auth_manager_->is_bot() && from_update && m->forward_info != nullptr &&
|
||||
m->forward_info->sender_dialog_id.is_valid() && m->forward_info->message_id.is_valid() &&
|
||||
(!is_discussion_message(dialog_id, m) || m->forward_info->sender_dialog_id != m->forward_info->from_dialog_id ||
|
||||
m->forward_info->message_id != m->forward_info->from_message_id)) {
|
||||
update_forward_count(m->forward_info->sender_dialog_id, m->forward_info->message_id, m->date);
|
||||
if (*need_update) {
|
||||
update_forward_count(dialog_id, m);
|
||||
}
|
||||
|
||||
return result_message;
|
||||
@ -35351,6 +35346,15 @@ void MessagesManager::update_top_dialogs(DialogId dialog_id, const Message *m) {
|
||||
}
|
||||
}
|
||||
|
||||
void MessagesManager::update_forward_count(DialogId dialog_id, const Message *m) {
|
||||
if (!td_->auth_manager_->is_bot() && m->forward_info != nullptr &&
|
||||
m->forward_info->sender_dialog_id.is_valid() && m->forward_info->message_id.is_valid() &&
|
||||
(!is_discussion_message(dialog_id, m) || m->forward_info->sender_dialog_id != m->forward_info->from_dialog_id ||
|
||||
m->forward_info->message_id != m->forward_info->from_message_id)) {
|
||||
update_forward_count(m->forward_info->sender_dialog_id, m->forward_info->message_id, m->date);
|
||||
}
|
||||
}
|
||||
|
||||
void MessagesManager::update_forward_count(DialogId dialog_id, MessageId message_id, int32 update_date) {
|
||||
CHECK(!td_->auth_manager_->is_bot());
|
||||
Dialog *d = get_dialog(dialog_id);
|
||||
|
@ -2916,6 +2916,8 @@ class MessagesManager : public Actor {
|
||||
|
||||
void update_top_dialogs(DialogId dialog_id, const Message *m);
|
||||
|
||||
void update_forward_count(DialogId dialog_id, const Message *m);
|
||||
|
||||
void update_forward_count(DialogId dialog_id, MessageId message_id, int32 update_date);
|
||||
|
||||
void try_hide_distance(DialogId dialog_id, const Message *m);
|
||||
|
Loading…
Reference in New Issue
Block a user