mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Added initial box for premium gifts.
This commit is contained in:
@@ -253,6 +253,10 @@ bool UserData::canAddContact() const {
|
||||
return canShareThisContact() && !isContact();
|
||||
}
|
||||
|
||||
bool UserData::canReceiveGifts() const {
|
||||
return flags() & UserDataFlag::CanReceiveGifts;
|
||||
}
|
||||
|
||||
bool UserData::canShareThisContactFast() const {
|
||||
return !_phone.isEmpty();
|
||||
}
|
||||
@@ -309,14 +313,19 @@ void ApplyUserUpdate(not_null<UserData*> user, const MTPDuserFull &update) {
|
||||
if (const auto pinned = update.vpinned_msg_id()) {
|
||||
SetTopPinnedMessageId(user, pinned->v);
|
||||
}
|
||||
const auto canReceiveGifts = (update.vflags().v
|
||||
& MTPDuserFull::Flag::f_premium_gifts)
|
||||
&& update.vpremium_gifts();
|
||||
using Flag = UserDataFlag;
|
||||
const auto mask = Flag::Blocked
|
||||
| Flag::HasPhoneCalls
|
||||
| Flag::PhoneCallsPrivate
|
||||
| Flag::CanReceiveGifts
|
||||
| Flag::CanPinMessages;
|
||||
user->setFlags((user->flags() & ~mask)
|
||||
| (update.is_phone_calls_private() ? Flag::PhoneCallsPrivate : Flag())
|
||||
| (update.is_phone_calls_available() ? Flag::HasPhoneCalls : Flag())
|
||||
| (canReceiveGifts ? Flag::CanReceiveGifts : Flag())
|
||||
| (update.is_can_pin_message() ? Flag::CanPinMessages : Flag())
|
||||
| (update.is_blocked() ? Flag::Blocked : Flag()));
|
||||
user->setIsBlocked(update.is_blocked());
|
||||
|
Reference in New Issue
Block a user