2019-08-12 13:11:34 +01:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2023-10-20 17:48:15 +04:00
|
|
|
#include "data/data_drafts.h"
|
|
|
|
|
2019-09-13 09:06:02 +03:00
|
|
|
class History;
|
|
|
|
|
2022-11-01 08:46:31 +04:00
|
|
|
namespace Data {
|
|
|
|
class Thread;
|
|
|
|
} // namespace Data
|
|
|
|
|
2019-08-12 13:11:34 +01:00
|
|
|
namespace Api {
|
|
|
|
|
2023-04-22 22:26:09 +04:00
|
|
|
inline constexpr auto kScheduledUntilOnlineTimestamp = TimeId(0x7FFFFFFE);
|
|
|
|
|
2025-06-13 13:40:46 +04:00
|
|
|
struct SuggestOptions {
|
|
|
|
int stars = 0;
|
|
|
|
TimeId date = 0;
|
|
|
|
|
|
|
|
friend inline bool operator==(
|
|
|
|
const SuggestOptions &,
|
|
|
|
const SuggestOptions &) = default;
|
|
|
|
};
|
|
|
|
|
|
|
|
[[nodiscard]] MTPSuggestedPost SuggestToMTP(
|
|
|
|
const std::optional<SuggestOptions> &suggest);
|
|
|
|
|
2019-08-12 13:11:34 +01:00
|
|
|
struct SendOptions {
|
2024-06-18 18:55:07 +04:00
|
|
|
uint64 price = 0;
|
2021-11-09 19:24:13 +04:00
|
|
|
PeerData *sendAs = nullptr;
|
2019-08-12 13:11:34 +01:00
|
|
|
TimeId scheduled = 0;
|
2024-02-23 21:23:15 +04:00
|
|
|
BusinessShortcutId shortcutId = 0;
|
2024-05-06 17:49:49 +04:00
|
|
|
EffectId effectId = 0;
|
2025-02-18 19:50:55 +04:00
|
|
|
int starsApproved = 0;
|
2019-08-12 13:11:34 +01:00
|
|
|
bool silent = false;
|
|
|
|
bool handleSupportSwitch = false;
|
2024-05-29 21:27:07 +04:00
|
|
|
bool invertCaption = false;
|
2022-03-07 11:08:52 +04:00
|
|
|
bool hideViaBot = false;
|
2024-01-03 16:28:36 +03:00
|
|
|
crl::time ttlSeconds = 0;
|
2025-06-13 13:40:46 +04:00
|
|
|
std::optional<SuggestOptions> suggest;
|
2024-07-26 17:23:41 +02:00
|
|
|
|
|
|
|
friend inline bool operator==(
|
|
|
|
const SendOptions &,
|
|
|
|
const SendOptions &) = default;
|
2019-08-12 13:11:34 +01:00
|
|
|
};
|
2023-04-22 22:26:09 +04:00
|
|
|
[[nodiscard]] SendOptions DefaultSendWhenOnlineOptions();
|
2019-08-12 13:11:34 +01:00
|
|
|
|
2019-08-20 16:21:10 +03:00
|
|
|
enum class SendType {
|
|
|
|
Normal,
|
|
|
|
Scheduled,
|
2020-01-15 05:31:28 +03:00
|
|
|
ScheduledToUser, // For "Send when online".
|
2019-08-20 16:21:10 +03:00
|
|
|
};
|
|
|
|
|
2019-08-12 13:11:34 +01:00
|
|
|
struct SendAction {
|
2021-11-09 19:24:13 +04:00
|
|
|
explicit SendAction(
|
2022-11-01 08:46:31 +04:00
|
|
|
not_null<Data::Thread*> thread,
|
|
|
|
SendOptions options = SendOptions());
|
2019-08-12 13:11:34 +01:00
|
|
|
|
|
|
|
not_null<History*> history;
|
|
|
|
SendOptions options;
|
2023-05-25 13:32:13 +04:00
|
|
|
FullReplyTo replyTo;
|
2019-08-30 13:17:18 +03:00
|
|
|
bool clearDraft = true;
|
2019-08-12 13:11:34 +01:00
|
|
|
bool generateLocal = true;
|
2021-03-09 12:11:40 +03:00
|
|
|
MsgId replaceMediaOf = 0;
|
2023-05-25 13:32:13 +04:00
|
|
|
|
|
|
|
[[nodiscard]] MTPInputReplyTo mtpReplyTo() const;
|
2024-07-26 17:23:41 +02:00
|
|
|
|
|
|
|
friend inline bool operator==(
|
|
|
|
const SendAction &,
|
|
|
|
const SendAction &) = default;
|
2019-08-12 13:11:34 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct MessageToSend {
|
2021-11-09 19:24:13 +04:00
|
|
|
explicit MessageToSend(SendAction action) : action(action) {
|
2019-08-12 13:11:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
SendAction action;
|
|
|
|
TextWithTags textWithTags;
|
2023-10-20 17:48:15 +04:00
|
|
|
Data::WebPageDraft webPage;
|
2019-08-12 13:11:34 +01:00
|
|
|
};
|
|
|
|
|
2021-11-16 16:38:31 +04:00
|
|
|
struct RemoteFileInfo {
|
|
|
|
MTPInputFile file;
|
|
|
|
std::optional<MTPInputFile> thumb;
|
2025-01-29 09:24:01 +04:00
|
|
|
std::optional<MTPInputPhoto> videoCover;
|
2021-11-16 16:38:31 +04:00
|
|
|
std::vector<MTPInputDocument> attachedStickers;
|
|
|
|
};
|
|
|
|
|
2019-08-12 13:11:34 +01:00
|
|
|
} // namespace Api
|