diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-10-04 14:41:48 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-10-04 14:49:04 +0900 |
commit | 50cc85d3dea93735fe352831421eea2fcf9c24c5 (patch) | |
tree | 7aa91a3da084058a8fdd87ca9f72ed313eac79ec /lib/events/roomevent.h | |
parent | 5f2b4caa9b9cd63e1652d6550ceebecdb52df424 (diff) | |
download | libquotient-50cc85d3dea93735fe352831421eea2fcf9c24c5.tar.gz libquotient-50cc85d3dea93735fe352831421eea2fcf9c24c5.zip |
Modernise and fix code dealing with call events
Call events no more store deserialised values; instead they deserialise
values on the fly, same as all other events. They are no more treated as
state events (The Spec doesn't define them as state events in the first
place). A common base class, CallEventBase, is introduced that defines
data pieces common to all call events (call id and version).
Diffstat (limited to 'lib/events/roomevent.h')
-rw-r--r-- | lib/events/roomevent.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/events/roomevent.h b/lib/events/roomevent.h index f057753f..ce96174e 100644 --- a/lib/events/roomevent.h +++ b/lib/events/roomevent.h @@ -87,6 +87,20 @@ namespace QMatrixClient using RoomEventPtr = event_ptr_tt<RoomEvent>; using RoomEvents = EventsArray<RoomEvent>; using RoomEventsRange = Range<RoomEvents>; + + class CallEventBase: public RoomEvent + { + public: + CallEventBase(Type type, event_mtype_t matrixType, + const QString& callId, int version, + const QJsonObject& contentJson = {}); + CallEventBase(Type type, const QJsonObject& json); + ~CallEventBase() override = default; + bool isCallEvent() const override { return true; } + + QString callId() const { return content<QString>("call_id"_ls); } + int version() const { return content<int>("version"_ls); } + }; } // namespace QMatrixClient Q_DECLARE_METATYPE(QMatrixClient::RoomEvent*) Q_DECLARE_METATYPE(const QMatrixClient::RoomEvent*) |