2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-05 17:15:16 +00:00

Use getters in MTP classes.

This commit is contained in:
John Preston
2019-07-05 15:38:38 +02:00
parent 3ca28c0cf9
commit 567bf60644
100 changed files with 2807 additions and 2672 deletions

View File

@@ -55,15 +55,17 @@ NotifySettingsValue::NotifySettingsValue(
}
bool NotifySettingsValue::change(const MTPDpeerNotifySettings &data) {
return change(data.has_mute_until()
? base::make_optional(data.vmute_until.v)
: std::nullopt, data.has_sound()
? base::make_optional(qs(data.vsound))
: std::nullopt, data.has_show_previews()
? base::make_optional(mtpIsTrue(data.vshow_previews))
: std::nullopt, data.has_silent()
? base::make_optional(mtpIsTrue(data.vsilent))
: std::nullopt);
const auto mute = data.vmute_until();
const auto sound = data.vsound();
const auto showPreviews = data.vshow_previews();
const auto silent = data.vsilent();
return change(
mute ? std::make_optional(mute->v) : std::nullopt,
sound ? std::make_optional(qs(*sound)) : std::nullopt,
(showPreviews
? std::make_optional(mtpIsTrue(*showPreviews))
: std::nullopt),
silent ? std::make_optional(mtpIsTrue(*silent)) : std::nullopt);
}
bool NotifySettingsValue::change(
@@ -139,7 +141,7 @@ bool NotifySettings::change(const MTPPeerNotifySettings &settings) {
Expects(settings.type() == mtpc_peerNotifySettings);
auto &data = settings.c_peerNotifySettings();
const auto empty = !data.vflags.v;
const auto empty = !data.vflags().v;
if (empty) {
if (!_known || _value) {
_known = true;