From 50cc85d3dea93735fe352831421eea2fcf9c24c5 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 4 Oct 2018 14:41:48 +0900 Subject: 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). --- lib/events/callhangupevent.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'lib/events/callhangupevent.cpp') diff --git a/lib/events/callhangupevent.cpp b/lib/events/callhangupevent.cpp index 27f41a5f..b1154806 100644 --- a/lib/events/callhangupevent.cpp +++ b/lib/events/callhangupevent.cpp @@ -44,16 +44,11 @@ using namespace QMatrixClient; CallHangupEvent::CallHangupEvent(const QJsonObject& obj) - : RoomEvent(typeId(), obj) - , _callId(contentJson()["call_id"].toString()) - , _version(contentJson()["version"].toInt()) + : CallEventBase(typeId(), obj) { qCDebug(EVENTS) << "Call Hangup event"; } CallHangupEvent::CallHangupEvent(const QString& callId) - : RoomEvent(typeId(), NULL) -{ - _version = 0; - _callId = callId; -} + : CallEventBase(typeId(), matrixTypeId(), callId, 0) +{ } -- cgit v1.2.3