2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-01 07:05:13 +00:00

Set / suggest / reset a contact personal photo.

This commit is contained in:
John Preston
2022-12-09 16:34:34 +04:00
parent cb99d611f3
commit 5fe9c93cb6
12 changed files with 190 additions and 72 deletions

View File

@@ -54,11 +54,17 @@ void UserData::setIsContact(bool is) {
// see Serialize::readPeer as well
void UserData::setPhoto(const MTPUserProfilePhoto &photo) {
photo.match([&](const MTPDuserProfilePhoto &data) {
if (data.is_personal()) {
addFlags(UserDataFlag::PersonalPhoto);
} else {
removeFlags(UserDataFlag::PersonalPhoto);
}
updateUserpic(
data.vphoto_id().v,
data.vdc_id().v,
data.is_has_video());
}, [&](const MTPDuserProfilePhotoEmpty &) {
removeFlags(UserDataFlag::PersonalPhoto);
clearUserpic();
});
}
@@ -358,6 +364,9 @@ void ApplyUserUpdate(not_null<UserData*> user, const MTPDuserFull &update) {
if (const auto photo = update.vprofile_photo()) {
user->owner().processPhoto(*photo);
}
if (const auto photo = update.vpersonal_photo()) {
user->owner().processPhoto(*photo);
}
user->setSettings(update.vsettings());
user->owner().notifySettings().apply(user, update.vnotify_settings());