| 31 | } // namespace |
| 32 | |
| 33 | void Document::writeToStream(QDataStream &stream, DocumentData *document) { |
| 34 | stream |
| 35 | << quint64(document->id) |
| 36 | << quint64(document->_access) |
| 37 | << qint32(document->date) |
| 38 | << document->_fileReference |
| 39 | << qint32(kVersionTag) |
| 40 | << qint32(kVersion) |
| 41 | << document->filename() |
| 42 | << document->mimeString() |
| 43 | << qint32(document->_dc) |
| 44 | // FileSize: Right now any file size fits 32 bit. |
| 45 | << qint32(uint32(document->size)) |
| 46 | << qint32(document->dimensions.width()) |
| 47 | << qint32(document->dimensions.height()) |
| 48 | << qint32(document->type); |
| 49 | if (const auto sticker = document->sticker()) { |
| 50 | stream << sticker->alt; |
| 51 | if (sticker->setType == Data::StickersType::Emoji) { |
| 52 | stream << qint32(StickerSetTypeEmoji); |
| 53 | } else if (sticker->setType == Data::StickersType::Masks) { |
| 54 | stream << qint32(StickerSetTypeMasks); |
| 55 | } else if (sticker->set.id) { |
| 56 | stream << qint32(StickerSetTypeID); |
| 57 | } else { |
| 58 | stream << qint32(StickerSetTypeEmpty); |
| 59 | } |
| 60 | } |
| 61 | stream << qint64(document->hasDuration() ? document->duration() : -1); |
| 62 | if (document->type == StickerDocument) { |
| 63 | const auto premium = document->isPremiumSticker() |
| 64 | || document->isPremiumEmoji(); |
| 65 | stream << qint32(premium ? 1 : 0); |
| 66 | stream << qint32(document->emojiUsesTextColor() ? 1 : 0); |
| 67 | } |
| 68 | writeImageLocation(stream, document->thumbnailLocation()); |
| 69 | stream << qint32(document->thumbnailByteSize()); |
| 70 | writeImageLocation(stream, document->videoThumbnailLocation()); |
| 71 | stream |
| 72 | << qint32(document->videoThumbnailByteSize()) |
| 73 | << qint32(document->inlineThumbnailIsPath() ? 1 : 0) |
| 74 | << document->inlineThumbnailBytes(); |
| 75 | } |
| 76 | |
| 77 | DocumentData *Document::readFromStreamHelper( |
| 78 | not_null<Main::Session*> session, |
nothing calls this directly
no test coverage detected