mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Added support of media with spoiler to export to JSON.
This commit is contained in:
parent
bbf9d523a6
commit
42142d819a
3 changed files with 15 additions and 0 deletions
|
@ -920,6 +920,7 @@ StoriesSlice ParseStoriesSlice(
|
|||
auto content = photo
|
||||
? ParsePhoto(*photo, suggestedPath)
|
||||
: Photo();
|
||||
content.spoilered = data.is_spoiler();
|
||||
media.content = content;
|
||||
}, [&](const MTPDmessageMediaDocument &data) {
|
||||
const auto document = data.vdocument();
|
||||
|
@ -948,6 +949,7 @@ StoriesSlice ParseStoriesSlice(
|
|||
date,
|
||||
extension);
|
||||
content.thumb.file.suggestedPath = path + "_thumb.jpg";
|
||||
content.spoilered = data.is_spoiler();
|
||||
media.content = content;
|
||||
}, [&](const auto &data) {
|
||||
media.content = UnsupportedMedia();
|
||||
|
@ -1329,6 +1331,7 @@ Media ParseMedia(
|
|||
+ "photos/"
|
||||
+ PreparePhotoFileName(++context.photos, date))
|
||||
: Photo();
|
||||
content.spoilered = data.is_spoiler();
|
||||
if (const auto ttl = data.vttl_seconds()) {
|
||||
result.ttl = ttl->v;
|
||||
content.image.file = File();
|
||||
|
@ -1349,6 +1352,7 @@ Media ParseMedia(
|
|||
result.ttl = ttl->v;
|
||||
content.file = File();
|
||||
}
|
||||
content.spoilered = data.is_spoiler();
|
||||
result.content = content;
|
||||
}, [&](const MTPDmessageMediaWebPage &data) {
|
||||
// Ignore web pages.
|
||||
|
|
|
@ -119,6 +119,7 @@ uint8 ContactColorIndex(const ContactInfo &data);
|
|||
struct Photo {
|
||||
uint64 id = 0;
|
||||
TimeId date = 0;
|
||||
bool spoilered = false;
|
||||
|
||||
Image image;
|
||||
};
|
||||
|
@ -146,6 +147,7 @@ struct Document {
|
|||
bool isVoiceMessage = false;
|
||||
bool isVideoFile = false;
|
||||
bool isAudioFile = false;
|
||||
bool spoilered = false;
|
||||
};
|
||||
|
||||
struct SharedContact {
|
||||
|
|
|
@ -390,6 +390,11 @@ QByteArray SerializeMessage(
|
|||
push("height", image.height);
|
||||
}
|
||||
};
|
||||
const auto pushSpoiler = [&](const auto &media) {
|
||||
if (media.spoilered) {
|
||||
push("media_spoiler", true);
|
||||
}
|
||||
};
|
||||
|
||||
v::match(message.action.content, [&](const ActionChatCreate &data) {
|
||||
pushActor();
|
||||
|
@ -404,6 +409,7 @@ QByteArray SerializeMessage(
|
|||
pushActor();
|
||||
pushAction("edit_group_photo");
|
||||
pushPhoto(data.photo.image);
|
||||
pushSpoiler(data.photo);
|
||||
}, [&](const ActionChatDeletePhoto &data) {
|
||||
pushActor();
|
||||
pushAction("delete_group_photo");
|
||||
|
@ -587,6 +593,7 @@ QByteArray SerializeMessage(
|
|||
pushActor();
|
||||
pushAction("suggest_profile_photo");
|
||||
pushPhoto(data.photo.image);
|
||||
pushSpoiler(data.photo);
|
||||
}, [&](const ActionRequestedPeer &data) {
|
||||
pushActor();
|
||||
pushAction("requested_peer");
|
||||
|
@ -684,6 +691,7 @@ QByteArray SerializeMessage(
|
|||
|
||||
v::match(message.media.content, [&](const Photo &photo) {
|
||||
pushPhoto(photo.image);
|
||||
pushSpoiler(photo);
|
||||
pushTTL();
|
||||
}, [&](const Document &data) {
|
||||
pushPath(data.file, "file");
|
||||
|
@ -718,6 +726,7 @@ QByteArray SerializeMessage(
|
|||
push("width", data.width);
|
||||
push("height", data.height);
|
||||
}
|
||||
pushSpoiler(data);
|
||||
pushTTL();
|
||||
}, [&](const SharedContact &data) {
|
||||
pushBare("contact_information", SerializeObject(context, {
|
||||
|
|
Loading…
Add table
Reference in a new issue