2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 22:55:11 +00:00

Don't store MTPInputStickerSet in data.

This commit is contained in:
John Preston
2021-07-08 19:42:57 +03:00
parent 9dfb43d525
commit 75090dedaa
23 changed files with 152 additions and 119 deletions

View File

@@ -34,19 +34,14 @@ void Document::writeToStream(QDataStream &stream, DocumentData *document) {
stream << document->filename() << document->mimeString() << qint32(document->_dc) << qint32(document->size);
stream << qint32(document->dimensions.width()) << qint32(document->dimensions.height());
stream << qint32(document->type);
if (auto sticker = document->sticker()) {
if (const auto sticker = document->sticker()) {
stream << document->sticker()->alt;
switch (document->sticker()->set.type()) {
case mtpc_inputStickerSetID: {
if (document->sticker()->set.id) {
stream << qint32(StickerSetTypeID);
} break;
case mtpc_inputStickerSetShortName: {
} else if (!document->sticker()->set.shortName.isEmpty()) {
stream << qint32(StickerSetTypeShortName);
} break;
case mtpc_inputStickerSetEmpty:
default: {
} else {
stream << qint32(StickerSetTypeEmpty);
} break;
}
} else {
stream << qint32(document->getDuration());

View File

@@ -1750,7 +1750,7 @@ void Account::readStickerSets(
ImageWithLocation{ .location = setThumbnail });
}
const auto set = it->second.get();
auto inputSet = MTP_inputStickerSetID(MTP_long(set->id), MTP_long(set->access));
const auto inputSet = set->identifier();
const auto fillStickers = set->stickers.isEmpty();
if (scnt < 0) { // disabled not loaded set
@@ -1783,7 +1783,7 @@ void Account::readStickerSets(
if (fillStickers) {
set->stickers.push_back(document);
if (!(set->flags & MTPDstickerSet_ClientFlag::f_special)) {
if (document->sticker()->set.type() != mtpc_inputStickerSetID) {
if (!document->sticker()->set.id) {
document->sticker()->set = inputSet;
}
}