From a5ce479aa3585dd07938312e92f10ad0e046d60e Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 13 Sep 2017 10:37:30 +0200 Subject: [PATCH] Add function to create a client group chat room. --- coreapi/chat.c | 12 +- include/linphone/chat.h | 2 + src/CMakeLists.txt | 1 - src/c-wrapper/c-tools.h | 14 +- src/call/call-listener.h | 2 + src/chat/basic-chat-room.cpp | 4 +- src/chat/chat-room-p.h | 2 +- src/chat/chat-room.cpp | 6 +- src/chat/chat-room.h | 2 +- src/chat/client-group-chat-room-p.h | 2 +- src/chat/client-group-chat-room.cpp | 47 ++++- src/chat/client-group-chat-room.h | 8 +- src/chat/is-composing-listener.h | 2 + src/chat/real-time-text-chat-room.cpp | 4 +- src/conference/conference-interface.h | 2 + src/conference/conference-p.h | 70 -------- src/conference/conference.cpp | 161 +++++++++--------- src/conference/conference.h | 41 ++++- src/conference/local-conference.cpp | 10 +- src/conference/local-conference.h | 3 - src/conference/participant.h | 2 + src/conference/remote-conference.cpp | 10 +- src/conference/remote-conference.h | 4 +- .../session/call-session-listener.h | 2 + src/conference/session/call-session.cpp | 3 +- 25 files changed, 211 insertions(+), 205 deletions(-) delete mode 100644 src/conference/conference-p.h diff --git a/coreapi/chat.c b/coreapi/chat.c index b7e26f8e8..aa35495ef 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -37,8 +37,9 @@ #include "c-wrapper/c-tools.h" #include "chat/basic-chat-room.h" -#include "chat/real-time-text-chat-room-p.h" +#include "chat/client-group-chat-room.h" #include "chat/real-time-text-chat-room.h" +#include "chat/real-time-text-chat-room-p.h" #include "content/content-type.h" struct _LinphoneChatRoom{ @@ -255,6 +256,15 @@ LinphoneChatRoom *linphone_core_get_chat_room(LinphoneCore *lc, const LinphoneAd return ret; } +LinphoneChatRoom * linphone_core_create_client_group_chat_room(LinphoneCore *lc, bctbx_list_t *addresses) { + LinphoneChatRoom *cr = belle_sip_object_new(LinphoneChatRoom); + std::list l = L_GET_CPP_LIST_OF_CPP_OBJ_FROM_C_LIST_OF_STRUCT_PTR(addresses, Address); + LinphonePrivate::Address me; // TODO + cr->cr = new LinphonePrivate::ClientGroupChatRoom(lc, me, l); + L_GET_PRIVATE(cr->cr)->setCBackPointer(cr); + return cr; +} + void linphone_core_delete_chat_room(LinphoneCore *lc, LinphoneChatRoom *cr) { if (bctbx_list_find(lc->chatrooms, cr)) { lc->chatrooms = bctbx_list_remove(lc->chatrooms, cr); diff --git a/include/linphone/chat.h b/include/linphone/chat.h index e20a25ea7..3bc02d839 100644 --- a/include/linphone/chat.h +++ b/include/linphone/chat.h @@ -457,6 +457,8 @@ LINPHONE_PUBLIC void linphone_chat_message_set_user_data(LinphoneChatMessage* me **/ LINPHONE_PUBLIC LinphoneChatRoom* linphone_chat_message_get_chat_room(LinphoneChatMessage *msg); +LINPHONE_PUBLIC LinphoneChatRoom * linphone_core_create_client_group_chat_room(LinphoneCore *lc, bctbx_list_t *addresses); + LINPHONE_PUBLIC const LinphoneAddress* linphone_chat_message_get_peer_address(LinphoneChatMessage *msg); /** diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c3958f0e9..248535880 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -52,7 +52,6 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES chat/real-time-text-chat-room-p.h chat/real-time-text-chat-room.h conference/conference-listener.h - conference/conference-p.h conference/conference.h conference/local-conference.h conference/params/call-session-params-p.h diff --git a/src/c-wrapper/c-tools.h b/src/c-wrapper/c-tools.h index 5ea666d75..8a30c1e77 100644 --- a/src/c-wrapper/c-tools.h +++ b/src/c-wrapper/c-tools.h @@ -116,8 +116,8 @@ public: template static inline bctbx_list_t * getCListFromCppList (std::list cppList) { bctbx_list_t *result = nullptr; - for (auto it = cppList.begin(); it != cppList.end(); it++) - result = bctbx_list_append(result, *it); + for (const auto &value : cppList) + result = bctbx_list_append(result, value); return result; } @@ -129,6 +129,14 @@ public: return result; } + template + static inline std::list getCppListOfCppObjFromCListOfStructPtr (bctbx_list_t *cList) { + std::list result; + for (auto it = cList; it; it = bctbx_list_next(it)) + result.push_back(*getCppPtrFromC(reinterpret_cast(bctbx_list_get_data(it)))); + return result; + } + private: Wrapper (); @@ -217,5 +225,7 @@ LINPHONE_END_NAMESPACE LINPHONE_NAMESPACE::Wrapper::getCListFromCppList(LIST) #define L_GET_CPP_LIST_FROM_C_LIST(LIST, TYPE) \ LINPHONE_NAMESPACE::Wrapper::getCppListFromCList(LIST) +#define L_GET_CPP_LIST_OF_CPP_OBJ_FROM_C_LIST_OF_STRUCT_PTR(LIST, TYPE) \ + LINPHONE_NAMESPACE::Wrapper::getCppListOfCppObjFromCListOfStructPtr(LIST) #endif // ifndef _C_TOOLS_H_ diff --git a/src/call/call-listener.h b/src/call/call-listener.h index 20e436b45..02c9f05dd 100644 --- a/src/call/call-listener.h +++ b/src/call/call-listener.h @@ -27,6 +27,8 @@ LINPHONE_BEGIN_NAMESPACE class CallListener { public: + virtual ~CallListener() = default; + virtual void onAckBeingSent (LinphoneHeaders *headers) = 0; virtual void onAckReceived (LinphoneHeaders *headers) = 0; virtual void onCallSetReleased () = 0; diff --git a/src/chat/basic-chat-room.cpp b/src/chat/basic-chat-room.cpp index e4768c988..d59554da5 100644 --- a/src/chat/basic-chat-room.cpp +++ b/src/chat/basic-chat-room.cpp @@ -25,7 +25,9 @@ using namespace std; LINPHONE_BEGIN_NAMESPACE -BasicChatRoomPrivate::BasicChatRoomPrivate (LinphoneCore *core, const Address &peerAddress) : ChatRoomPrivate(core, peerAddress) {} +BasicChatRoomPrivate::BasicChatRoomPrivate (LinphoneCore *core, const Address &peerAddress) : ChatRoomPrivate(core) { + this->peerAddress = peerAddress; +} // ============================================================================= diff --git a/src/chat/chat-room-p.h b/src/chat/chat-room-p.h index 2e6f88bb0..84b4b10d6 100644 --- a/src/chat/chat-room-p.h +++ b/src/chat/chat-room-p.h @@ -33,7 +33,7 @@ LINPHONE_BEGIN_NAMESPACE class ChatRoomPrivate : public ObjectPrivate, public IsComposingListener { public: - ChatRoomPrivate (LinphoneCore *core, const Address &peerAddress); + ChatRoomPrivate (LinphoneCore *core); virtual ~ChatRoomPrivate (); private: diff --git a/src/chat/chat-room.cpp b/src/chat/chat-room.cpp index cb6b3ff24..f984adf59 100644 --- a/src/chat/chat-room.cpp +++ b/src/chat/chat-room.cpp @@ -34,8 +34,8 @@ using namespace std; LINPHONE_BEGIN_NAMESPACE -ChatRoomPrivate::ChatRoomPrivate (LinphoneCore *core, const Address &peerAddress) - : core(core), peerAddress(peerAddress), isComposingHandler(core, this) {} +ChatRoomPrivate::ChatRoomPrivate (LinphoneCore *core) + : core(core), isComposingHandler(core, this) {} ChatRoomPrivate::~ChatRoomPrivate () { for (auto it = transientMessages.begin(); it != transientMessages.end(); it++) { @@ -538,7 +538,7 @@ void ChatRoomPrivate::onIsComposingRefreshNeeded () { // ============================================================================= -ChatRoom::ChatRoom (LinphoneCore *core, const Address &peerAddress) : Object(*new ChatRoomPrivate(core, peerAddress)) {} +ChatRoom::ChatRoom (LinphoneCore *core) : Object(*new ChatRoomPrivate(core)) {} ChatRoom::ChatRoom (ChatRoomPrivate &p) : Object(p) {} diff --git a/src/chat/chat-room.h b/src/chat/chat-room.h index d5663d416..e2c34047f 100644 --- a/src/chat/chat-room.h +++ b/src/chat/chat-room.h @@ -38,7 +38,7 @@ class ChatRoomPrivate; class ChatRoom : public Object, public ConferenceInterface { public: - ChatRoom (LinphoneCore *core, const Address &peerAddress); + ChatRoom (LinphoneCore *core); virtual ~ChatRoom () = default; void compose (); diff --git a/src/chat/client-group-chat-room-p.h b/src/chat/client-group-chat-room-p.h index 3e6fe2d1f..346faf869 100644 --- a/src/chat/client-group-chat-room-p.h +++ b/src/chat/client-group-chat-room-p.h @@ -31,7 +31,7 @@ LINPHONE_BEGIN_NAMESPACE class ClientGroupChatRoomPrivate : public ChatRoomPrivate { public: - ClientGroupChatRoomPrivate (LinphoneCore *core, const Address &peerAddress); + ClientGroupChatRoomPrivate (LinphoneCore *core); virtual ~ClientGroupChatRoomPrivate () = default; private: diff --git a/src/chat/client-group-chat-room.cpp b/src/chat/client-group-chat-room.cpp index 9f607a71a..82550087a 100644 --- a/src/chat/client-group-chat-room.cpp +++ b/src/chat/client-group-chat-room.cpp @@ -17,14 +17,55 @@ */ #include "client-group-chat-room-p.h" +#include "conference/participant-p.h" #include "logger/logger.h" -// ============================================================================= - using namespace std; LINPHONE_BEGIN_NAMESPACE -ClientGroupChatRoomPrivate::ClientGroupChatRoomPrivate (LinphoneCore *core, const Address &peerAddress) : ChatRoomPrivate(core, peerAddress) {} +// ============================================================================= + +ClientGroupChatRoomPrivate::ClientGroupChatRoomPrivate (LinphoneCore *core) : ChatRoomPrivate(core) {} + +// ============================================================================= + +ClientGroupChatRoom::ClientGroupChatRoom (LinphoneCore *core, const Address &me, std::list
&addresses) + : ChatRoom(*new ChatRoomPrivate(core)), RemoteConference(core, me, nullptr) { + // TODO +} + +// ----------------------------------------------------------------------------- + +shared_ptr ClientGroupChatRoom::addParticipant (const Address &addr, const shared_ptr params, bool hasMedia) { + activeParticipant = make_shared(addr); + activeParticipant->getPrivate()->createSession(*this, params, hasMedia, this); + return activeParticipant; +} + +void ClientGroupChatRoom::addParticipants (const list
&addresses, const shared_ptr params, bool hasMedia) { + // TODO +} + +const string& ClientGroupChatRoom::getId () const { + return id; +} + +int ClientGroupChatRoom::getNbParticipants () const { + // TODO + return 1; +} + +list> ClientGroupChatRoom::getParticipants () const { + return participants; +} + +void ClientGroupChatRoom::removeParticipant (const shared_ptr participant) { + // TODO +} + +void ClientGroupChatRoom::removeParticipants (const list> participants) { + // TODO +} LINPHONE_END_NAMESPACE diff --git a/src/chat/client-group-chat-room.h b/src/chat/client-group-chat-room.h index 6c70ab363..f19a07326 100644 --- a/src/chat/client-group-chat-room.h +++ b/src/chat/client-group-chat-room.h @@ -23,6 +23,7 @@ #include "private.h" #include "chat/chat-room.h" +#include "conference/remote-conference.h" #include "linphone/types.h" @@ -32,11 +33,12 @@ LINPHONE_BEGIN_NAMESPACE class ClientGroupChatRoomPrivate; -class ClientGroupChatRoom : public ChatRoom { +class ClientGroupChatRoom : public ChatRoom, public RemoteConference { public: - ClientGroupChatRoom (LinphoneCore *core, const Address &peerAddress); + ClientGroupChatRoom (LinphoneCore *core, const Address &me, std::list
&addresses); virtual ~ClientGroupChatRoom () = default; +public: /* ConferenceInterface */ std::shared_ptr addParticipant (const Address &addr, const std::shared_ptr params, bool hasMedia); void addParticipants (const std::list
&addresses, const std::shared_ptr params, bool hasMedia); @@ -44,7 +46,7 @@ public: int getNbParticipants () const; std::list> getParticipants () const; void removeParticipant (const std::shared_ptr participant); - void removeParticipants (const std::list> participants); + void removeParticipants (const std::list> participants); private: L_DECLARE_PRIVATE(ClientGroupChatRoom); diff --git a/src/chat/is-composing-listener.h b/src/chat/is-composing-listener.h index 9d8c2a40b..66bd50c4d 100644 --- a/src/chat/is-composing-listener.h +++ b/src/chat/is-composing-listener.h @@ -27,6 +27,8 @@ LINPHONE_BEGIN_NAMESPACE class IsComposingListener { public: + virtual ~IsComposingListener() = default; + virtual void onIsComposingStateChanged (bool isComposing) = 0; virtual void onIsRemoteComposingStateChanged (bool isComposing) = 0; virtual void onIsComposingRefreshNeeded () = 0; diff --git a/src/chat/real-time-text-chat-room.cpp b/src/chat/real-time-text-chat-room.cpp index 680e5d05c..4933b1874 100644 --- a/src/chat/real-time-text-chat-room.cpp +++ b/src/chat/real-time-text-chat-room.cpp @@ -30,7 +30,9 @@ using namespace std; LINPHONE_BEGIN_NAMESPACE RealTimeTextChatRoomPrivate::RealTimeTextChatRoomPrivate (LinphoneCore *core, const Address &peerAddress) - : ChatRoomPrivate(core, peerAddress) {} + : ChatRoomPrivate(core) { + this->peerAddress = peerAddress; +} RealTimeTextChatRoomPrivate::~RealTimeTextChatRoomPrivate () { if (!receivedRttCharacters.empty()) { diff --git a/src/conference/conference-interface.h b/src/conference/conference-interface.h index 6c0090e05..85e22ff67 100644 --- a/src/conference/conference-interface.h +++ b/src/conference/conference-interface.h @@ -32,6 +32,8 @@ LINPHONE_BEGIN_NAMESPACE class ConferenceInterface { public: + virtual ~ConferenceInterface() = default; + virtual std::shared_ptr addParticipant (const Address &addr, const std::shared_ptr params, bool hasMedia) = 0; virtual void addParticipants (const std::list
&addresses, const std::shared_ptr params, bool hasMedia) = 0; virtual const std::string& getId () const = 0; diff --git a/src/conference/conference-p.h b/src/conference/conference-p.h deleted file mode 100644 index 70dc0658c..000000000 --- a/src/conference/conference-p.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * conference-p.h - * Copyright (C) 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 3 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, see . - */ - -#ifndef _CONFERENCE_P_H_ -#define _CONFERENCE_P_H_ - -#include - -#include "object/object-p.h" - -#include "conference/conference.h" -#include "conference/participant.h" -#include "conference/session/call-session-listener.h" - -// ============================================================================= - -LINPHONE_BEGIN_NAMESPACE - -class ConferencePrivate : public ObjectPrivate, CallSessionListener { -public: - virtual ~ConferencePrivate () = default; - - LinphoneCore * getCore () const { return core; } - -private: - /* CallSessionListener */ - virtual void onAckBeingSent (const CallSession &session, LinphoneHeaders *headers); - virtual void onAckReceived (const CallSession &session, LinphoneHeaders *headers); - virtual void onCallSessionAccepted (const CallSession &session); - virtual void onCallSessionSetReleased (const CallSession &session); - virtual void onCallSessionSetTerminated (const CallSession &session); - virtual void onCallSessionStateChanged (const CallSession &session, LinphoneCallState state, const std::string &message); - virtual void onIncomingCallSessionStarted (const CallSession &session); - virtual void onEncryptionChanged (const CallSession &session, bool activated, const std::string &authToken); - virtual void onStatsUpdated (const LinphoneCallStats *stats); - virtual void onResetCurrentSession (const CallSession &session); - virtual void onSetCurrentSession (const CallSession &session); - virtual void onFirstVideoFrameDecoded (const CallSession &session); - virtual void onResetFirstVideoFrameDecoded (const CallSession &session); - -private: - LinphoneCore *core = nullptr; - CallListener *callListener = nullptr; - - std::shared_ptr activeParticipant = nullptr; - std::string id; - std::shared_ptr me = nullptr; - std::list> participants; - - L_DECLARE_PUBLIC(Conference); -}; - -LINPHONE_END_NAMESPACE - -#endif // ifndef _CONFERENCE_P_H_ diff --git a/src/conference/conference.cpp b/src/conference/conference.cpp index 856a6e587..989713577 100644 --- a/src/conference/conference.cpp +++ b/src/conference/conference.cpp @@ -16,7 +16,6 @@ * along with this program. If not, see . */ -#include "conference-p.h" #include "participant-p.h" #include "conference.h" @@ -27,86 +26,23 @@ LINPHONE_BEGIN_NAMESPACE // ============================================================================= -void ConferencePrivate::onAckBeingSent (const CallSession &session, LinphoneHeaders *headers) { - if (callListener) - callListener->onAckBeingSent(headers); +Conference::Conference (LinphoneCore *core, const Address &myAddress, CallListener *listener) + : core(core), callListener(listener) { + me = make_shared(myAddress); } -void ConferencePrivate::onAckReceived (const CallSession &session, LinphoneHeaders *headers) { - if (callListener) - callListener->onAckReceived(headers); +// ----------------------------------------------------------------------------- + +shared_ptr Conference::getActiveParticipant () const { + return activeParticipant; } -void ConferencePrivate::onCallSessionAccepted (const CallSession &session) { - if (callListener) - callListener->onIncomingCallToBeAdded(); -} - -void ConferencePrivate::onCallSessionSetReleased (const CallSession &session) { - if (callListener) - callListener->onCallSetReleased(); -} - -void ConferencePrivate::onCallSessionSetTerminated (const CallSession &session) { - if (callListener) - callListener->onCallSetTerminated(); -} - -void ConferencePrivate::onCallSessionStateChanged (const CallSession &session, LinphoneCallState state, const string &message) { - if (callListener) - callListener->onCallStateChanged(state, message); -} - -void ConferencePrivate::onIncomingCallSessionStarted (const CallSession &session) { - if (callListener) - callListener->onIncomingCallStarted(); -} - -void ConferencePrivate::onEncryptionChanged (const CallSession &session, bool activated, const string &authToken) { - if (callListener) - callListener->onEncryptionChanged(activated, authToken); -} - -void ConferencePrivate::onStatsUpdated (const LinphoneCallStats *stats) { - if (callListener) - callListener->onStatsUpdated(stats); -} - -void ConferencePrivate::onResetCurrentSession (const CallSession &session) { - if (callListener) - callListener->onResetCurrentCall(); -} - -void ConferencePrivate::onSetCurrentSession (const CallSession &session) { - if (callListener) - callListener->onSetCurrentCall(); -} - -void ConferencePrivate::onFirstVideoFrameDecoded (const CallSession &session) { - if (callListener) - callListener->onFirstVideoFrameDecoded(); -} - -void ConferencePrivate::onResetFirstVideoFrameDecoded (const CallSession &session) { - if (callListener) - callListener->onResetFirstVideoFrameDecoded(); -} - -// ============================================================================= - -Conference::Conference (ConferencePrivate &p, LinphoneCore *core, const Address &myAddress, CallListener *listener) - : Object(p) { - L_D(Conference); - d->core = core; - d->callListener = listener; - d->me = make_shared(myAddress); -} +// ----------------------------------------------------------------------------- shared_ptr Conference::addParticipant (const Address &addr, const shared_ptr params, bool hasMedia) { - L_D(Conference); - d->activeParticipant = make_shared(addr); - d->activeParticipant->getPrivate()->createSession(*this, params, hasMedia, d); - return d->activeParticipant; + activeParticipant = make_shared(addr); + activeParticipant->getPrivate()->createSession(*this, params, hasMedia, this); + return activeParticipant; } void Conference::addParticipants (const list
&addresses, const shared_ptr params, bool hasMedia) { @@ -114,8 +50,7 @@ void Conference::addParticipants (const list
&addresses, const shared_p } const string& Conference::getId () const { - L_D(const Conference); - return d->id; + return id; } int Conference::getNbParticipants () const { @@ -124,8 +59,7 @@ int Conference::getNbParticipants () const { } list> Conference::getParticipants () const { - L_D(const Conference); - return d->participants; + return participants; } void Conference::removeParticipant (const shared_ptr participant) { @@ -136,14 +70,71 @@ void Conference::removeParticipants (const list> partici // TODO } -shared_ptr Conference::getActiveParticipant () const { - L_D(const Conference); - return d->activeParticipant; +// ----------------------------------------------------------------------------- + +void Conference::onAckBeingSent (const CallSession &session, LinphoneHeaders *headers) { + if (callListener) + callListener->onAckBeingSent(headers); } -shared_ptr Conference::getMe () const { - L_D(const Conference); - return d->me; +void Conference::onAckReceived (const CallSession &session, LinphoneHeaders *headers) { + if (callListener) + callListener->onAckReceived(headers); +} + +void Conference::onCallSessionAccepted (const CallSession &session) { + if (callListener) + callListener->onIncomingCallToBeAdded(); +} + +void Conference::onCallSessionSetReleased (const CallSession &session) { + if (callListener) + callListener->onCallSetReleased(); +} + +void Conference::onCallSessionSetTerminated (const CallSession &session) { + if (callListener) + callListener->onCallSetTerminated(); +} + +void Conference::onCallSessionStateChanged (const CallSession &session, LinphoneCallState state, const string &message) { + if (callListener) + callListener->onCallStateChanged(state, message); +} + +void Conference::onIncomingCallSessionStarted (const CallSession &session) { + if (callListener) + callListener->onIncomingCallStarted(); +} + +void Conference::onEncryptionChanged (const CallSession &session, bool activated, const string &authToken) { + if (callListener) + callListener->onEncryptionChanged(activated, authToken); +} + +void Conference::onStatsUpdated (const LinphoneCallStats *stats) { + if (callListener) + callListener->onStatsUpdated(stats); +} + +void Conference::onResetCurrentSession (const CallSession &session) { + if (callListener) + callListener->onResetCurrentCall(); +} + +void Conference::onSetCurrentSession (const CallSession &session) { + if (callListener) + callListener->onSetCurrentCall(); +} + +void Conference::onFirstVideoFrameDecoded (const CallSession &session) { + if (callListener) + callListener->onFirstVideoFrameDecoded(); +} + +void Conference::onResetFirstVideoFrameDecoded (const CallSession &session) { + if (callListener) + callListener->onResetFirstVideoFrameDecoded(); } LINPHONE_END_NAMESPACE diff --git a/src/conference/conference.h b/src/conference/conference.h index c5c9619b7..fc027da6d 100644 --- a/src/conference/conference.h +++ b/src/conference/conference.h @@ -27,6 +27,7 @@ #include "conference/conference-interface.h" #include "conference/params/call-session-params.h" #include "conference/participant.h" +#include "conference/session/call-session-listener.h" #include "linphone/types.h" @@ -34,16 +35,20 @@ LINPHONE_BEGIN_NAMESPACE -class ConferencePrivate; class CallSessionPrivate; -class Conference : public Object, public ConferenceInterface { +class Conference : public ConferenceInterface, public CallSessionListener { friend class CallSessionPrivate; public: - std::shared_ptr getActiveParticipant () const; - std::shared_ptr getMe () const; + virtual ~Conference() = default; + std::shared_ptr getActiveParticipant () const; + std::shared_ptr getMe () const { return me; } + + LinphoneCore * getCore () const { return core; } + +public: /* ConferenceInterface */ virtual std::shared_ptr addParticipant (const Address &addr, const std::shared_ptr params, bool hasMedia); virtual void addParticipants (const std::list
&addresses, const std::shared_ptr params, bool hasMedia); @@ -53,11 +58,35 @@ public: virtual void removeParticipant (const std::shared_ptr participant); virtual void removeParticipants (const std::list> participants); +private: + /* CallSessionListener */ + virtual void onAckBeingSent (const CallSession &session, LinphoneHeaders *headers); + virtual void onAckReceived (const CallSession &session, LinphoneHeaders *headers); + virtual void onCallSessionAccepted (const CallSession &session); + virtual void onCallSessionSetReleased (const CallSession &session); + virtual void onCallSessionSetTerminated (const CallSession &session); + virtual void onCallSessionStateChanged (const CallSession &session, LinphoneCallState state, const std::string &message); + virtual void onIncomingCallSessionStarted (const CallSession &session); + virtual void onEncryptionChanged (const CallSession &session, bool activated, const std::string &authToken); + virtual void onStatsUpdated (const LinphoneCallStats *stats); + virtual void onResetCurrentSession (const CallSession &session); + virtual void onSetCurrentSession (const CallSession &session); + virtual void onFirstVideoFrameDecoded (const CallSession &session); + virtual void onResetFirstVideoFrameDecoded (const CallSession &session); + protected: - explicit Conference (ConferencePrivate &p, LinphoneCore *core, const Address &myAddress, CallListener *listener = nullptr); + explicit Conference (LinphoneCore *core, const Address &myAddress, CallListener *listener = nullptr); + +protected: + LinphoneCore *core = nullptr; + CallListener *callListener = nullptr; + + std::shared_ptr activeParticipant = nullptr; + std::string id; + std::shared_ptr me = nullptr; + std::list> participants; private: - L_DECLARE_PRIVATE(Conference); L_DISABLE_COPY(Conference); }; diff --git a/src/conference/local-conference.cpp b/src/conference/local-conference.cpp index acb5a432c..a8be2c11c 100644 --- a/src/conference/local-conference.cpp +++ b/src/conference/local-conference.cpp @@ -16,21 +16,13 @@ * along with this program. If not, see . */ -#include "conference-p.h" - #include "local-conference.h" LINPHONE_BEGIN_NAMESPACE // ============================================================================= -class LocalConferencePrivate : public ConferencePrivate { -public: -}; - -// ============================================================================= - LocalConference::LocalConference (LinphoneCore *core, const Address &myAddress, CallListener *listener) - : Conference(*new LocalConferencePrivate, core, myAddress, listener) {} + : Conference(core, myAddress, listener) {} LINPHONE_END_NAMESPACE diff --git a/src/conference/local-conference.h b/src/conference/local-conference.h index 5a2b3bbe9..8b29b3752 100644 --- a/src/conference/local-conference.h +++ b/src/conference/local-conference.h @@ -25,14 +25,11 @@ LINPHONE_BEGIN_NAMESPACE -class LocalConferencePrivate; - class LocalConference : public Conference { public: LocalConference (LinphoneCore *core, const Address &myAddress, CallListener *listener = nullptr); private: - L_DECLARE_PRIVATE(LocalConference); L_DISABLE_COPY(LocalConference); }; diff --git a/src/conference/participant.h b/src/conference/participant.h index bccb4f37b..de205ee77 100644 --- a/src/conference/participant.h +++ b/src/conference/participant.h @@ -28,11 +28,13 @@ LINPHONE_BEGIN_NAMESPACE +class ClientGroupChatRoom; class ParticipantPrivate; class Participant : public Object { friend class Call; friend class CallPrivate; + friend class ClientGroupChatRoom; friend class Conference; friend class MediaSessionPrivate; diff --git a/src/conference/remote-conference.cpp b/src/conference/remote-conference.cpp index 21fcbb3cb..537b79acc 100644 --- a/src/conference/remote-conference.cpp +++ b/src/conference/remote-conference.cpp @@ -16,21 +16,13 @@ * along with this program. If not, see . */ -#include "conference-p.h" - #include "remote-conference.h" LINPHONE_BEGIN_NAMESPACE // ============================================================================= -class RemoteConferencePrivate : public ConferencePrivate { -public: -}; - -// ============================================================================= - RemoteConference::RemoteConference (LinphoneCore *core, const Address &myAddress, CallListener *listener) - : Conference(*new RemoteConferencePrivate, core, myAddress, listener) {} + : Conference(core, myAddress, listener) {} LINPHONE_END_NAMESPACE diff --git a/src/conference/remote-conference.h b/src/conference/remote-conference.h index 699c1b9c6..40d9cc387 100644 --- a/src/conference/remote-conference.h +++ b/src/conference/remote-conference.h @@ -25,14 +25,12 @@ LINPHONE_BEGIN_NAMESPACE -class RemoteConferencePrivate; - class RemoteConference : public Conference { public: RemoteConference (LinphoneCore *core, const Address &myAddress, CallListener *listener = nullptr); + virtual ~RemoteConference() = default; private: - L_DECLARE_PRIVATE(RemoteConference); L_DISABLE_COPY(RemoteConference); }; diff --git a/src/conference/session/call-session-listener.h b/src/conference/session/call-session-listener.h index 29f574559..228820a29 100644 --- a/src/conference/session/call-session-listener.h +++ b/src/conference/session/call-session-listener.h @@ -25,6 +25,8 @@ LINPHONE_BEGIN_NAMESPACE class CallSessionListener { public: + virtual ~CallSessionListener() = default; + virtual void onAckBeingSent (const CallSession &session, LinphoneHeaders *headers) = 0; virtual void onAckReceived (const CallSession &session, LinphoneHeaders *headers) = 0; virtual void onCallSessionAccepted (const CallSession &session) = 0; diff --git a/src/conference/session/call-session.cpp b/src/conference/session/call-session.cpp index ef902e8eb..595fc2c70 100644 --- a/src/conference/session/call-session.cpp +++ b/src/conference/session/call-session.cpp @@ -23,7 +23,6 @@ #include "address/address-p.h" #include "conference/session/call-session-p.h" #include "call/call-p.h" -#include "conference/conference-p.h" #include "conference/params/call-session-params-p.h" #include "conference/session/call-session.h" @@ -45,7 +44,7 @@ CallSessionPrivate::CallSessionPrivate (const Conference &conference, const shar if (params) this->params = make_shared(*params.get()); currentParams = make_shared(); - core = conference.getPrivate()->getCore(); + core = conference.getCore(); ei = linphone_error_info_new(); }