| 1884 | } |
| 1885 | |
| 1886 | void 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. |
nothing calls this directly
no test coverage detected