2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-26 20:37:09 +00:00
kotatogram-desktop/Telegram/SourceFiles/data/notify/data_peer_notify_settings.h

55 lines
1.2 KiB
C
Raw Normal View History

2017-12-04 21:46:03 +04:00
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
2017-12-04 21:46:03 +04:00
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
2017-12-04 21:46:03 +04:00
*/
#pragma once
namespace Data {
class NotifyPeerSettingsValue;
2017-12-04 21:46:03 +04:00
2022-03-30 10:20:42 +04:00
struct NotifySound {
QString title;
QString data;
DocumentId id = 0;
bool none = false;
};
inline bool operator==(const NotifySound &a, const NotifySound &b) {
return (a.id == b.id)
&& (a.none == b.none)
&& (a.title == b.title)
&& (a.data == b.data);
}
class PeerNotifySettings {
2017-12-04 21:46:03 +04:00
public:
PeerNotifySettings();
2017-12-04 21:46:03 +04:00
static constexpr auto kDefaultMutePeriod = 86400 * 365;
2017-12-04 21:46:03 +04:00
bool change(const MTPPeerNotifySettings &settings);
bool change(
2018-09-21 19:28:46 +03:00
std::optional<int> muteForSeconds,
std::optional<bool> silentPosts,
std::optional<NotifySound> sound);
2017-12-04 21:46:03 +04:00
bool settingsUnknown() const;
2018-09-21 19:28:46 +03:00
std::optional<TimeId> muteUntil() const;
std::optional<bool> silentPosts() const;
std::optional<NotifySound> sound() const;
2017-12-04 21:46:03 +04:00
MTPinputPeerNotifySettings serialize() const;
~PeerNotifySettings();
2017-12-04 21:46:03 +04:00
private:
bool _known = false;
std::unique_ptr<NotifyPeerSettingsValue> _value;
2017-12-04 21:46:03 +04:00
};
} // namespace Data