Register suggested profile photos.
This commit is contained in:
parent
f28fe46746
commit
3f55703211
@ -12698,6 +12698,23 @@ void ContactsManager::do_update_user_photo(User *u, UserId user_id, ProfilePhoto
|
||||
}
|
||||
}
|
||||
|
||||
void ContactsManager::register_suggested_profile_photo(const Photo &photo) {
|
||||
auto photo_file_ids = photo_get_file_ids(photo);
|
||||
if (photo.is_empty() || photo_file_ids.empty()) {
|
||||
return;
|
||||
}
|
||||
auto first_file_id = photo_file_ids[0];
|
||||
auto file_type = td_->file_manager_->get_file_view(first_file_id).get_type();
|
||||
if (file_type == FileType::ProfilePhoto) {
|
||||
return;
|
||||
}
|
||||
CHECK(file_type == FileType::Photo);
|
||||
auto photo_id = photo.id.get();
|
||||
if (photo_id != 0) {
|
||||
my_photo_file_id_[photo_id] = first_file_id;
|
||||
}
|
||||
}
|
||||
|
||||
void ContactsManager::register_user_photo(User *u, UserId user_id, const Photo &photo) {
|
||||
auto photo_file_ids = photo_get_file_ids(photo);
|
||||
if (photo.is_empty() || photo_file_ids.empty()) {
|
||||
|
@ -361,6 +361,8 @@ class ContactsManager final : public Actor {
|
||||
|
||||
void get_is_location_visible(Promise<Unit> &&promise);
|
||||
|
||||
void register_suggested_profile_photo(const Photo &photo);
|
||||
|
||||
FileId get_profile_photo_file_id(int64 photo_id) const;
|
||||
|
||||
void set_profile_photo(const td_api::object_ptr<td_api::InputChatPhoto> &input_photo, bool is_fallback,
|
||||
|
@ -4050,6 +4050,9 @@ void register_message_content(Td *td, const MessageContent *content, FullMessage
|
||||
case MessageContentType::GiftPremium:
|
||||
return td->stickers_manager_->register_premium_gift(static_cast<const MessageGiftPremium *>(content)->months,
|
||||
full_message_id, source);
|
||||
case MessageContentType::SuggestProfilePhoto:
|
||||
return td->contacts_manager_->register_suggested_profile_photo(
|
||||
static_cast<const MessageSuggestProfilePhoto *>(content)->photo);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user