Register BusinessIntro files.

This commit is contained in:
levlam 2024-03-20 19:40:10 +03:00
parent 0e4dc27542
commit 7db0e34990
5 changed files with 20 additions and 0 deletions

View File

@ -105,4 +105,8 @@ void BusinessInfo::add_dependencies(Dependencies &dependencies) const {
greeting_message_.add_dependencies(dependencies);
}
vector<FileId> BusinessInfo::get_file_ids(const Td *td) const {
return intro_.get_file_ids(td);
}
} // namespace td

View File

@ -11,6 +11,7 @@
#include "td/telegram/BusinessIntro.h"
#include "td/telegram/BusinessWorkHours.h"
#include "td/telegram/DialogLocation.h"
#include "td/telegram/files/FileId.h"
#include "td/telegram/td_api.h"
#include "td/utils/common.h"
@ -38,6 +39,8 @@ class BusinessInfo {
void add_dependencies(Dependencies &dependencies) const;
vector<FileId> get_file_ids(const Td *td) const;
template <class StorerT>
void store(StorerT &storer) const;

View File

@ -6,6 +6,7 @@
//
#include "td/telegram/BusinessIntro.h"
#include "td/telegram/Document.h"
#include "td/telegram/files/FileManager.h"
#include "td/telegram/misc.h"
#include "td/telegram/StickersManager.h"
@ -69,6 +70,13 @@ telegram_api::object_ptr<telegram_api::inputBusinessIntro> BusinessIntro::get_in
std::move(input_document));
}
vector<FileId> BusinessIntro::get_file_ids(const Td *td) const {
if (!sticker_file_id_.is_valid()) {
return {};
}
return Document(Document::Type::Sticker, sticker_file_id_).get_file_ids(td);
}
bool operator==(const BusinessIntro &lhs, const BusinessIntro &rhs) {
return lhs.title_ == rhs.title_ && lhs.description_ == rhs.description_ &&
lhs.sticker_file_id_ == rhs.sticker_file_id_;

View File

@ -33,6 +33,8 @@ class BusinessIntro {
return title_.empty() && description_.empty() && !sticker_file_id_.is_valid();
}
vector<FileId> get_file_ids(const Td *td) const;
template <class StorerT>
void store(StorerT &storer) const;

View File

@ -10072,6 +10072,9 @@ void ContactsManager::update_user_full(UserFull *user_full, UserId user_id, cons
if (user_full->description_animation_file_id.is_valid()) {
file_ids.push_back(user_full->description_animation_file_id);
}
if (user_full->business_info != nullptr) {
append(file_ids, user_full->business_info->get_file_ids(td_));
}
if (user_full->registered_file_ids != file_ids) {
auto &file_source_id = user_full->file_source_id;
if (!file_source_id.is_valid()) {