Correctly detect Webm stickers.

This commit is contained in:
John Preston 2022-01-20 12:24:21 +03:00
parent 8b7d2c880e
commit 2f01efdd64
1 changed files with 13 additions and 7 deletions

View File

@ -321,21 +321,25 @@ void DocumentData::setattributes(
dimensions = QSize(data.vw().v, data.vh().v);
}, [&](const MTPDdocumentAttributeAnimated &data) {
if (type == FileDocument
|| type == StickerDocument
|| type == VideoDocument) {
|| type == VideoDocument
|| (sticker() && sticker()->type != StickerType::Webm)) {
type = AnimatedDocument;
_additional = nullptr;
}
}, [&](const MTPDdocumentAttributeSticker &data) {
if (type == FileDocument) {
const auto was = type;
if (type == FileDocument || type == VideoDocument) {
type = StickerDocument;
_additional = std::make_unique<StickerData>();
}
if (sticker()) {
sticker()->alt = qs(data.valt());
if (!sticker()->set.id
if (const auto info = sticker()) {
if (was == VideoDocument) {
info->type = StickerType::Webm;
}
info->alt = qs(data.valt());
if (!info->set.id
|| data.vstickerset().type() == mtpc_inputStickerSetID) {
sticker()->set = data.vstickerset().match([&](
info->set = data.vstickerset().match([&](
const MTPDinputStickerSetID &data) {
return StickerSetIdentifier{
.id = data.vid().v,
@ -355,6 +359,8 @@ void DocumentData::setattributes(
type = data.is_round_message()
? RoundVideoDocument
: VideoDocument;
} else if (const auto info = sticker()) {
info->type = StickerType::Webm;
}
_duration = data.vduration().v;
setMaybeSupportsStreaming(data.is_supports_streaming());