Commit 61c79b43 authored by Ghislain MARY's avatar Ghislain MARY

Use C++ instead of C where possible.

parent 94ce0fa2
......@@ -311,25 +311,24 @@ void CallPrivate::onCallSessionTransferStateChanged (const shared_ptr<CallSessio
void CallPrivate::onCheckForAcceptation (const shared_ptr<CallSession> &session) {
L_Q();
LinphoneCall *lcall = L_GET_C_BACK_PTR(q);
bctbx_list_t *copy = bctbx_list_copy(linphone_core_get_calls(q->getCore()->getCCore()));
for (bctbx_list_t *it = copy; it != nullptr; it = bctbx_list_next(it)) {
LinphoneCall *call = reinterpret_cast<LinphoneCall *>(bctbx_list_get_data(it));
if (call == lcall) continue;
switch (L_GET_CPP_PTR_FROM_C_OBJECT(call)->getState()) {
list<shared_ptr<Call>> calls = q->getCore()->getCalls();
shared_ptr<Call> currentCall = q->getSharedFromThis();
for (const auto &call : calls) {
if (call == currentCall)
continue;
switch (call->getState()) {
case CallSession::State::OutgoingInit:
case CallSession::State::OutgoingProgress:
case CallSession::State::OutgoingRinging:
case CallSession::State::OutgoingEarlyMedia:
lInfo() << "Already existing call [" << call << "] in state [" << linphone_call_state_to_string(linphone_call_get_state(call)) <<
"], canceling it before accepting new call [" << lcall << "]";
linphone_call_terminate(call);
lInfo() << "Already existing call [" << call << "] in state [" << Utils::toString(call->getState())
<< "], canceling it before accepting new call [" << currentCall << "]";
call->terminate();
break;
default:
break; /* Nothing to do */
break; // Nothing to do
}
}
bctbx_list_free(copy);
}
void CallPrivate::onDtmfReceived (const shared_ptr<CallSession> &session, char dtmf) {
......
......@@ -37,6 +37,7 @@ class MediaSessionPrivate;
class Call : public Object, public CoreAccessor {
friend class CallSessionPrivate;
friend class ChatMessage;
friend class ChatMessagePrivate;
friend class CorePrivate;
friend class MediaSessionPrivate;
......
......@@ -621,8 +621,8 @@ void ChatMessagePrivate::send () {
|| (call->getState() == CallSession::State::Pausing)
|| (call->getState() == CallSession::State::PausedByRemote)
) {
lInfo() << "send SIP msg through the existing call.";
op = linphone_call_get_op(lcall);
lInfo() << "Send SIP msg through the existing call";
op = call->getPrivate()->getOp();
string identity = linphone_core_find_best_identity(core->getCCore(), linphone_call_get_remote_address(lcall));
if (identity.empty()) {
LinphoneAddress *addr = linphone_address_new(q->getToAddress().asString().c_str());
......@@ -1019,7 +1019,7 @@ void ChatMessage::send () {
// Do not allow sending a message that is already being sent or that has been correctly delivered/displayed
if ((d->state == State::InProgress) || (d->state == State::Delivered) || (d->state == State::FileTransferDone) ||
(d->state == State::DeliveredToUser) || (d->state == State::Displayed)) {
lWarning() << "Cannot send chat message in state " << linphone_chat_message_state_to_string((LinphoneChatMessageState)d->state);
lWarning() << "Cannot send chat message in state " << Utils::toString(d->state);
return;
}
......
......@@ -469,13 +469,13 @@ void CallSessionPrivate::updatedByRemote () {
setState(CallSession::State::UpdatedByRemote,"Call updated by remote");
if (deferUpdate) {
if (state == CallSession::State::UpdatedByRemote)
lInfo() << "CallSession [" << q << "]: UpdatedByRemoted was signaled but defered. LinphoneCore expects the application to call linphone_core_accept_call_update() later.";
lInfo() << "CallSession [" << q << "]: UpdatedByRemoted was signaled but defered. LinphoneCore expects the application to call CallSession::acceptUpdate() later";
} else {
if (state == CallSession::State::UpdatedByRemote)
q->acceptUpdate(nullptr);
else {
/* Otherwise it means that the app responded by linphone_core_accept_call_update
* within the callback, so job is already done. */
// Otherwise it means that the app responded by CallSession::acceptUpdate() within the callback,
// so job is already done
}
}
}
......
......@@ -4254,7 +4254,7 @@ int MediaSession::startInvite (const Address *destination, const string &subject
void MediaSession::startRecording () {
L_D();
if (d->getParams()->getRecordFilePath().empty()) {
lError() << "MediaSession::startRecording(): no output file specified. Use linphone_call_params_set_record_file()";
lError() << "MediaSession::startRecording(): no output file specified. Use MediaSessionParams::setRecordFilePath()";
return;
}
if (d->audioStream && !d->getParams()->getPrivate()->getInConference())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment