MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / readStickerSets

Method readStickerSets

Telegram/SourceFiles/storage/storage_account.cpp:2043–2313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2041}
2042
2043void Account::readStickerSets(
2044 FileKey &stickersKey,
2045 Data::StickersSetsOrder *outOrder,
2046 Data::StickersSetFlags readingFlags) {
2047 using SetFlag = Data::StickersSetFlag;
2048
2049 if (!stickersKey) {
2050 return;
2051 }
2052
2053 FileReadDescriptor stickers;
2054 if (!ReadEncryptedFile(stickers, stickersKey, _basePath, _localKey)) {
2055 ClearKey(stickersKey, _basePath);
2056 stickersKey = 0;
2057 writeMapDelayed();
2058 return;
2059 }
2060
2061 const auto failed = [&] {
2062 ClearKey(stickersKey, _basePath);
2063 stickersKey = 0;
2064 };
2065
2066 auto &sets = _owner->session().data().stickers().setsRef();
2067 if (outOrder) outOrder->clear();
2068
2069 quint32 versionTag = 0;
2070 qint32 version = 0;
2071 stickers.stream >> versionTag >> version;
2072 if (versionTag != kStickersVersionTag || version < 2) {
2073 // Old data, without sticker set thumbnails.
2074 return failed();
2075 }
2076 qint32 count = 0;
2077 stickers.stream >> count;
2078 if (!CheckStreamStatus(stickers.stream)
2079 || (count < 0)
2080 || (count > kMaxSavedStickerSetsCount)) {
2081 return failed();
2082 }
2083 for (auto i = 0; i != count; ++i) {
2084 quint64 setId = 0, setAccessHash = 0, setHash = 0;
2085 quint64 setThumbnailDocumentId = 0;
2086 QString setTitle, setShortName;
2087 qint32 scnt = 0;
2088 qint32 setInstallDate = 0;
2089 Data::StickersSetFlags setFlags = 0;
2090 qint32 setFlagsValue = 0;
2091 qint32 setThumbnailType = qint32(StickerType::Webp);
2092 ImageLocation setThumbnail;
2093
2094 stickers.stream
2095 >> setId
2096 >> setAccessHash
2097 >> setHash
2098 >> setTitle
2099 >> setShortName
2100 >> scnt

Callers

nothing calls this directly

Calls 15

ReadEncryptedFileFunction · 0.85
ClearKeyFunction · 0.85
readImageLocationFunction · 0.85
FavedSetTitleFunction · 0.85
emplaceMethod · 0.80
identifierMethod · 0.80
originalMethod · 0.80
frontMethod · 0.80
CheckStreamStatusFunction · 0.70
stickersMethod · 0.45
dataMethod · 0.45
sessionMethod · 0.45

Tested by

no test coverage detected