api_common.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 "data/data_drafts.h"
  9. class History;
  10. namespace Data {
  11. class Thread;
  12. } // namespace Data
  13. namespace Api {
  14. inline constexpr auto kScheduledUntilOnlineTimestamp = TimeId(0x7FFFFFFE);
  15. struct SendOptions {
  16. uint64 price = 0;
  17. PeerData *sendAs = nullptr;
  18. TimeId scheduled = 0;
  19. BusinessShortcutId shortcutId = 0;
  20. EffectId effectId = 0;
  21. int starsApproved = 0;
  22. bool silent = false;
  23. bool handleSupportSwitch = false;
  24. bool invertCaption = false;
  25. bool hideViaBot = false;
  26. crl::time ttlSeconds = 0;
  27. friend inline bool operator==(
  28. const SendOptions &,
  29. const SendOptions &) = default;
  30. };
  31. [[nodiscard]] SendOptions DefaultSendWhenOnlineOptions();
  32. enum class SendType {
  33. Normal,
  34. Scheduled,
  35. ScheduledToUser, // For "Send when online".
  36. };
  37. struct SendAction {
  38. explicit SendAction(
  39. not_null<Data::Thread*> thread,
  40. SendOptions options = SendOptions());
  41. not_null<History*> history;
  42. SendOptions options;
  43. FullReplyTo replyTo;
  44. bool clearDraft = true;
  45. bool generateLocal = true;
  46. MsgId replaceMediaOf = 0;
  47. [[nodiscard]] MTPInputReplyTo mtpReplyTo() const;
  48. friend inline bool operator==(
  49. const SendAction &,
  50. const SendAction &) = default;
  51. };
  52. struct MessageToSend {
  53. explicit MessageToSend(SendAction action) : action(action) {
  54. }
  55. SendAction action;
  56. TextWithTags textWithTags;
  57. Data::WebPageDraft webPage;
  58. };
  59. struct RemoteFileInfo {
  60. MTPInputFile file;
  61. std::optional<MTPInputFile> thumb;
  62. std::optional<MTPInputPhoto> videoCover;
  63. std::vector<MTPInputDocument> attachedStickers;
  64. };
  65. } // namespace Api