Skip to content

Commit

Permalink
CallAnswerEvent: drop lifetime
Browse files Browse the repository at this point in the history
See matrix-org/matrix-spec#1054.

# Conflicts:
#	lib/events/callanswerevent.cpp
#	lib/events/callanswerevent.h
  • Loading branch information
KitsuneRal committed May 11, 2022
1 parent 0bd655c commit 5520c90
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 22 deletions.
11 changes: 0 additions & 11 deletions lib/events/callanswerevent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ m.call.answer
"type": "answer"
},
"call_id": "12345",
"lifetime": 60000,
"version": 0
},
"event_id": "$WLGTSEFSEF:localhost",
Expand All @@ -33,16 +32,6 @@ CallAnswerEvent::CallAnswerEvent(const QJsonObject& obj)
qCDebug(EVENTS) << "Call Answer event";
}

CallAnswerEvent::CallAnswerEvent(const QString& callId, const int lifetime,
const QString& sdp)
: CallEventBase(
typeId(), matrixTypeId(), callId, 0,
{ { QStringLiteral("lifetime"), lifetime },
{ QStringLiteral("answer"),
QJsonObject { { QStringLiteral("type"), QStringLiteral("answer") },
{ QStringLiteral("sdp"), sdp } } } })
{}

CallAnswerEvent::CallAnswerEvent(const QString& callId, const QString& sdp)
: CallEventBase(
typeId(), matrixTypeId(), callId, 0,
Expand Down
6 changes: 0 additions & 6 deletions lib/events/callanswerevent.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,8 @@ class QUOTIENT_API CallAnswerEvent : public CallEventBase {

explicit CallAnswerEvent(const QJsonObject& obj);

explicit CallAnswerEvent(const QString& callId, const int lifetime,
const QString& sdp);
explicit CallAnswerEvent(const QString& callId, const QString& sdp);

int lifetime() const
{
return contentPart<int>("lifetime"_ls);
} // FIXME: Omittable<>?
QString sdp() const
{
return contentPart<QJsonObject>("answer"_ls).value("sdp"_ls).toString();
Expand Down
7 changes: 4 additions & 3 deletions lib/room.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2232,11 +2232,12 @@ void Room::sendCallCandidates(const QString& callId,
d->sendEvent<CallCandidatesEvent>(callId, candidates);
}

void Room::answerCall(const QString& callId, const int lifetime,
void Room::answerCall(const QString& callId, [[maybe_unused]] int lifetime,
const QString& sdp)
{
Q_ASSERT(supportsCalls());
d->sendEvent<CallAnswerEvent>(callId, lifetime, sdp);
qCWarning(MAIN) << "To client developer: drop lifetime parameter from "
"Room::answerCall(), it is no more accepted";
answerCall(callId, sdp);
}

void Room::answerCall(const QString& callId, const QString& sdp)
Expand Down
5 changes: 3 additions & 2 deletions lib/room.h
Original file line number Diff line number Diff line change
Expand Up @@ -870,8 +870,9 @@ public Q_SLOTS:
void inviteCall(const QString& callId, const int lifetime,
const QString& sdp);
void sendCallCandidates(const QString& callId, const QJsonArray& candidates);
void answerCall(const QString& callId, const int lifetime,
const QString& sdp);
[[deprecated("Lifetime argument is no more in use here; "
"use 2-arg Room::answerCall() instead")]]
void answerCall(const QString& callId, int lifetime, const QString& sdp);
void answerCall(const QString& callId, const QString& sdp);
void hangupCall(const QString& callId);

Expand Down

0 comments on commit 5520c90

Please sign in to comment.