From b850edadde2299b122a5cd17da85e943430e43b7 Mon Sep 17 00:00:00 2001 From: Roland Pallai Date: Thu, 28 Jan 2021 14:58:11 +0100 Subject: Fix rich replies json format (transmit) With this patch it looks like: "m.relates_to": { "m.in_reply_to": { "event_id": "$another:event.com" } } instead of: "m.relates_to": { "event_id": "$another:event.com", "rel_type": "m.in_reply_to" }, So it fits the specification by now. https://matrix.org/docs/spec/client_server/r0.6.1#rich-replies --- lib/events/roommessageevent.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/events/roommessageevent.cpp') diff --git a/lib/events/roommessageevent.cpp b/lib/events/roommessageevent.cpp index 14824277..3fccb380 100644 --- a/lib/events/roommessageevent.cpp +++ b/lib/events/roommessageevent.cpp @@ -325,7 +325,10 @@ void TextContent::fillJson(QJsonObject* json) const } if (relatesTo) { json->insert(QStringLiteral("m.relates_to"), - QJsonObject { { "rel_type", relatesTo->type }, { EventIdKey, relatesTo->eventId } }); + relatesTo->type == RelatesTo::ReplyTypeId() ? + QJsonObject { { relatesTo->type, QJsonObject{ { EventIdKey, relatesTo->eventId } } } } : + QJsonObject { { "rel_type", relatesTo->type }, { EventIdKey, relatesTo->eventId } } + ); if (relatesTo->type == RelatesTo::ReplacementTypeId()) { QJsonObject newContentJson; if (mimeType.inherits("text/html")) { -- cgit v1.2.3