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

Don't use MTP for PeerData::isSelf.

This commit is contained in:
John Preston
2021-12-01 18:51:18 +04:00
parent 8592326a3c
commit afcebb136c
6 changed files with 31 additions and 15 deletions

View File

@@ -25,7 +25,8 @@ using UpdateFlag = Data::PeerUpdate::Flag;
} // namespace
UserData::UserData(not_null<Data::Session*> owner, PeerId id)
: PeerData(owner, id) {
: PeerData(owner, id)
, _flags((id == owner->session().userPeerId()) ? Flag::Self : Flag(0)) {
}
bool UserData::canShareThisContact() const {
@@ -173,6 +174,19 @@ void UserData::setAccessHash(uint64 accessHash) {
}
}
void UserData::setFlags(UserDataFlags which) {
_flags.set((flags() & UserDataFlag::Self)
| (which & ~UserDataFlag::Self));
}
void UserData::addFlags(UserDataFlags which) {
_flags.add(which & ~UserDataFlag::Self);
}
void UserData::removeFlags(UserDataFlags which) {
_flags.remove(which & ~UserDataFlag::Self);
}
void UserData::setCallsStatus(CallsStatus callsStatus) {
if (callsStatus != _callsStatus) {
_callsStatus = callsStatus;