18 explicit CallEvent(
const QJsonObject& json);
20 static QJsonObject basicJson(
const QString& matrixType,
21 const QString& callId,
int version,
22 QJsonObject contentJson = {});
25 template <
typename EventT>
26 class 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))
35 template <
typename EventT,
typename ContentT>
36 class 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;
92 Q_DECLARE_METATYPE(Quotient::CallEvent*)
93 Q_DECLARE_METATYPE(
const Quotient::CallEvent*)