tdesktop/Telegram/SourceFiles/api/api_common.h

70 lines
1.4 KiB
C
Raw Normal View History

/*
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 13:48:15 +00:00
#include "data/data_drafts.h"
class History;
2022-11-01 04:46:31 +00:00
namespace Data {
class Thread;
} // namespace Data
namespace Api {
inline constexpr auto kScheduledUntilOnlineTimestamp = TimeId(0x7FFFFFFE);
struct SendOptions {
2021-11-09 15:24:13 +00:00
PeerData *sendAs = nullptr;
TimeId scheduled = 0;
2024-02-23 17:23:15 +00:00
BusinessShortcutId shortcutId = 0;
bool silent = false;
bool handleSupportSwitch = false;
bool hideViaBot = false;
crl::time ttlSeconds = 0;
};
[[nodiscard]] SendOptions DefaultSendWhenOnlineOptions();
2019-08-20 13:21:10 +00:00
enum class SendType {
Normal,
Scheduled,
ScheduledToUser, // For "Send when online".
2019-08-20 13:21:10 +00:00
};
struct SendAction {
2021-11-09 15:24:13 +00:00
explicit SendAction(
2022-11-01 04:46:31 +00:00
not_null<Data::Thread*> thread,
SendOptions options = SendOptions());
not_null<History*> history;
SendOptions options;
FullReplyTo replyTo;
bool clearDraft = true;
bool generateLocal = true;
MsgId replaceMediaOf = 0;
[[nodiscard]] MTPInputReplyTo mtpReplyTo() const;
};
struct MessageToSend {
2021-11-09 15:24:13 +00:00
explicit MessageToSend(SendAction action) : action(action) {
}
SendAction action;
TextWithTags textWithTags;
2023-10-20 13:48:15 +00:00
Data::WebPageDraft webPage;
};
struct RemoteFileInfo {
MTPInputFile file;
std::optional<MTPInputFile> thumb;
std::vector<MTPInputDocument> attachedStickers;
};
} // namespace Api