2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Add support for 1 month self-destruct messages.

This commit is contained in:
John Preston
2021-07-30 14:43:48 +03:00
parent 256546071b
commit b2e829904f
12 changed files with 39 additions and 21 deletions

View File

@@ -2020,8 +2020,11 @@ void Session::scheduleNextTTLs() {
}
const auto nearest = _ttlMessages.begin()->first;
const auto now = base::unixtime::now();
const auto timeout = (std::max(now, nearest) - now) * crl::time(1000);
_ttlCheckTimer.callOnce(timeout);
// Set timer not more than for 24 hours.
const auto maxTimeout = TimeId(86400);
const auto timeout = std::min(std::max(now, nearest) - now, maxTimeout);
_ttlCheckTimer.callOnce(timeout * crl::time(1000));
}
void Session::unregisterMessageTTL(