18 explicit CallEvent(
const QJsonObject& json);
20 static QJsonObject basicJson(
const QString& matrixType,
21 const QString& callId,
int version,
22 QJsonObject contentJson = {});
25template <
typename EventT>
26class EventTemplate<EventT, CallEvent> :
public CallEvent {
28 using CallEvent::CallEvent;
29 explicit EventTemplate(
const QString& callId,
30 const QJsonObject& contentJson = {})
31 : EventTemplate(basicJson(EventT::TypeId, callId, 0, contentJson))
35template <
typename EventT,
typename ContentT>
36class EventTemplate<EventT, CallEvent, ContentT>
37 :
public EventTemplate<EventT, CallEvent> {
39 using EventTemplate<EventT, CallEvent>::EventTemplate;
40 template <
typename... ContentParamTs>
41 explicit EventTemplate(
const QString& callId,
42 ContentParamTs&&... contentParams)
43 : EventTemplate<EventT, CallEvent>(
45 toJson(ContentT{ std::forward<ContentParamTs>(contentParams)... }))
50 :
public EventTemplate<CallInviteEvent, CallEvent> {
52 QUO_EVENT(CallInviteEvent,
"m.call.invite")
54 using EventTemplate::EventTemplate;
56 explicit CallInviteEvent(
const QString& callId,
int lifetime,
62 return contentPart<QJsonObject>(
"offer"_L1).value(
"sdp"_L1).toString();
67 QJsonArray, candidates,
"candidates")
70 :
public EventTemplate<CallAnswerEvent, CallEvent> {
72 QUO_EVENT(CallAnswerEvent,
"m.call.answer")
74 using EventTemplate::EventTemplate;
76 explicit CallAnswerEvent(
const QString& callId,
const QString& sdp);
80 return contentPart<QJsonObject>(
"answer"_L1).value(
"sdp"_L1).toString();
85 :
public EventTemplate<CallHangupEvent, CallEvent> {
87 QUO_EVENT(CallHangupEvent,
"m.call.hangup")
88 using EventTemplate::EventTemplate;
92Q_DECLARE_METATYPE(Quotient::CallEvent*)
93Q_DECLARE_METATYPE(
const Quotient::CallEvent*)
#define QUO_CONTENT_GETTER(PartType_, PartName_)
Define an inline method obtaining a content part.
#define QUO_EVENT(CppType_, MatrixType_)
Supply event metatype information in (specific) event types.
#define DEFINE_SIMPLE_EVENT(Name_, Base_, TypeId_, ValueType_, GetterName_, JsonKey_)
Define a new event class with a single key-value pair in the content.
#define QUO_BASE_EVENT(CppType_, BaseCppType_,...)
Supply event metatype information in base event types.