aboutsummaryrefslogtreecommitdiff
path: root/lib/events/roomevent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/events/roomevent.cpp')
-rw-r--r--lib/events/roomevent.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/events/roomevent.cpp b/lib/events/roomevent.cpp
index e9d74cf6..80d121de 100644
--- a/lib/events/roomevent.cpp
+++ b/lib/events/roomevent.cpp
@@ -101,3 +101,25 @@ void RoomEvent::addId(const QString& newId)
qCDebug(EVENTS) << "Event txnId -> id:" << transactionId() << "->" << id();
Q_ASSERT(id() == newId);
}
+
+QJsonObject makeCallContentJson(const QString& callId, int version,
+ QJsonObject content)
+{
+ content.insert(QStringLiteral("call_id"), callId);
+ content.insert(QStringLiteral("version"), version);
+ return content;
+}
+
+CallEventBase::CallEventBase(Type type, event_mtype_t matrixType,
+ const QString& callId, int version,
+ const QJsonObject& contentJson)
+ : RoomEvent(type, matrixType,
+ makeCallContentJson(callId, version, contentJson))
+{ }
+
+CallEventBase::CallEventBase(Event::Type type, const QJsonObject& json)
+ : RoomEvent(type, json)
+{
+ if (callId().isEmpty())
+ qCWarning(EVENTS) << id() << "is a call event with an empty call id";
+}