aboutsummaryrefslogtreecommitdiff
path: root/lib/events/roomevent.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-06-13 17:30:13 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-07-27 14:35:28 +0900
commitbaee19241daffd50e0b32559cda64d5b6ede09a2 (patch)
tree2aa9e41f64d0dddeff3b5fdf8cca1f433cf0a5d7 /lib/events/roomevent.cpp
parent284b751ee424985341812a32721227112160a905 (diff)
downloadlibquotient-baee19241daffd50e0b32559cda64d5b6ede09a2.tar.gz
libquotient-baee19241daffd50e0b32559cda64d5b6ede09a2.zip
Initial support for local echo
The Room class has gained a new internal container, unsyncedEvents, storing locally-created Event objects that are about to be sent or are sent but not yet synced. These objects are supposed to be complete enough to be displayed by clients in a usual way; access to them is provided by Room::pendingEvents() accessor. A set of pendingEvent* signals has been added to notify clients about changes in this container (adding, removal, status update). Yet unsent events don't have Event::id() at all; sent but yet unsynced ones have Event::id() but have almost nothing else except the content for now (probably a sender and an (at least local) timestamp are worth adding). Also: SendEventJob is removed in favor of GTAD-generated SendMessageJob.
Diffstat (limited to 'lib/events/roomevent.cpp')
-rw-r--r--lib/events/roomevent.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/events/roomevent.cpp b/lib/events/roomevent.cpp
index 3d09af8a..75850772 100644
--- a/lib/events/roomevent.cpp
+++ b/lib/events/roomevent.cpp
@@ -75,6 +75,11 @@ QString RoomEvent::redactionReason() const
return isRedacted() ? _redactedBecause->reason() : QString{};
}
+QString RoomEvent::stateKey() const
+{
+ return fullJson()["state_key"_ls].toString();
+}
+
void RoomEvent::addId(const QString& newId)
{
Q_ASSERT(id().isEmpty()); Q_ASSERT(!newId.isEmpty());