diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-08-02 09:32:49 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-08-02 09:32:49 +0900 |
commit | 35cfef7a4253d49a37e5ce21c337fbb3d2633c42 (patch) | |
tree | dfcc77c4e404b6b8f07a4c9ee6283e70e4723883 /lib/events/roomevent.cpp | |
parent | 5b37e15d6a57d3b689c88f5cfce7afea9787a034 (diff) | |
parent | 5b236dfe895c7766002559570aa29c9033009228 (diff) | |
download | libquotient-35cfef7a4253d49a37e5ce21c337fbb3d2633c42.tar.gz libquotient-35cfef7a4253d49a37e5ce21c337fbb3d2633c42.zip |
Merge branch 'master' into use-clang-format
Diffstat (limited to 'lib/events/roomevent.cpp')
-rw-r--r-- | lib/events/roomevent.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/events/roomevent.cpp b/lib/events/roomevent.cpp index 513a99d0..fb715473 100644 --- a/lib/events/roomevent.cpp +++ b/lib/events/roomevent.cpp @@ -62,6 +62,20 @@ QString RoomEvent::senderId() const return fullJson()["sender"_ls].toString(); } +bool RoomEvent::isReplaced() const +{ + return unsignedJson()["m.relations"_ls].toObject().contains("m.replace"); +} + +QString RoomEvent::replacedBy() const +{ + // clang-format off + return unsignedJson()["m.relations"_ls].toObject() + .value("m.replace").toObject() + .value(EventIdKeyL).toString(); + // clang-format on +} + QString RoomEvent::redactionReason() const { return isRedacted() ? _redactedBecause->reason() : QString {}; |