diff options
Diffstat (limited to 'lib/events')
-rw-r--r-- | lib/events/event.h | 4 | ||||
-rw-r--r-- | lib/events/roomevent.cpp | 8 | ||||
-rw-r--r-- | lib/events/roomkeyevent.h | 2 |
3 files changed, 9 insertions, 5 deletions
diff --git a/lib/events/event.h b/lib/events/event.h index 5b9f20b7..b12dc9ad 100644 --- a/lib/events/event.h +++ b/lib/events/event.h @@ -59,12 +59,16 @@ static const auto TypeKey = QStringLiteral("type"); static const auto BodyKey = QStringLiteral("body"); static const auto ContentKey = QStringLiteral("content"); static const auto EventIdKey = QStringLiteral("event_id"); +static const auto SenderKey = QStringLiteral("sender"); +static const auto RoomIdKey = QStringLiteral("room_id"); static const auto UnsignedKey = QStringLiteral("unsigned"); static const auto StateKeyKey = QStringLiteral("state_key"); static const auto TypeKeyL = "type"_ls; static const auto BodyKeyL = "body"_ls; static const auto ContentKeyL = "content"_ls; static const auto EventIdKeyL = "event_id"_ls; +static const auto SenderKeyL = "sender"_ls; +static const auto RoomIdKeyL = "room_id"_ls; static const auto UnsignedKeyL = "unsigned"_ls; static const auto RedactedCauseKeyL = "redacted_because"_ls; static const auto PrevContentKeyL = "prev_content"_ls; diff --git a/lib/events/roomevent.cpp b/lib/events/roomevent.cpp index 0a4332ad..3d87ef18 100644 --- a/lib/events/roomevent.cpp +++ b/lib/events/roomevent.cpp @@ -51,12 +51,12 @@ QDateTime RoomEvent::originTimestamp() const QString RoomEvent::roomId() const { - return fullJson()["room_id"_ls].toString(); + return fullJson()[RoomIdKeyL].toString(); } QString RoomEvent::senderId() const { - return fullJson()["sender"_ls].toString(); + return fullJson()[SenderKeyL].toString(); } bool RoomEvent::isReplaced() const @@ -90,12 +90,12 @@ QString RoomEvent::stateKey() const void RoomEvent::setRoomId(const QString& roomId) { - editJson().insert(QStringLiteral("room_id"), roomId); + editJson().insert(RoomIdKey, roomId); } void RoomEvent::setSender(const QString& senderId) { - editJson().insert(QStringLiteral("sender"), senderId); + editJson().insert(SenderKey, senderId); } void RoomEvent::setTransactionId(const QString& txnId) diff --git a/lib/events/roomkeyevent.h b/lib/events/roomkeyevent.h index 679cbf7c..3a781474 100644 --- a/lib/events/roomkeyevent.h +++ b/lib/events/roomkeyevent.h @@ -11,7 +11,7 @@ public: RoomKeyEvent(const QJsonObject& obj); QString algorithm() const { return content<QString>("algorithm"_ls); } - QString roomId() const { return content<QString>("room_id"_ls); } + QString roomId() const { return content<QString>(RoomIdKeyL); } QString sessionId() const { return content<QString>("session_id"_ls); } QString sessionKey() const { return content<QString>("session_key"_ls); } }; |