2
0
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:
John Preston
2021-02-02 20:38:30 +04:00
parent 046a3906c4
commit 6a6e355af4
13 changed files with 282 additions and 69 deletions

View File

@@ -17,6 +17,11 @@ class UserData;
class ChatData;
class ChannelData;
using ChatAdminRight = MTPDchatAdminRights::Flag;
using ChatRestriction = MTPDchatBannedRights::Flag;
using ChatAdminRights = MTPDchatAdminRights::Flags;
using ChatRestrictions = MTPDchatBannedRights::Flags;
namespace Ui {
class EmptyUserpic;
} // namespace Ui
@@ -30,23 +35,13 @@ namespace Data {
class Session;
class GroupCall;
class CloudImageView;
int PeerColorIndex(PeerId peerId);
int PeerColorIndex(int32 bareId);
style::color PeerUserpicColor(PeerId peerId);
PeerId FakePeerIdForJustName(const QString &name);
} // namespace Data
using ChatAdminRight = MTPDchatAdminRights::Flag;
using ChatRestriction = MTPDchatBannedRights::Flag;
using ChatAdminRights = MTPDchatAdminRights::Flags;
using ChatRestrictions = MTPDchatBannedRights::Flags;
namespace Data {
class CloudImageView;
class RestrictionCheckResult {
public:
[[nodiscard]] static RestrictionCheckResult Allowed() {
@@ -386,6 +381,19 @@ public:
}
void setLoadedStatus(LoadedStatus status);
[[nodiscard]] TimeId myMessagesTTL() const {
return _ttlMyPeriod;
}
[[nodiscard]] TimeId peerMessagesTTL() const {
return _ttlPeerPeriod;
}
[[nodiscard]] bool oneSideTTL() const {
return _ttlOneSide;
}
[[nodiscard]] TimeId messagesTTL() const;
void setMessagesTTL(TimeId myPeriod, TimeId peerPeriod, bool oneSide);
void applyMessagesTTL(const MTPPeerHistoryTTL &ttl);
[[nodiscard]] Data::GroupCall *groupCall() const;
const PeerId id;
@@ -429,6 +437,10 @@ private:
base::flat_set<QChar> _nameFirstLetters;
crl::time _lastFullUpdate = 0;
TimeId _ttlMyPeriod = 0;
TimeId _ttlPeerPeriod = 0;
bool _ttlOneSide = false;
bool _hasPinnedMessages = false;
Settings _settings = { kSettingsUnknown };