Update recent hashtags when message is edited.

GitOrigin-RevId: ba6dc7bda612d96f9417516fe684d053e68a9e24
This commit is contained in:
levlam 2018-04-23 01:50:07 +03:00
parent bb1fdeacd8
commit 01d13bf005
2 changed files with 22 additions and 12 deletions

View File

@ -6117,9 +6117,7 @@ void MessagesManager::process_update(tl_object_ptr<telegram_api::Update> &&updat
on_get_message(std::move(move_tl_object_as<telegram_api::updateEditMessage>(update)->message_), false, false,
false, false, "updateEditMessage");
LOG(INFO) << "Process updateEditMessage";
if (full_message_id != FullMessageId() && td_->auth_manager_->is_bot()) {
send_update_message_edited(full_message_id);
}
on_message_edited(full_message_id);
break;
}
case telegram_api::updateDeleteMessages::ID: {
@ -6191,9 +6189,7 @@ void MessagesManager::process_channel_update(tl_object_ptr<telegram_api::Update>
on_get_message(std::move(move_tl_object_as<telegram_api::updateEditChannelMessage>(update)->message_), false,
true, false, false, "updateEditChannelMessage");
LOG(INFO) << "Process updateEditChannelMessage";
if (full_message_id != FullMessageId() && td_->auth_manager_->is_bot()) {
send_update_message_edited(full_message_id);
}
on_message_edited(full_message_id);
break;
}
default:
@ -6201,6 +6197,24 @@ void MessagesManager::process_channel_update(tl_object_ptr<telegram_api::Update>
}
}
void MessagesManager::on_message_edited(FullMessageId full_message_id) {
if (full_message_id == FullMessageId()) {
return;
}
auto dialog_id = full_message_id.get_dialog_id();
Message *m = get_message(full_message_id);
CHECK(m != nullptr);
if (td_->auth_manager_->is_bot()) {
send_update_message_edited(dialog_id, m);
} else {
if (m->forward_info == nullptr &&
(m->is_outgoing || dialog_id == DialogId(td_->contacts_manager_->get_my_id("on_message_edited")))) {
update_used_hashtags(dialog_id, m);
}
}
}
void MessagesManager::process_pending_updates() {
for (auto &update : pending_updates_) {
process_update(std::move(update.second.update));
@ -18694,10 +18708,6 @@ void MessagesManager::send_update_message_content(DialogId dialog_id, MessageId
dialog_id.get(), message_id.get(), get_message_content_object(content, message_date, is_content_secret)));
}
void MessagesManager::send_update_message_edited(FullMessageId full_message_id) {
return send_update_message_edited(full_message_id.get_dialog_id(), get_message(full_message_id));
}
void MessagesManager::send_update_message_edited(DialogId dialog_id, const Message *m) {
CHECK(m != nullptr);
cancel_user_dialog_action(dialog_id, m);

View File

@ -1932,6 +1932,8 @@ class MessagesManager : public Actor {
void process_channel_update(tl_object_ptr<telegram_api::Update> &&update);
void on_message_edited(FullMessageId full_message_id);
void delete_messages_from_updates(const vector<MessageId> &message_ids);
void delete_dialog_messages_from_updates(DialogId dialog_id, const vector<MessageId> &message_ids);
@ -2166,8 +2168,6 @@ class MessagesManager : public Actor {
void send_update_message_content(DialogId dialog_id, MessageId message_id, const MessageContent *content,
int32 message_date, bool is_content_secret, const char *source) const;
void send_update_message_edited(FullMessageId full_message_id);
void send_update_message_edited(DialogId dialog_id, const Message *m);
void send_update_delete_messages(DialogId dialog_id, vector<int64> &&message_ids, bool is_permanent,