mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Handle ttl_period locally.
This commit is contained in:
@@ -945,6 +945,35 @@ void PeerData::setLoadedStatus(LoadedStatus status) {
|
||||
_loadedStatus = status;
|
||||
}
|
||||
|
||||
TimeId PeerData::messagesTTL() const {
|
||||
return (_ttlMyPeriod && _ttlPeerPeriod)
|
||||
? std::min(_ttlMyPeriod, _ttlPeerPeriod)
|
||||
: std::max(_ttlMyPeriod, _ttlPeerPeriod);
|
||||
}
|
||||
|
||||
void PeerData::setMessagesTTL(
|
||||
TimeId myPeriod,
|
||||
TimeId peerPeriod,
|
||||
bool oneSide) {
|
||||
_ttlMyPeriod = myPeriod;
|
||||
_ttlPeerPeriod = peerPeriod;
|
||||
_ttlOneSide = oneSide;
|
||||
}
|
||||
|
||||
void PeerData::applyMessagesTTL(const MTPPeerHistoryTTL &ttl) {
|
||||
ttl.match([&](const MTPDpeerHistoryTTL &data) {
|
||||
setMessagesTTL(
|
||||
data.vttl_period().v,
|
||||
data.vttl_period().v,
|
||||
false);
|
||||
}, [&](const MTPDpeerHistoryTTLPM &data) {
|
||||
setMessagesTTL(
|
||||
data.vmy_ttl_period().value_or_empty(),
|
||||
data.vpeer_ttl_period().value_or_empty(),
|
||||
data.is_my_oneside());
|
||||
});
|
||||
}
|
||||
|
||||
namespace Data {
|
||||
|
||||
std::vector<ChatRestrictions> ListOfRestrictions() {
|
||||
|
Reference in New Issue
Block a user