Processing of mediaThumbnail and mediaDescription for Nextcloud feeds (#831)

* Processing of mediaThumbnail as first enclosure and mediaDescription as replacement content in Nextcloud feeds.

* Formatting

Next time, make sure to use ClangFormat to format the file.

https://github.com/martinrotter/rssguard/blob/master/.clang-format

Co-authored-by: martinrotter <martinrotter@users.noreply.github.com>
This commit is contained in:
ExSign 2022-11-01 13:04:55 +01:00 committed by GitHub
parent 9fff2feac5
commit 46ce39266f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -587,6 +587,21 @@ QList<Message> OwnCloudGetMessagesResponse::messages() const {
msg.m_customHash = message_map[QSL("guidHash")].toString();
msg.m_rawContents = QJsonDocument(message_map).toJson(QJsonDocument::JsonFormat::Compact);
// In case body is empty, check for content in mediaDescription if item is available.
if (msg.m_contents.isEmpty() && !message_map[QSL("mediaDescription")].isUndefined()) {
msg.m_contents = message_map[QSL("mediaDescription")].toString();
}
// Check for mediaThumbnail and append as first enclosure to be viewed in internal viewer.
if (!message_map[QSL("mediaThumbnail")].isUndefined()) {
Enclosure enclosure;
enclosure.m_mimeType = QSL("image/jpg");
enclosure.m_url = message_map[QSL("mediaThumbnail")].toString();
msg.m_enclosures.append(enclosure);
}
QString enclosure_link = message_map[QSL("enclosureLink")].toString();
if (!enclosure_link.isEmpty()) {