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/callinviteevent.cpp | |
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/callinviteevent.cpp')
-rw-r--r-- | lib/events/callinviteevent.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/events/callinviteevent.cpp b/lib/events/callinviteevent.cpp index 71c49d66..bca3f296 100644 --- a/lib/events/callinviteevent.cpp +++ b/lib/events/callinviteevent.cpp @@ -48,21 +48,17 @@ m.call.invite using namespace QMatrixClient; CallInviteEvent::CallInviteEvent(const QJsonObject& obj) - : RoomEvent(typeId(), obj) - , _lifetime(contentJson()["lifetime"].toInt()) - , _sdp(contentJson()["offer"].toObject()["sdp"].toString()) - , _callId(contentJson()["call_id"].toString()) - , _version(contentJson()["version"].toInt()) + : CallEventBase(typeId(), obj) { qCDebug(EVENTS) << "Call Invite event"; } CallInviteEvent::CallInviteEvent(const QString& callId, const int lifetime, const QString& sdp) - : RoomEvent(typeId(), NULL) -{ - _version = 0; - _callId = callId; - _lifetime = lifetime; - _sdp = sdp; -} + : CallEventBase(typeId(), matrixTypeId(), callId, lifetime, + { { QStringLiteral("lifetime"), lifetime } + , { QStringLiteral("offer"), QJsonObject { + { QStringLiteral("type"), QStringLiteral("offer") }, + { QStringLiteral("sdp"), sdp } } + }}) +{ } |