2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 22:46:10 +00:00

Allow sending just webpage preview.

This commit is contained in:
John Preston
2023-10-26 09:26:45 +04:00
parent 041ec1157f
commit c035ec6917
9 changed files with 81 additions and 49 deletions

View File

@@ -73,10 +73,12 @@ MTPInputReplyTo ReplyToForMTP(
return MTPInputReplyTo();
}
MTPInputMedia WebPageForMTP(const Data::WebPageDraft &draft) {
MTPInputMedia WebPageForMTP(
const Data::WebPageDraft &draft,
bool required) {
using Flag = MTPDinputMediaWebPage::Flag;
return MTP_inputMediaWebPage(
MTP_flags(Flag::f_optional
MTP_flags((required ? Flag() : Flag::f_optional)
| (draft.forceLargeMedia ? Flag::f_force_large_media : Flag())
| (draft.forceSmallMedia ? Flag::f_force_small_media : Flag())),
MTP_string(draft.url));

View File

@@ -30,7 +30,9 @@ struct WebPageDraft;
[[nodiscard]] MTPInputReplyTo ReplyToForMTP(
not_null<History*> history,
FullReplyTo replyTo);
[[nodiscard]] MTPInputMedia WebPageForMTP(const Data::WebPageDraft &draft);
[[nodiscard]] MTPInputMedia WebPageForMTP(
const Data::WebPageDraft &draft,
bool required = false);
class Histories final {
public: