aboutsummaryrefslogtreecommitdiff
path: root/lib/events/roomevent.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-07-13 22:43:47 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-07-31 11:16:22 +0900
commitb87097866f38b90f36fb216b7516a135227930a1 (patch)
tree338fcef74f834c70e849e5e605660af4a6a4bcd6 /lib/events/roomevent.cpp
parent26bc529ec86dce5478ab37222a27902af7f0dd5a (diff)
downloadlibquotient-b87097866f38b90f36fb216b7516a135227930a1.tar.gz
libquotient-b87097866f38b90f36fb216b7516a135227930a1.zip
Initial support for edited messages (receive only)
Diffstat (limited to 'lib/events/roomevent.cpp')
-rw-r--r--lib/events/roomevent.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/events/roomevent.cpp b/lib/events/roomevent.cpp
index f1e563ff..0143826a 100644
--- a/lib/events/roomevent.cpp
+++ b/lib/events/roomevent.cpp
@@ -66,6 +66,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{};