2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Don't use MTP* for UserData flags.

This commit is contained in:
John Preston
2021-07-08 14:19:12 +03:00
parent 2ffda9f240
commit e34375405e
11 changed files with 116 additions and 94 deletions

View File

@@ -167,8 +167,7 @@ void UserData::madeAction(TimeId when) {
void UserData::setAccessHash(uint64 accessHash) {
if (accessHash == kInaccessibleAccessHashOld) {
_accessHash = 0;
// _flags.add(MTPDuser_ClientFlag::f_inaccessible | 0);
_flags.add(MTPDuser::Flag::f_deleted);
_flags.add(Flag::Deleted);
} else {
_accessHash = accessHash;
}
@@ -211,7 +210,16 @@ void ApplyUserUpdate(not_null<UserData*> user, const MTPDuserFull &update) {
if (const auto pinned = update.vpinned_msg_id()) {
SetTopPinnedMessageId(user, pinned->v);
}
user->setFullFlags(update.vflags().v);
using Flag = UserDataFlag;
const auto mask = Flag::Blocked
| Flag::HasPhoneCalls
| Flag::PhoneCallsPrivate
| Flag::CanPinMessages;
user->setFlags((user->flags() & ~mask)
| (update.is_phone_calls_private() ? Flag::PhoneCallsPrivate : Flag())
| (update.is_phone_calls_available() ? Flag::HasPhoneCalls : Flag())
| (update.is_can_pin_message() ? Flag::CanPinMessages : Flag())
| (update.is_blocked() ? Flag::Blocked : Flag()));
user->setIsBlocked(update.is_blocked());
user->setCallsStatus(update.is_phone_calls_private()
? UserData::CallsStatus::Private