Commit 8816f399 authored by Ghislain MARY's avatar Ghislain MARY

Remove CallListener and use CallSessionListener instead.

parent a02165ab
......@@ -28,7 +28,6 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
c-wrapper/c-wrapper.h
c-wrapper/internal/c-sal.h
c-wrapper/internal/c-tools.h
call/call-listener.h
call/call-p.h
call/call.h
call/local-conference-call-p.h
......
/*
* call-listener.h
* Copyright (C) 2010-2017 Belledonne Communications SARL
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _CALL_LISTENER_H_
#define _CALL_LISTENER_H_
#include "linphone/types.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class CallListener {
public:
virtual ~CallListener () = default;
virtual void onAckBeingSent (LinphoneHeaders *headers) = 0;
virtual void onAckReceived (LinphoneHeaders *headers) = 0;
virtual void onBackgroundTaskToBeStarted () = 0;
virtual void onBackgroundTaskToBeStopped () = 0;
virtual bool onCallAccepted () = 0;
virtual void onCallSetReleased () = 0;
virtual void onCallSetTerminated () = 0;
virtual void onCallStateChanged (LinphoneCallState state, const std::string &message) = 0;
virtual void onCheckForAcceptation () = 0;
virtual void onDtmfReceived (char dtmf) = 0;
virtual void onIncomingCallStarted () = 0;
virtual void onIncomingCallNotified () = 0;
virtual void onIncomingCallTimeoutCheck (int elapsed, bool oneSecondElapsed) = 0;
virtual void onInfoReceived (const LinphoneInfoMessage *im) = 0;
virtual void onNoMediaTimeoutCheck (bool oneSecondElapsed) = 0;
virtual void onEncryptionChanged (bool activated, const std::string &authToken) = 0;
virtual void onStatsUpdated (const LinphoneCallStats *stats) = 0;
virtual void onResetCurrentCall () = 0;
virtual void onSetCurrentCall () = 0;
virtual void onFirstVideoFrameDecoded () = 0;
virtual void onResetFirstVideoFrameDecoded () = 0;
virtual void onPlayErrorTone (LinphoneReason reason) = 0;
virtual void onRingbackToneRequested (bool requested) = 0;
virtual void onStartRinging () = 0;
virtual void onStopRinging () = 0;
virtual void onStopRingingIfInCall () = 0;
virtual void onStopRingingIfNeeded () = 0;
virtual bool isPlayingRingbackTone () = 0;
};
LINPHONE_END_NAMESPACE
#endif // ifndef _CALL_LISTENER_H_
......@@ -20,9 +20,9 @@
#ifndef _CALL_P_H_
#define _CALL_P_H_
#include "call-listener.h"
#include "call.h"
#include "conference/conference.h"
#include "conference/session/call-session-listener.h"
#include "object/object-p.h"
// TODO: Remove me later.
......@@ -32,7 +32,9 @@
LINPHONE_BEGIN_NAMESPACE
class CallPrivate : public ObjectPrivate, public CallListener {
class CallSession;
class CallPrivate : public ObjectPrivate, public CallSessionListener {
public:
CallPrivate () = default;
virtual ~CallPrivate () = default;
......@@ -57,38 +59,39 @@ public:
void createPlayer () const;
private:
void resetFirstVideoFrameDecoded ();
void startRemoteRing ();
void terminateBecauseOfLostMedia ();
/* CallListener */
void onAckBeingSent (LinphoneHeaders *headers) override;
void onAckReceived (LinphoneHeaders *headers) override;
void onBackgroundTaskToBeStarted () override;
void onBackgroundTaskToBeStopped () override;
bool onCallAccepted () override;
void onCallSetReleased () override;
void onCallSetTerminated () override;
void onCallStateChanged (LinphoneCallState state, const std::string &message) override;
void onCheckForAcceptation () override;
void onDtmfReceived (char dtmf) override;
void onIncomingCallNotified () override;
void onIncomingCallStarted () override;
void onIncomingCallTimeoutCheck (int elapsed, bool oneSecondElapsed) override;
void onInfoReceived (const LinphoneInfoMessage *im) override;
void onNoMediaTimeoutCheck (bool oneSecondElapsed) override;
void onEncryptionChanged (bool activated, const std::string &authToken) override;
void onStatsUpdated (const LinphoneCallStats *stats) override;
void onResetCurrentCall () override;
void onSetCurrentCall () override;
void onFirstVideoFrameDecoded () override;
void onResetFirstVideoFrameDecoded () override;
void onPlayErrorTone (LinphoneReason reason) override;
void onRingbackToneRequested (bool requested) override;
void onStartRinging () override;
void onStopRinging () override;
void onStopRingingIfInCall () override;
void onStopRingingIfNeeded () override;
bool isPlayingRingbackTone () override;
/* CallSessionListener */
void onAckBeingSent (const std::shared_ptr<const CallSession> &session, LinphoneHeaders *headers) override;
void onAckReceived (const std::shared_ptr<const CallSession> &session, LinphoneHeaders *headers) override;
void onBackgroundTaskToBeStarted (const std::shared_ptr<const CallSession> &session) override;
void onBackgroundTaskToBeStopped (const std::shared_ptr<const CallSession> &session) override;
bool onCallSessionAccepted (const std::shared_ptr<const CallSession> &session) override;
void onCallSessionSetReleased (const std::shared_ptr<const CallSession> &session) override;
void onCallSessionSetTerminated (const std::shared_ptr<const CallSession> &session) override;
void onCallSessionStateChanged (const std::shared_ptr<const CallSession> &session, LinphoneCallState state, const std::string &message) override;
void onCheckForAcceptation (const std::shared_ptr<const CallSession> &session) override;
void onDtmfReceived (const std::shared_ptr<const CallSession> &session, char dtmf) override;
void onIncomingCallSessionNotified (const std::shared_ptr<const CallSession> &session) override;
void onIncomingCallSessionStarted (const std::shared_ptr<const CallSession> &session) override;
void onIncomingCallSessionTimeoutCheck (const std::shared_ptr<const CallSession> &session, int elapsed, bool oneSecondElapsed) override;
void onInfoReceived (const std::shared_ptr<const CallSession> &session, const LinphoneInfoMessage *im) override;
void onNoMediaTimeoutCheck (const std::shared_ptr<const CallSession> &session, bool oneSecondElapsed) override;
void onEncryptionChanged (const std::shared_ptr<const CallSession> &session, bool activated, const std::string &authToken) override;
void onStatsUpdated (const std::shared_ptr<const CallSession> &session, const LinphoneCallStats *stats) override;
void onResetCurrentSession (const std::shared_ptr<const CallSession> &session) override;
void onSetCurrentSession (const std::shared_ptr<const CallSession> &session) override;
void onFirstVideoFrameDecoded (const std::shared_ptr<const CallSession> &session) override;
void onResetFirstVideoFrameDecoded (const std::shared_ptr<const CallSession> &session) override;
void onPlayErrorTone (const std::shared_ptr<const CallSession> &session, LinphoneReason reason) override;
void onRingbackToneRequested (const std::shared_ptr<const CallSession> &session, bool requested) override;
void onStartRinging (const std::shared_ptr<const CallSession> &session) override;
void onStopRinging (const std::shared_ptr<const CallSession> &session) override;
void onStopRingingIfInCall (const std::shared_ptr<const CallSession> &session) override;
void onStopRingingIfNeeded (const std::shared_ptr<const CallSession> &session) override;
bool isPlayingRingbackTone (const std::shared_ptr<const CallSession> &session) override;
mutable LinphonePlayer *player = nullptr;
......
......@@ -89,6 +89,13 @@ void CallPrivate::createPlayer () const {
// -----------------------------------------------------------------------------
void CallPrivate::resetFirstVideoFrameDecoded () {
#ifdef VIDEO_ENABLED
if (nextVideoFrameDecoded._func)
static_cast<MediaSession *>(getActiveSession().get())->resetFirstVideoFrameDecoded();
#endif // ifdef VIDEO_ENABLED
}
void CallPrivate::startRemoteRing () {
L_Q();
LinphoneCore *lc = q->getCore()->getCCore();
......@@ -118,28 +125,28 @@ void CallPrivate::terminateBecauseOfLostMedia () {
// -----------------------------------------------------------------------------
void CallPrivate::onAckBeingSent (LinphoneHeaders *headers) {
void CallPrivate::onAckBeingSent (const std::shared_ptr<const CallSession> &session, LinphoneHeaders *headers) {
L_Q();
linphone_call_notify_ack_processing(L_GET_C_BACK_PTR(q), headers, false);
}
void CallPrivate::onAckReceived (LinphoneHeaders *headers) {
void CallPrivate::onAckReceived (const std::shared_ptr<const CallSession> &session, LinphoneHeaders *headers) {
L_Q();
linphone_call_notify_ack_processing(L_GET_C_BACK_PTR(q), headers, true);
}
void CallPrivate::onBackgroundTaskToBeStarted () {
void CallPrivate::onBackgroundTaskToBeStarted (const std::shared_ptr<const CallSession> &session) {
backgroundTaskId = sal_begin_background_task("liblinphone call notification", nullptr, nullptr);
}
void CallPrivate::onBackgroundTaskToBeStopped () {
void CallPrivate::onBackgroundTaskToBeStopped (const std::shared_ptr<const CallSession> &session) {
if (backgroundTaskId != 0) {
sal_end_background_task(backgroundTaskId);
backgroundTaskId = 0;
}
}
bool CallPrivate::onCallAccepted () {
bool CallPrivate::onCallSessionAccepted (const std::shared_ptr<const CallSession> &session) {
L_Q();
LinphoneCore *lc = q->getCore()->getCCore();
bool wasRinging = false;
......@@ -160,12 +167,12 @@ bool CallPrivate::onCallAccepted () {
return wasRinging;
}
void CallPrivate::onCallSetReleased () {
void CallPrivate::onCallSessionSetReleased (const std::shared_ptr<const CallSession> &session) {
L_Q();
linphone_call_unref(L_GET_C_BACK_PTR(q));
}
void CallPrivate::onCallSetTerminated () {
void CallPrivate::onCallSessionSetTerminated (const std::shared_ptr<const CallSession> &session) {
L_Q();
LinphoneCore *core = q->getCore()->getCCore();
if (q->getSharedFromThis() == q->getCore()->getCurrentCall()) {
......@@ -190,12 +197,12 @@ void CallPrivate::onCallSetTerminated () {
ms_bandwidth_controller_reset_state(core->bw_controller);
}
void CallPrivate::onCallStateChanged (LinphoneCallState state, const string &message) {
void CallPrivate::onCallSessionStateChanged (const std::shared_ptr<const CallSession> &session, LinphoneCallState state, const string &message) {
L_Q();
linphone_call_notify_state_changed(L_GET_C_BACK_PTR(q), state, message.c_str());
}
void CallPrivate::onCheckForAcceptation () {
void CallPrivate::onCheckForAcceptation (const std::shared_ptr<const 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()));
......@@ -218,23 +225,23 @@ void CallPrivate::onCheckForAcceptation () {
bctbx_list_free(copy);
}
void CallPrivate::onDtmfReceived (char dtmf) {
void CallPrivate::onDtmfReceived (const std::shared_ptr<const CallSession> &session, char dtmf) {
L_Q();
linphone_call_notify_dtmf_received(L_GET_C_BACK_PTR(q), dtmf);
}
void CallPrivate::onIncomingCallNotified () {
void CallPrivate::onIncomingCallSessionNotified (const std::shared_ptr<const CallSession> &session) {
L_Q();
/* The call is acceptable so we can now add it to our list */
q->getCore()->getPrivate()->addCall(q->getSharedFromThis());
}
void CallPrivate::onIncomingCallStarted () {
void CallPrivate::onIncomingCallSessionStarted (const std::shared_ptr<const CallSession> &session) {
L_Q();
linphone_core_notify_incoming_call(q->getCore()->getCCore(), L_GET_C_BACK_PTR(q));
}
void CallPrivate::onIncomingCallTimeoutCheck (int elapsed, bool oneSecondElapsed) {
void CallPrivate::onIncomingCallSessionTimeoutCheck (const std::shared_ptr<const CallSession> &session, int elapsed, bool oneSecondElapsed) {
L_Q();
if (oneSecondElapsed)
lInfo() << "Incoming call ringing for " << elapsed << " seconds";
......@@ -246,12 +253,12 @@ void CallPrivate::onIncomingCallTimeoutCheck (int elapsed, bool oneSecondElapsed
}
}
void CallPrivate::onInfoReceived (const LinphoneInfoMessage *im) {
void CallPrivate::onInfoReceived (const std::shared_ptr<const CallSession> &session, const LinphoneInfoMessage *im) {
L_Q();
linphone_call_notify_info_message_received(L_GET_C_BACK_PTR(q), im);
}
void CallPrivate::onNoMediaTimeoutCheck (bool oneSecondElapsed) {
void CallPrivate::onNoMediaTimeoutCheck (const std::shared_ptr<const CallSession> &session, bool oneSecondElapsed) {
L_Q();
int disconnectTimeout = linphone_core_get_nortp_timeout(q->getCore()->getCCore());
bool disconnected = false;
......@@ -263,27 +270,27 @@ void CallPrivate::onNoMediaTimeoutCheck (bool oneSecondElapsed) {
terminateBecauseOfLostMedia();
}
void CallPrivate::onEncryptionChanged (bool activated, const string &authToken) {
void CallPrivate::onEncryptionChanged (const std::shared_ptr<const CallSession> &session, bool activated, const string &authToken) {
L_Q();
linphone_call_notify_encryption_changed(L_GET_C_BACK_PTR(q), activated, authToken.empty() ? nullptr : authToken.c_str());
}
void CallPrivate::onStatsUpdated (const LinphoneCallStats *stats) {
void CallPrivate::onStatsUpdated (const std::shared_ptr<const CallSession> &session, const LinphoneCallStats *stats) {
L_Q();
linphone_call_notify_stats_updated(L_GET_C_BACK_PTR(q), stats);
}
void CallPrivate::onResetCurrentCall () {
void CallPrivate::onResetCurrentSession (const std::shared_ptr<const CallSession> &session) {
L_Q();
q->getCore()->getPrivate()->setCurrentCall(nullptr);
}
void CallPrivate::onSetCurrentCall () {
void CallPrivate::onSetCurrentSession (const std::shared_ptr<const CallSession> &session) {
L_Q();
q->getCore()->getPrivate()->setCurrentCall(q->getSharedFromThis());
}
void CallPrivate::onFirstVideoFrameDecoded () {
void CallPrivate::onFirstVideoFrameDecoded (const std::shared_ptr<const CallSession> &session) {
L_Q();
if (nextVideoFrameDecoded._func) {
nextVideoFrameDecoded._func(L_GET_C_BACK_PTR(q), nextVideoFrameDecoded._user_data);
......@@ -292,19 +299,16 @@ void CallPrivate::onFirstVideoFrameDecoded () {
}
}
void CallPrivate::onResetFirstVideoFrameDecoded () {
#ifdef VIDEO_ENABLED
if (nextVideoFrameDecoded._func)
static_cast<MediaSession *>(getActiveSession().get())->resetFirstVideoFrameDecoded();
#endif // ifdef VIDEO_ENABLED
void CallPrivate::onResetFirstVideoFrameDecoded (const std::shared_ptr<const CallSession> &session) {
resetFirstVideoFrameDecoded();
}
void CallPrivate::onPlayErrorTone (LinphoneReason reason) {
void CallPrivate::onPlayErrorTone (const std::shared_ptr<const CallSession> &session, LinphoneReason reason) {
L_Q();
linphone_core_play_call_error_tone(q->getCore()->getCCore(), reason);
}
void CallPrivate::onRingbackToneRequested (bool requested) {
void CallPrivate::onRingbackToneRequested (const std::shared_ptr<const CallSession> &session, bool requested) {
L_Q();
if (requested && linphone_core_get_remote_ringback_tone(q->getCore()->getCCore()))
playingRingbackTone = true;
......@@ -312,7 +316,7 @@ void CallPrivate::onRingbackToneRequested (bool requested) {
playingRingbackTone = false;
}
void CallPrivate::onStartRinging () {
void CallPrivate::onStartRinging (const std::shared_ptr<const CallSession> &session) {
L_Q();
LinphoneCore *lc = q->getCore()->getCCore();
if (lc->ringstream)
......@@ -320,12 +324,12 @@ void CallPrivate::onStartRinging () {
startRemoteRing();
}
void CallPrivate::onStopRinging () {
void CallPrivate::onStopRinging (const std::shared_ptr<const CallSession> &session) {
L_Q();
linphone_core_stop_ringing(q->getCore()->getCCore());
}
void CallPrivate::onStopRingingIfInCall () {
void CallPrivate::onStopRingingIfInCall (const std::shared_ptr<const CallSession> &session) {
L_Q();
LinphoneCore *lc = q->getCore()->getCCore();
// We stop the ring only if we have this current call or if we are in call
......@@ -334,7 +338,7 @@ void CallPrivate::onStopRingingIfInCall () {
}
}
void CallPrivate::onStopRingingIfNeeded () {
void CallPrivate::onStopRingingIfNeeded (const std::shared_ptr<const CallSession> &session) {
L_Q();
LinphoneCore *lc = q->getCore()->getCCore();
bool stopRinging = true;
......@@ -350,7 +354,7 @@ void CallPrivate::onStopRingingIfNeeded () {
linphone_core_stop_ringing(lc);
}
bool CallPrivate::isPlayingRingbackTone () {
bool CallPrivate::isPlayingRingbackTone (const std::shared_ptr<const CallSession> &session) {
return playingRingbackTone;
}
......@@ -711,7 +715,7 @@ void Call::setNextVideoFrameDecodedCallback (LinphoneCallCbFunc cb, void *user_d
L_D();
d->nextVideoFrameDecoded._func = cb;
d->nextVideoFrameDecoded._user_data = user_data;
d->onResetFirstVideoFrameDecoded();
d->resetFirstVideoFrameDecoded();
}
void Call::setParams (const MediaSessionParams *msp) {
......
......@@ -22,12 +22,13 @@
#include "chat/chat-room/chat-room-p.h"
#include "client-group-chat-room.h"
#include "conference/session/call-session-listener.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class ClientGroupChatRoomPrivate : public ChatRoomPrivate {
class ClientGroupChatRoomPrivate : public ChatRoomPrivate, public CallSessionListener {
public:
ClientGroupChatRoomPrivate () = default;
......@@ -37,6 +38,10 @@ public:
void multipartNotifyReceived (const std::string &body);
private:
// CallSessionListener
void onCallSessionSetReleased (const std::shared_ptr<const CallSession> &session) override;
void onCallSessionStateChanged (const std::shared_ptr<const CallSession> &session, LinphoneCallState state, const std::string &message) override;
void onChatMessageReceived (const std::shared_ptr<ChatMessage> &chatMessage) override;
L_DECLARE_PUBLIC(ClientGroupChatRoom);
......
......@@ -62,7 +62,7 @@ shared_ptr<CallSession> ClientGroupChatRoomPrivate::createSession () {
csp.addCustomContactParameter("text");
shared_ptr<Participant> focus = qConference->getPrivate()->focus;
shared_ptr<CallSession> session = focus->getPrivate()->createSession(*q, &csp, false, q);
shared_ptr<CallSession> session = focus->getPrivate()->createSession(*q, &csp, false, this);
const Address &myAddress = q->getMe()->getAddress();
Address myCleanedAddress(myAddress);
myCleanedAddress.setUriParam("gr"); // Remove gr parameter for INVITE
......@@ -81,6 +81,41 @@ void ClientGroupChatRoomPrivate::multipartNotifyReceived (const string &body) {
qConference->getPrivate()->eventHandler->multipartNotifyReceived(body);
}
// -----------------------------------------------------------------------------
void ClientGroupChatRoomPrivate::onCallSessionSetReleased (const shared_ptr<const CallSession> &session) {
L_Q_T(RemoteConference, qConference);
ParticipantPrivate *participantPrivate = qConference->getPrivate()->focus->getPrivate();
if (session == participantPrivate->getSession())
participantPrivate->removeSession();
}
void ClientGroupChatRoomPrivate::onCallSessionStateChanged (
const shared_ptr<const CallSession> &session,
LinphoneCallState newState,
const string &message
) {
L_Q();
L_Q_T(RemoteConference, qConference);
if (newState == LinphoneCallConnected) {
if (state == ChatRoom::State::CreationPending) {
IdentityAddress addr(session->getRemoteContactAddress()->asStringUriOnly());
q->onConferenceCreated(addr);
if (session->getRemoteContactAddress()->hasParam("isfocus"))
qConference->getPrivate()->eventHandler->subscribe(q->getChatRoomId());
} else if (state == ChatRoom::State::TerminationPending)
qConference->getPrivate()->focus->getPrivate()->getSession()->terminate();
} else if ((newState == LinphoneCallReleased) && (state == ChatRoom::State::TerminationPending)) {
q->onConferenceTerminated(q->getConferenceAddress());
} else if ((newState == LinphoneCallError) && (state == ChatRoom::State::CreationPending)) {
setState(ChatRoom::State::CreationFailed);
}
}
// -----------------------------------------------------------------------------
void ClientGroupChatRoomPrivate::onChatMessageReceived (const shared_ptr<ChatMessage> &) {}
// =============================================================================
......@@ -475,37 +510,4 @@ void ClientGroupChatRoom::onParticipantDeviceRemoved (const shared_ptr<Conferenc
cb(cr, L_GET_C_BACK_PTR(event));
}
// -----------------------------------------------------------------------------
void ClientGroupChatRoom::onCallSessionSetReleased (const shared_ptr<const CallSession> &session) {
L_D_T(RemoteConference, dConference);
ParticipantPrivate *participantPrivate = dConference->focus->getPrivate();
if (session == participantPrivate->getSession())
participantPrivate->removeSession();
}
void ClientGroupChatRoom::onCallSessionStateChanged (
const shared_ptr<const CallSession> &session,
LinphoneCallState state,
const string &message
) {
L_D();
L_D_T(RemoteConference, dConference);
if (state == LinphoneCallConnected) {
if (d->state == ChatRoom::State::CreationPending) {
IdentityAddress addr(session->getRemoteContactAddress()->asStringUriOnly());
onConferenceCreated(addr);
if (session->getRemoteContactAddress()->hasParam("isfocus"))
dConference->eventHandler->subscribe(getChatRoomId());
} else if (d->state == ChatRoom::State::TerminationPending)
dConference->focus->getPrivate()->getSession()->terminate();
} else if ((state == LinphoneCallReleased) && (d->state == ChatRoom::State::TerminationPending)) {
onConferenceTerminated(getConferenceAddress());
} else if ((state == LinphoneCallError) && (d->state == ChatRoom::State::CreationPending)) {
d->setState(ChatRoom::State::CreationFailed);
}
}
LINPHONE_END_NAMESPACE
......@@ -91,9 +91,6 @@ private:
void onParticipantDeviceAdded (const std::shared_ptr<ConferenceParticipantDeviceEvent> &event, bool isFullState) override;
void onParticipantDeviceRemoved (const std::shared_ptr<ConferenceParticipantDeviceEvent> &event, bool isFullState) override;
void onCallSessionSetReleased (const std::shared_ptr<const CallSession> &session) override;
void onCallSessionStateChanged (const std::shared_ptr<const CallSession> &session, LinphoneCallState state, const std::string &message) override;
L_DECLARE_PRIVATE(ClientGroupChatRoom);
L_DISABLE_COPY(ClientGroupChatRoom);
};
......
......@@ -26,6 +26,7 @@
#include "address/address.h"
#include "chat-room-p.h"
#include "server-group-chat-room.h"
#include "conference/session/call-session-listener.h"
// =============================================================================
......@@ -33,7 +34,7 @@ LINPHONE_BEGIN_NAMESPACE
class Participant;
class ServerGroupChatRoomPrivate : public ChatRoomPrivate {
class ServerGroupChatRoomPrivate : public ChatRoomPrivate, public CallSessionListener {
public:
ServerGroupChatRoomPrivate () = default;
......@@ -55,6 +56,9 @@ private:
void finalizeCreation ();
bool isAdminLeft () const;
// CallSessionListener
void onCallSessionStateChanged (const std::shared_ptr<const CallSession> &session, LinphoneCallState state, const std::string &message) override;
void onChatMessageReceived (const std::shared_ptr<ChatMessage> &) override;
std::list<std::shared_ptr<Participant>> removedParticipants;
......
......@@ -73,6 +73,16 @@ bool ServerGroupChatRoomPrivate::isAdminLeft () const {
return false;
}
// -----------------------------------------------------------------------------
void ServerGroupChatRoomPrivate::onCallSessionStateChanged (
const shared_ptr<const CallSession> &,
LinphoneCallState,
const string &
) {}
// -----------------------------------------------------------------------------
void ServerGroupChatRoomPrivate::onChatMessageReceived(const shared_ptr<ChatMessage> &) {}
// =============================================================================
......@@ -142,12 +152,4 @@ void ServerGroupChatRoom::join () {}
void ServerGroupChatRoom::leave () {}
// -----------------------------------------------------------------------------
void ServerGroupChatRoom::onCallSessionStateChanged (
const shared_ptr<const CallSession> &,
LinphoneCallState,
const string &
) {}
LINPHONE_END_NAMESPACE
......@@ -76,9 +76,6 @@ public:
void leave () override;
private:
// TODO: Move me in ServerGroupChatRoomPrivate.
void onCallSessionStateChanged (const std::shared_ptr<const CallSession> &session, LinphoneCallState state, const std::string &message) override;
L_DECLARE_PRIVATE(ServerGroupChatRoom);
L_DISABLE_COPY(ServerGroupChatRoom);
};
......
......@@ -27,7 +27,7 @@
LINPHONE_BEGIN_NAMESPACE
class CallListener;
class CallSessionListener;
class Participant;
class ConferencePrivate {
......@@ -40,11 +40,11 @@ protected:
std::shared_ptr<Participant> activeParticipant;
std::shared_ptr<Participant> me;
CallSessionListener *listener = nullptr;
Conference *mPublic = nullptr;
private:
CallListener *callListener = nullptr;
L_DECLARE_PUBLIC(Conference);
};
......
......@@ -17,7 +17,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "call/call-listener.h"
#include "conference-p.h"
#include "conference/session/call-session-p.h"
#include "logger/logger.h"
......@@ -33,12 +32,12 @@ Conference::Conference (
ConferencePrivate &p,
const shared_ptr<Core> &core,
const IdentityAddress &myAddress,
CallListener *listener
CallSessionListener *listener
) : CoreAccessor(core), mPrivate(&p) {
L_D();
d->mPublic = this;
d->callListener = listener;
d->me = make_shared<Participant>(myAddress);
d->listener = listener;
}
Conference::~Conference () {
......@@ -122,178 +121,6 @@ void Conference::setSubject (const string &subject) {
// -----------------------------------------------------------------------------
void Conference::onAckBeingSent (const shared_ptr<const CallSession> &session, LinphoneHeaders *headers) {
L_D();
if (d->callListener)
d->callListener->onAckBeingSent(headers);
}
void Conference::onAckReceived (const shared_ptr<const CallSession> &session, LinphoneHeaders *headers) {
L_D();
if (d->callListener)
d->callListener->onAckReceived(headers);
}
void Conference::onBackgroundTaskToBeStarted (const shared_ptr<const CallSession> &session) {
L_D();
if (d->callListener)
d->callListener->onBackgroundTaskToBeStarted();
}
void Conference::onBackgroundTaskToBeStopped (const shared_ptr<const CallSession> &session) {
L_D();
if (d->callListener)
d->callListener->onBackgroundTaskToBeStopped();
}
bool Conference::onCallSessionAccepted (const shared_ptr<const CallSession> &session) {
L_D();
if (d->callListener)
return d->callListener->onCallAccepted();
return false;
}
void Conference::onCallSessionSetReleased (const shared_ptr<const CallSession> &session) {
L_D();
if (d->callListener)
d->callListener->onCallSetReleased();
}
void Conference::onCallSessionSetTerminated (const shared_ptr<const CallSession> &session) {
L_D();
if (d->callListener)
d->callListener->onCallSetTerminated();
}
void Conference::onCallSessionStateChanged (const shared_ptr<const CallSession> &session, LinphoneCallState state, const string &message) {
L_D();
if (d->callListener)
d->callListener->onCallStateChanged(state, message);
}
void Conference::onCheckForAcceptation (const shared_ptr<const CallSession> &session) {
L_D();
if (d->callListener)
d->callListener->onCheckForAcceptation();
}
void Conference::onDtmfReceived (const shared_ptr<const CallSession> &session, char dtmf) {
L_D();
if (d->callListener)
d->callListener->onDtmfReceived(dtmf);
}