api_self_destruct.h 927 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. #include "mtproto/sender.h"
  9. class ApiWrap;
  10. namespace Api {
  11. class SelfDestruct final {
  12. public:
  13. explicit SelfDestruct(not_null<ApiWrap*> api);
  14. void reload();
  15. void updateAccountTTL(int days);
  16. void updateDefaultHistoryTTL(TimeId period);
  17. [[nodiscard]] rpl::producer<int> daysAccountTTL() const;
  18. [[nodiscard]] rpl::producer<TimeId> periodDefaultHistoryTTL() const;
  19. [[nodiscard]] TimeId periodDefaultHistoryTTLCurrent() const;
  20. private:
  21. MTP::Sender _api;
  22. struct {
  23. mtpRequestId requestId = 0;
  24. rpl::variable<int> days = 0;
  25. } _accountTTL;
  26. struct {
  27. mtpRequestId requestId = 0;
  28. rpl::variable<TimeId> period = 0;
  29. } _defaultHistoryTTL;
  30. };
  31. } // namespace Api