From 5072340473b23b77ebb7d4e91f3727ff30950a9a Mon Sep 17 00:00:00 2001 From: Roland Pallai Date: Mon, 10 Feb 2020 16:01:08 +0100 Subject: Edit (transmit): fix json struct of `m.new_content` --- lib/events/roommessageevent.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/events/roommessageevent.cpp') diff --git a/lib/events/roommessageevent.cpp b/lib/events/roommessageevent.cpp index 078ae70a..9ee476e8 100644 --- a/lib/events/roommessageevent.cpp +++ b/lib/events/roommessageevent.cpp @@ -120,7 +120,7 @@ QJsonObject RoomMessageEvent::assembleContentJson(const QString& plainBody, if (textContent->relatesTo->type == RelatesTo::ReplacementTypeId()) { auto newContentJson = json.take("m.new_content"_ls).toObject(); newContentJson.insert(BodyKey, plainBody); - newContentJson.insert(TypeKey, jsonMsgType); + newContentJson.insert(MsgTypeKeyL, jsonMsgType); json.insert(QStringLiteral("m.new_content"), newContentJson); json[BodyKeyL] = "* " + plainBody; } -- cgit v1.2.3 From e5e9aa06ca9fb936e34d56c47cccb4111f2e80bd Mon Sep 17 00:00:00 2001 From: Roland Pallai Date: Mon, 10 Feb 2020 16:03:01 +0100 Subject: Edit (transmit): fix asterisk marking for dumb clients The prepared body got overwritten due to missing return statement. --- lib/events/roommessageevent.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/events/roommessageevent.cpp') diff --git a/lib/events/roommessageevent.cpp b/lib/events/roommessageevent.cpp index 9ee476e8..7745e6b9 100644 --- a/lib/events/roommessageevent.cpp +++ b/lib/events/roommessageevent.cpp @@ -122,7 +122,9 @@ QJsonObject RoomMessageEvent::assembleContentJson(const QString& plainBody, newContentJson.insert(BodyKey, plainBody); newContentJson.insert(MsgTypeKeyL, jsonMsgType); json.insert(QStringLiteral("m.new_content"), newContentJson); + json[MsgTypeKeyL] = jsonMsgType; json[BodyKeyL] = "* " + plainBody; + return json; } } } -- cgit v1.2.3 From 1c3373484b96fb8bc855f02caa87bad7567c5e17 Mon Sep 17 00:00:00 2001 From: Roland Pallai Date: Mon, 10 Feb 2020 16:24:00 +0100 Subject: TextContent: use MSC-1849 compatible `m.relates_to` field --- lib/events/roommessageevent.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/events/roommessageevent.cpp') diff --git a/lib/events/roommessageevent.cpp b/lib/events/roommessageevent.cpp index 7745e6b9..a6620618 100644 --- a/lib/events/roommessageevent.cpp +++ b/lib/events/roommessageevent.cpp @@ -338,7 +338,7 @@ void TextContent::fillJson(QJsonObject* json) const } if (relatesTo) { json->insert(QStringLiteral("m.relates_to"), - QJsonObject { { relatesTo->type, relatesTo->eventId } }); + QJsonObject { { "rel_type", relatesTo->type }, { "event_id", relatesTo->eventId } }); if (relatesTo->type == RelatesTo::ReplacementTypeId()) { QJsonObject newContentJson; if (mimeType.inherits("text/html")) { -- cgit v1.2.3 From 682f96d4af19226e553138b1a86ed9233c35edbd Mon Sep 17 00:00:00 2001 From: Roland Pallai Date: Tue, 17 Mar 2020 22:09:26 +0100 Subject: Use constant Co-Authored-By: Kitsune Ral --- lib/events/roommessageevent.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/events/roommessageevent.cpp') diff --git a/lib/events/roommessageevent.cpp b/lib/events/roommessageevent.cpp index a6620618..616a034f 100644 --- a/lib/events/roommessageevent.cpp +++ b/lib/events/roommessageevent.cpp @@ -338,7 +338,7 @@ void TextContent::fillJson(QJsonObject* json) const } if (relatesTo) { json->insert(QStringLiteral("m.relates_to"), - QJsonObject { { "rel_type", relatesTo->type }, { "event_id", 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