aboutsummaryrefslogtreecommitdiff
path: root/lib/events/roommessageevent.cpp
diff options
context:
space:
mode:
authorRoland Pallai <dap78@magex.hu>2021-01-28 14:58:11 +0100
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-01-28 16:51:23 +0100
commitb069c6bb377641840026aa37cb8acf7e2a76bfe5 (patch)
tree93cd96986303ba577677c9fc821cc5d448cadba0 /lib/events/roommessageevent.cpp
parent7c0742aa2b0b548bf99abe43c1a0410a11576893 (diff)
downloadlibquotient-b069c6bb377641840026aa37cb8acf7e2a76bfe5.tar.gz
libquotient-b069c6bb377641840026aa37cb8acf7e2a76bfe5.zip
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 (cherry picked from commit b850edadde2299b122a5cd17da85e943430e43b7)
Diffstat (limited to 'lib/events/roommessageevent.cpp')
-rw-r--r--lib/events/roommessageevent.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/events/roommessageevent.cpp b/lib/events/roommessageevent.cpp
index 616a034f..e2465e61 100644
--- a/lib/events/roommessageevent.cpp
+++ b/lib/events/roommessageevent.cpp
@@ -338,7 +338,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")) {