2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Don't use MTP* for ChannelData flags.

This commit is contained in:
John Preston
2021-07-08 16:11:09 +03:00
parent 5040c2e766
commit a74228acea
18 changed files with 209 additions and 178 deletions

View File

@@ -250,10 +250,9 @@ void PeerData::updateNameDelayed(
if (asChannel()->username != newUsername) {
asChannel()->username = newUsername;
if (newUsername.isEmpty()) {
asChannel()->removeFlags(
MTPDchannel::Flag::f_username);
asChannel()->removeFlags(ChannelDataFlag::Username);
} else {
asChannel()->addFlags(MTPDchannel::Flag::f_username);
asChannel()->addFlags(ChannelDataFlag::Username);
}
flags |= UpdateFlag::Username;
}
@@ -909,7 +908,7 @@ bool PeerData::slowmodeApplied() const {
if (const auto channel = asChannel()) {
return !channel->amCreator()
&& !channel->hasAdminRights()
&& (channel->flags() & MTPDchannel::Flag::f_slowmode_enabled);
&& (channel->flags() & ChannelDataFlag::SlowmodeEnabled);
}
return false;
}
@@ -928,9 +927,9 @@ rpl::producer<bool> PeerData::slowmodeAppliedValue() const {
auto slowmodeEnabled = channel->flagsValue(
) | rpl::filter([=](const ChannelData::Flags::Change &change) {
return (change.diff & MTPDchannel::Flag::f_slowmode_enabled) != 0;
return (change.diff & ChannelDataFlag::SlowmodeEnabled) != 0;
}) | rpl::map([=](const ChannelData::Flags::Change &change) {
return (change.value & MTPDchannel::Flag::f_slowmode_enabled) != 0;
return (change.value & ChannelDataFlag::SlowmodeEnabled) != 0;
}) | rpl::distinct_until_changed();
return rpl::combine(