2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 22:55:11 +00:00

Update API scheme, simplify auto-delete.

This commit is contained in:
John Preston
2021-02-15 14:31:04 +04:00
parent 05488022c7
commit 781e7a2e79
13 changed files with 95 additions and 192 deletions

View File

@@ -950,41 +950,18 @@ void PeerData::setLoadedStatus(LoadedStatus status) {
}
TimeId PeerData::messagesTTL() const {
return (_ttlMyPeriod && _ttlPeerPeriod)
? std::min(_ttlMyPeriod, _ttlPeerPeriod)
: std::max(_ttlMyPeriod, _ttlPeerPeriod);
return _ttlPeriod;
}
void PeerData::setMessagesTTL(
TimeId myPeriod,
TimeId peerPeriod,
bool oneSide) {
if (_ttlMyPeriod != myPeriod
|| _ttlPeerPeriod != peerPeriod
|| _ttlOneSide != oneSide) {
_ttlMyPeriod = myPeriod;
_ttlPeerPeriod = peerPeriod;
_ttlOneSide = oneSide;
void PeerData::setMessagesTTL(TimeId period) {
if (_ttlPeriod != period) {
_ttlPeriod = period;
session().changes().peerUpdated(
this,
Data::PeerUpdate::Flag::MessagesTTL);
}
}
void PeerData::applyMessagesTTL(const MTPPeerHistoryTTL &ttl) {
ttl.match([&](const MTPDpeerHistoryTTL &data) {
setMessagesTTL(
data.vttl_period().v,
0,
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() {