aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/events/event.h3
-rw-r--r--lib/room.cpp9
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/events/event.h b/lib/events/event.h
index e9963eae..52e3d025 100644
--- a/lib/events/event.h
+++ b/lib/events/event.h
@@ -210,7 +210,10 @@ public:
Type type() const { return _type; }
QString matrixType() const;
+ [[deprecated("Use fullJson() and stringify it with QJsonDocument::toJson() "
+ "or by other means")]]
QByteArray originalJson() const;
+ [[deprecated("Use fullJson() instead")]] //
QJsonObject originalJsonObject() const { return fullJson(); }
const QJsonObject& fullJson() const { return _json; }
diff --git a/lib/room.cpp b/lib/room.cpp
index 3090cb7b..aa00025c 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -1589,7 +1589,8 @@ void Room::Private::removeMemberFromMap(User* u)
inline auto makeErrorStr(const Event& e, QByteArray msg)
{
- return msg.append("; event dump follows:\n").append(e.originalJson());
+ return msg.append("; event dump follows:\n")
+ .append(QJsonDocument(e.fullJson()).toJson());
}
Room::Timeline::size_type
@@ -2363,7 +2364,7 @@ void Room::Private::dropDuplicateEvents(RoomEvents& events) const
RoomEventPtr makeRedacted(const RoomEvent& target,
const RedactionEvent& redaction)
{
- auto originalJson = target.originalJsonObject();
+ auto originalJson = target.fullJson();
// clang-format off
static const QStringList keepKeys {
EventIdKey, TypeKey, RoomIdKey, SenderKey, StateKeyKey,
@@ -2409,7 +2410,7 @@ RoomEventPtr makeRedacted(const RoomEvent& target,
originalJson.insert(ContentKey, content);
}
auto unsignedData = originalJson.take(UnsignedKeyL).toObject();
- unsignedData[RedactedCauseKeyL] = redaction.originalJsonObject();
+ unsignedData[RedactedCauseKeyL] = redaction.fullJson();
originalJson.insert(QStringLiteral("unsigned"), unsignedData);
return loadEvent<RoomEvent>(originalJson);
@@ -2479,7 +2480,7 @@ RoomEventPtr makeReplaced(const RoomEvent& target,
if (!targetReply.empty()) {
newContent["m.relates_to"] = targetReply;
}
- auto originalJson = target.originalJsonObject();
+ auto originalJson = target.fullJson();
originalJson[ContentKeyL] = newContent;
auto unsignedData = originalJson.take(UnsignedKeyL).toObject();