diff options
author | Tobias Fella <fella@posteo.de> | 2022-02-27 19:15:16 +0100 |
---|---|---|
committer | Tobias Fella <fella@posteo.de> | 2022-05-16 20:37:01 +0200 |
commit | ff54bf2d0979dc6b9b3b77bba827ae7f3baa9f58 (patch) | |
tree | e1a6fd7cfe94f975a0c2ba343c539449a57f5d82 /lib/events | |
parent | 77b190d822c1e980b98b84999f0cfb609ed05a49 (diff) | |
download | libquotient-ff54bf2d0979dc6b9b3b77bba827ae7f3baa9f58.tar.gz libquotient-ff54bf2d0979dc6b9b3b77bba827ae7f3baa9f58.zip |
Add constructor for creating roomkeyevents
Diffstat (limited to 'lib/events')
-rw-r--r-- | lib/events/roomkeyevent.cpp | 13 | ||||
-rw-r--r-- | lib/events/roomkeyevent.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/events/roomkeyevent.cpp b/lib/events/roomkeyevent.cpp index 332be3f7..68962950 100644 --- a/lib/events/roomkeyevent.cpp +++ b/lib/events/roomkeyevent.cpp @@ -10,3 +10,16 @@ RoomKeyEvent::RoomKeyEvent(const QJsonObject &obj) : Event(typeId(), obj) if (roomId().isEmpty()) qCWarning(E2EE) << "Room key event has empty room id"; } + +RoomKeyEvent::RoomKeyEvent(const QString& algorithm, const QString& roomId, const QString& sessionId, const QString& sessionKey, const QString& senderId) + : Event(typeId(), { + {"content", QJsonObject{ + {"algorithm", algorithm}, + {"room_id", roomId}, + {"session_id", sessionId}, + {"session_key", sessionKey}, + }}, + {"sender", senderId}, + {"type", "m.room_key"}, + }) +{} diff --git a/lib/events/roomkeyevent.h b/lib/events/roomkeyevent.h index ed4c9440..2bda3086 100644 --- a/lib/events/roomkeyevent.h +++ b/lib/events/roomkeyevent.h @@ -12,6 +12,7 @@ public: DEFINE_EVENT_TYPEID("m.room_key", RoomKeyEvent) explicit RoomKeyEvent(const QJsonObject& obj); + explicit RoomKeyEvent(const QString& algorithm, const QString& roomId, const QString &sessionId, const QString& sessionKey, const QString& senderId); QString algorithm() const { return contentPart<QString>("algorithm"_ls); } QString roomId() const { return contentPart<QString>(RoomIdKeyL); } |