Add on_sent_message_content.
GitOrigin-RevId: ce05a403dd251208c19696598b7ff2fea7b910f0
This commit is contained in:
parent
61b770c5a7
commit
c6c82220a4
@ -570,6 +570,7 @@ void AnimationsManager::add_saved_animation_by_id(FileId animation_id) {
|
||||
bool AnimationsManager::add_saved_animation_impl(FileId animation_id, Promise<Unit> &promise) {
|
||||
CHECK(!td_->auth_manager_->is_bot());
|
||||
|
||||
LOG(INFO) << "Add saved animation " << animation_id;
|
||||
if (!are_saved_animations_loaded_) {
|
||||
load_saved_animations(PromiseCreator::lambda([animation_id, promise = std::move(promise)](Result<> result) mutable {
|
||||
if (result.is_ok()) {
|
||||
|
@ -4524,4 +4524,16 @@ void add_message_content_dependencies(Dependencies &dependencies, const MessageC
|
||||
add_formatted_text_dependencies(dependencies, get_message_content_text(message_content));
|
||||
}
|
||||
|
||||
void on_sent_message_content(Td *td, const MessageContent *content) {
|
||||
switch (content->get_type()) {
|
||||
case MessageContentType::Animation:
|
||||
return td->animations_manager_->add_saved_animation_by_id(get_message_content_file_id(content));
|
||||
case MessageContentType::Sticker:
|
||||
return td->stickers_manager_->add_recent_sticker_by_id(false, get_message_content_file_id(content));
|
||||
default:
|
||||
// nothing to do
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -221,6 +221,8 @@ string get_message_content_search_text(const Td *td, const MessageContent *conte
|
||||
|
||||
void update_expired_message_content(unique_ptr<MessageContent> &content);
|
||||
|
||||
void on_sent_message_content(Td *td, const MessageContent *content);
|
||||
|
||||
void add_message_content_dependencies(Dependencies &dependencies, const MessageContent *message_content);
|
||||
|
||||
} // namespace td
|
||||
|
@ -6,7 +6,6 @@
|
||||
//
|
||||
#include "td/telegram/MessagesManager.h"
|
||||
|
||||
#include "td/telegram/AnimationsManager.h"
|
||||
#include "td/telegram/AuthManager.h"
|
||||
#include "td/telegram/ChatId.h"
|
||||
#include "td/telegram/ConfigShared.h"
|
||||
@ -21036,21 +21035,10 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq
|
||||
}
|
||||
if (!td_->auth_manager_->is_bot() && from_update && m->forward_info == nullptr &&
|
||||
(m->is_outgoing || dialog_id == my_dialog_id)) {
|
||||
switch (message_content_type) {
|
||||
case MessageContentType::Animation:
|
||||
if (dialog_id.get_type() != DialogType::SecretChat) {
|
||||
td_->animations_manager_->add_saved_animation_by_id(get_message_content_file_id(m->content.get()));
|
||||
}
|
||||
break;
|
||||
case MessageContentType::Sticker:
|
||||
if (dialog_id.get_type() != DialogType::SecretChat) {
|
||||
td_->stickers_manager_->add_recent_sticker_by_id(false, get_message_content_file_id(m->content.get()));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
update_used_hashtags(dialog_id, m);
|
||||
break;
|
||||
if (dialog_id.get_type() != DialogType::SecretChat && !message_id.is_local()) {
|
||||
on_sent_message_content(td_, m->content.get());
|
||||
}
|
||||
update_used_hashtags(dialog_id, m);
|
||||
}
|
||||
if (!td_->auth_manager_->is_bot() && from_update && message_id.is_server() &&
|
||||
(m->is_outgoing || dialog_id == my_dialog_id) && dialog_id.get_type() != DialogType::SecretChat) {
|
||||
|
@ -3701,6 +3701,7 @@ void StickersManager::add_recent_sticker_by_id(bool is_attached, FileId sticker_
|
||||
bool StickersManager::add_recent_sticker_impl(bool is_attached, FileId sticker_id, Promise<Unit> &promise) {
|
||||
CHECK(!td_->auth_manager_->is_bot());
|
||||
|
||||
LOG(INFO) << "Add recent " << (is_attached ? "attached " : "") << "sticker " << sticker_id;
|
||||
if (!are_recent_stickers_loaded_[is_attached]) {
|
||||
load_recent_stickers(is_attached, PromiseCreator::lambda([is_attached, sticker_id,
|
||||
promise = std::move(promise)](Result<> result) mutable {
|
||||
|
Reference in New Issue
Block a user