aboutsummaryrefslogtreecommitdiff
path: root/lib/events
diff options
context:
space:
mode:
Diffstat (limited to 'lib/events')
-rw-r--r--lib/events/encryptedevent.cpp7
-rw-r--r--lib/events/encryptedevent.h2
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/events/encryptedevent.cpp b/lib/events/encryptedevent.cpp
index 9d07a35f..3af3d6ff 100644
--- a/lib/events/encryptedevent.cpp
+++ b/lib/events/encryptedevent.cpp
@@ -61,3 +61,10 @@ RoomEventPtr EncryptedEvent::createDecrypted(const QString &decrypted) const
}
return loadEvent<RoomEvent>(eventObject);
}
+
+void EncryptedEvent::setRelation(const QJsonObject& relation)
+{
+ auto content = editJson()["content"_ls].toObject();
+ content["m.relates_to"] = relation;
+ editJson()["content"] = content;
+}
diff --git a/lib/events/encryptedevent.h b/lib/events/encryptedevent.h
index 72efffd4..ddd5e415 100644
--- a/lib/events/encryptedevent.h
+++ b/lib/events/encryptedevent.h
@@ -56,6 +56,8 @@ public:
QString deviceId() const { return contentPart<QString>(DeviceIdKeyL); }
QString sessionId() const { return contentPart<QString>(SessionIdKeyL); }
RoomEventPtr createDecrypted(const QString &decrypted) const;
+
+ void setRelation(const QJsonObject& relation);
};
REGISTER_EVENT_TYPE(EncryptedEvent)