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

Method writeStickerSet

Telegram/SourceFiles/storage/storage_account.cpp:1886–1929  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1884}
1885
1886void Account::writeStickerSet(
1887 QDataStream &stream,
1888 const Data::StickersSet &set) {
1889 using SetFlag = Data::StickersSetFlag;
1890 const auto writeInfo = [&](int count) {
1891 stream
1892 << quint64(set.id)
1893 << quint64(set.accessHash)
1894 << quint64(set.hash)
1895 << set.title
1896 << set.shortName
1897 << qint32(count)
1898 << qint32(set.flags)
1899 << qint32(set.installDate)
1900 << quint64(set.thumbnailDocumentId)
1901 << qint32(set.thumbnailType());
1902 Serialize::writeImageLocation(stream, set.thumbnailLocation());
1903 };
1904 if (set.flags & SetFlag::NotLoaded) {
1905 writeInfo(-set.count);
1906 return;
1907 } else if (set.stickers.isEmpty()) {
1908 return;
1909 }
1910
1911 writeInfo(set.stickers.size());
1912 for (const auto &sticker : set.stickers) {
1913 Serialize::Document::writeToStream(stream, sticker);
1914 }
1915 stream << qint32(set.dates.size());
1916 if (!set.dates.empty()) {
1917 Assert(set.dates.size() == set.stickers.size());
1918 for (const auto date : set.dates) {
1919 stream << qint32(date);
1920 }
1921 }
1922 stream << qint32(set.emoji.size());
1923 for (auto j = set.emoji.cbegin(), e = set.emoji.cend(); j != e; ++j) {
1924 stream << j->first->id() << qint32(j->second.size());
1925 for (const auto sticker : j->second) {
1926 stream << quint64(sticker->id);
1927 }
1928 }
1929}
1930
1931// In generic method _writeStickerSets() we look through all the sets and call a
1932// callback on each set to see, if we write it, skip it or abort the whole write.

Callers

nothing calls this directly

Calls 8

writeImageLocationFunction · 0.85
thumbnailTypeMethod · 0.80
isEmptyMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
cbeginMethod · 0.45
cendMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected