2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Download stickers for custom emoji in export.

This commit is contained in:
John Preston
2022-07-28 17:48:28 +03:00
parent d57e752ae9
commit d80cf5d149
6 changed files with 167 additions and 8 deletions

View File

@@ -220,7 +220,8 @@ QByteArray JoinList(
QByteArray FormatText(
const std::vector<Data::TextPart> &data,
const QString &internalLinksDomain) {
const QString &internalLinksDomain,
const QString &relativeLinkBase) {
return JoinList(QByteArray(), ranges::views::all(
data
) | ranges::views::transform([&](const Data::TextPart &part) {
@@ -274,9 +275,15 @@ QByteArray FormatText(
"onclick=\"ShowSpoiler(this)\">"
"<span aria-hidden=\"true\">"
+ text + "</span></span>";
case Type::CustomEmoji: return SerializeString("{custom_emoji}")
+ text // TODO custom-emoji
+ SerializeString("{/custom_emoji}");
case Type::CustomEmoji: return (part.additional.isEmpty()
? "<a href=\"\" onclick=\"return ShowNotLoadedEmoji();\">"
: (part.additional == Data::TextPart::UnavailableEmoji())
? "<a href=\"\" onclick=\"return ShowNotAvailableEmoji();\">"
: ("<a href = \""
+ (relativeLinkBase + part.additional).toUtf8()
+ "\">"))
+ text
+ "</a>";
}
Unexpected("Type in text entities serialization.");
}) | ranges::to_vector);
@@ -1257,7 +1264,7 @@ auto HtmlWriter::Wrap::pushMessage(
block.append(pushMedia(message, basePath, peers, internalLinksDomain));
const auto text = FormatText(message.text, internalLinksDomain);
const auto text = FormatText(message.text, internalLinksDomain, _base);
if (!text.isEmpty()) {
block.append(pushDiv("text"));
block.append(text);