mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-19 03:58:08 +00:00
feat(Conference): hide private attributes of Conference classes (feat Benjamin Reis aka Ben Rei Jeb)
This commit is contained in:
parent
d1c80c1ec9
commit
006ecf4d76
27 changed files with 508 additions and 258 deletions
|
|
@ -40,10 +40,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "c-wrapper/c-wrapper.h"
|
||||
#include "call/call-p.h"
|
||||
#include "chat/chat-room/chat-room.h"
|
||||
#include "conference/session/call-session.h"
|
||||
#include "conference/participant.h"
|
||||
#include "conference/session/call-session-p.h"
|
||||
#include "conference/session/media-session.h"
|
||||
#include "conference/session/call-session.h"
|
||||
#include "conference/session/media-session-p.h"
|
||||
#include "conference/session/media-session.h"
|
||||
|
||||
using namespace LinphonePrivate;
|
||||
|
||||
|
|
|
|||
|
|
@ -117,6 +117,13 @@ class ObjectPrivate;
|
|||
friend class Tester;
|
||||
#endif
|
||||
|
||||
// Generic public helper. (Neither ClonableObject nor Object.)
|
||||
// `void *` is used to avoid downcasting.
|
||||
template<typename T>
|
||||
constexpr T *getPublicHelper (void *object, const void *) {
|
||||
return static_cast<T *>(object);
|
||||
}
|
||||
|
||||
template<typename T, typename U>
|
||||
inline T *getPublicHelper (const U *map, const ClonableObjectPrivate *context) {
|
||||
auto it = map->find(context);
|
||||
|
|
|
|||
|
|
@ -42,6 +42,16 @@ namespace Utils {
|
|||
return object.get();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
LINPHONE_PUBLIC constexpr T *getPtr (std::unique_ptr<T> &object) {
|
||||
return object.get();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
LINPHONE_PUBLIC constexpr T *getPtr (const std::unique_ptr<T> &object) {
|
||||
return object.get();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
LINPHONE_PUBLIC constexpr T *getPtr (T *object) {
|
||||
return object;
|
||||
|
|
|
|||
|
|
@ -54,9 +54,11 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
|
|||
chat/modifier/encryption-chat-message-modifier.h
|
||||
chat/modifier/multipart-chat-message-modifier.h
|
||||
conference/conference-listener.h
|
||||
conference/conference-p.h
|
||||
conference/conference.h
|
||||
conference/local-conference-event-handler-p.h
|
||||
conference/local-conference-event-handler.h
|
||||
conference/local-conference-p.h
|
||||
conference/local-conference.h
|
||||
conference/params/call-session-params-p.h
|
||||
conference/params/call-session-params.h
|
||||
|
|
@ -67,6 +69,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
|
|||
conference/participant.h
|
||||
conference/remote-conference-event-handler-p.h
|
||||
conference/remote-conference-event-handler.h
|
||||
conference/remote-conference-p.h
|
||||
conference/remote-conference.h
|
||||
conference/session/call-session-listener.h
|
||||
conference/session/call-session-p.h
|
||||
|
|
|
|||
|
|
@ -230,12 +230,12 @@ LinphoneParticipant *linphone_chat_room_find_participant (const LinphoneChatRoom
|
|||
}
|
||||
|
||||
const LinphoneAddress *linphone_chat_room_get_conference_address (const LinphoneChatRoom *cr) {
|
||||
if (cr->conferenceAddressCache) {
|
||||
if (cr->conferenceAddressCache)
|
||||
linphone_address_unref(cr->conferenceAddressCache);
|
||||
}
|
||||
auto addr = L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getConferenceAddress();
|
||||
if (addr)
|
||||
cr->conferenceAddressCache = linphone_address_new(addr->asString().c_str());
|
||||
|
||||
const LinphonePrivate::Address &address = L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getConferenceAddress();
|
||||
if (address.isValid())
|
||||
cr->conferenceAddressCache = linphone_address_new(address.asString().c_str());
|
||||
else
|
||||
cr->conferenceAddressCache = nullptr;
|
||||
return cr->conferenceAddressCache;
|
||||
|
|
|
|||
|
|
@ -20,10 +20,12 @@
|
|||
#ifndef _CALL_P_H_
|
||||
#define _CALL_P_H_
|
||||
|
||||
#include "call-listener.h"
|
||||
#include "call.h"
|
||||
#include "conference/conference.h"
|
||||
#include "object/object-p.h"
|
||||
|
||||
// TODO: Remove me later.
|
||||
#include "private.h"
|
||||
|
||||
// =============================================================================
|
||||
|
|
|
|||
|
|
@ -17,7 +17,10 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "linphone/utils/utils.h"
|
||||
|
||||
#include "basic-chat-room-p.h"
|
||||
#include "conference/participant.h"
|
||||
#include "logger/logger.h"
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -57,9 +60,9 @@ shared_ptr<Participant> BasicChatRoom::findParticipant (const Address &addr) con
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const Address *BasicChatRoom::getConferenceAddress () const {
|
||||
const Address &BasicChatRoom::getConferenceAddress () const {
|
||||
lError() << "a BasicChatRoom does not have a conference address";
|
||||
return nullptr;
|
||||
return Utils::getEmptyConstRefObject<Address>();
|
||||
}
|
||||
|
||||
int BasicChatRoom::getNbParticipants () const {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public:
|
|||
void addParticipants (const std::list<Address> &addresses, const CallSessionParams *params, bool hasMedia) override;
|
||||
bool canHandleParticipants () const override;
|
||||
std::shared_ptr<Participant> findParticipant (const Address &addr) const override;
|
||||
const Address *getConferenceAddress () const override;
|
||||
const Address &getConferenceAddress () const override;
|
||||
int getNbParticipants () const override;
|
||||
std::list<std::shared_ptr<Participant>> getParticipants () const override;
|
||||
const std::string &getSubject () const override;
|
||||
|
|
|
|||
|
|
@ -20,10 +20,12 @@
|
|||
#include "linphone/utils/utils.h"
|
||||
|
||||
#include "address/address-p.h"
|
||||
#include "client-group-chat-room-p.h"
|
||||
#include "c-wrapper/c-wrapper.h"
|
||||
#include "conference/session/call-session-p.h"
|
||||
#include "client-group-chat-room-p.h"
|
||||
#include "conference/participant-p.h"
|
||||
#include "conference/remote-conference-event-handler.h"
|
||||
#include "conference/remote-conference-p.h"
|
||||
#include "conference/session/call-session-p.h"
|
||||
#include "logger/logger.h"
|
||||
#include "sal/refer-op.h"
|
||||
|
||||
|
|
@ -39,12 +41,17 @@ ClientGroupChatRoomPrivate::ClientGroupChatRoomPrivate (LinphoneCore *core) : Ch
|
|||
|
||||
shared_ptr<CallSession> ClientGroupChatRoomPrivate::createSession () {
|
||||
L_Q();
|
||||
|
||||
CallSessionParams csp;
|
||||
csp.addCustomHeader("Require", "recipient-list-invite");
|
||||
shared_ptr<CallSession> session = q->focus->getPrivate()->createSession(*q, &csp, false, q);
|
||||
session->configure(LinphoneCallOutgoing, nullptr, nullptr, q->me->getAddress(), q->focus->getAddress());
|
||||
|
||||
shared_ptr<Participant> focus = static_cast<RemoteConference *>(q)->getPrivate()->focus;
|
||||
shared_ptr<CallSession> session = focus->getPrivate()->createSession(*q, &csp, false, q);
|
||||
const Address &myAddress = q->getMe()->getAddress();
|
||||
session->configure(LinphoneCallOutgoing, nullptr, nullptr, myAddress, focus->getAddress());
|
||||
session->initiateOutgoing();
|
||||
Address addr = q->me->getAddress();
|
||||
|
||||
Address addr = myAddress;
|
||||
addr.setParam("text");
|
||||
session->getPrivate()->getOp()->set_contact_address(addr.getPrivate()->getInternalAddress());
|
||||
return session;
|
||||
|
|
@ -52,15 +59,16 @@ shared_ptr<CallSession> ClientGroupChatRoomPrivate::createSession () {
|
|||
|
||||
void ClientGroupChatRoomPrivate::notifyReceived (string body) {
|
||||
L_Q();
|
||||
q->eventHandler->notifyReceived(body);
|
||||
static_cast<RemoteConference *>(q)->getPrivate()->eventHandler->notifyReceived(body);
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
|
||||
ClientGroupChatRoom::ClientGroupChatRoom (LinphoneCore *core, const Address &me, const string &uri, const string &subject)
|
||||
: ChatRoom(*new ClientGroupChatRoomPrivate(core)), RemoteConference(core, me, nullptr) {
|
||||
focus = ObjectFactory::create<Participant>(Address(uri));
|
||||
this->subject = subject;
|
||||
static_cast<RemoteConferencePrivate *>(Conference::mPrivate)->focus =
|
||||
ObjectFactory::create<Participant>(Address(uri));
|
||||
setSubject(subject);
|
||||
}
|
||||
|
||||
int ClientGroupChatRoom::getCapabilities () const {
|
||||
|
|
@ -75,28 +83,33 @@ void ClientGroupChatRoom::addParticipant (const Address &addr, const CallSession
|
|||
|
||||
void ClientGroupChatRoom::addParticipants (const list<Address> &addresses, const CallSessionParams *params, bool hasMedia) {
|
||||
L_D();
|
||||
|
||||
if (addresses.empty())
|
||||
return;
|
||||
|
||||
if ((d->state != ChatRoom::State::Instantiated) && (d->state != ChatRoom::State::Created)) {
|
||||
lError() << "Cannot add participants to the ClientGroupChatRoom in a state other than Instantiated or Created";
|
||||
return;
|
||||
}
|
||||
|
||||
list<Address> sortedAddresses(addresses);
|
||||
sortedAddresses.sort();
|
||||
sortedAddresses.unique();
|
||||
|
||||
Content content;
|
||||
content.setBody(getResourceLists(sortedAddresses));
|
||||
content.setContentType("application/resource-lists+xml");
|
||||
content.setContentDisposition("recipient-list");
|
||||
shared_ptr<CallSession> session = focus->getPrivate()->getSession();
|
||||
|
||||
shared_ptr<CallSession> session =
|
||||
static_cast<RemoteConferencePrivate *>(Conference::mPrivate)->focus->getPrivate()->getSession();
|
||||
if (session)
|
||||
session->update(nullptr, subject, &content);
|
||||
session->update(nullptr, getSubject(), &content);
|
||||
else {
|
||||
session = d->createSession();
|
||||
session->startInvite(nullptr, subject, &content);
|
||||
if (d->state == ChatRoom::State::Instantiated) {
|
||||
session->startInvite(nullptr, getSubject(), &content);
|
||||
if (d->state == ChatRoom::State::Instantiated)
|
||||
d->setState(ChatRoom::State::CreationPending);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +121,7 @@ shared_ptr<Participant> ClientGroupChatRoom::findParticipant (const Address &add
|
|||
return RemoteConference::findParticipant(addr);
|
||||
}
|
||||
|
||||
const Address *ClientGroupChatRoom::getConferenceAddress () const {
|
||||
const Address &ClientGroupChatRoom::getConferenceAddress () const {
|
||||
return RemoteConference::getConferenceAddress();
|
||||
}
|
||||
|
||||
|
|
@ -126,7 +139,8 @@ const string &ClientGroupChatRoom::getSubject () const {
|
|||
|
||||
void ClientGroupChatRoom::join () {
|
||||
L_D();
|
||||
shared_ptr<CallSession> session = focus->getPrivate()->getSession();
|
||||
shared_ptr<CallSession> session =
|
||||
static_cast<RemoteConferencePrivate *>(Conference::mPrivate)->focus->getPrivate()->getSession();
|
||||
if (!session && (d->state == ChatRoom::State::Instantiated)) {
|
||||
session = d->createSession();
|
||||
session->startInvite(nullptr, "", nullptr);
|
||||
|
|
@ -136,21 +150,26 @@ void ClientGroupChatRoom::join () {
|
|||
|
||||
void ClientGroupChatRoom::leave () {
|
||||
L_D();
|
||||
eventHandler->unsubscribe();
|
||||
shared_ptr<CallSession> session = focus->getPrivate()->getSession();
|
||||
|
||||
RemoteConferencePrivate *conferencePrivate =
|
||||
static_cast<RemoteConferencePrivate *>(Conference::mPrivate);
|
||||
conferencePrivate->eventHandler->unsubscribe();
|
||||
|
||||
shared_ptr<CallSession> session = conferencePrivate->focus->getPrivate()->getSession();
|
||||
if (session)
|
||||
session->terminate();
|
||||
else {
|
||||
session = d->createSession();
|
||||
session->startInvite(nullptr, "", nullptr);
|
||||
}
|
||||
|
||||
d->setState(ChatRoom::State::TerminationPending);
|
||||
}
|
||||
|
||||
void ClientGroupChatRoom::removeParticipant (const shared_ptr<const Participant> &participant) {
|
||||
L_D();
|
||||
SalReferOp *referOp = new SalReferOp(d->core->sal);
|
||||
LinphoneAddress *lAddr = linphone_address_new(conferenceAddress.asString().c_str());
|
||||
LinphoneAddress *lAddr = linphone_address_new(getConferenceAddress().asString().c_str());
|
||||
linphone_configure_op(d->core, referOp, lAddr, nullptr, false);
|
||||
linphone_address_unref(lAddr);
|
||||
Address referToAddr = participant->getAddress();
|
||||
|
|
@ -168,14 +187,17 @@ void ClientGroupChatRoom::removeParticipants (const list<shared_ptr<Participant>
|
|||
|
||||
void ClientGroupChatRoom::setParticipantAdminStatus (shared_ptr<Participant> &participant, bool isAdmin) {
|
||||
L_D();
|
||||
|
||||
if (isAdmin == participant->isAdmin())
|
||||
return;
|
||||
if (!me->isAdmin()) {
|
||||
|
||||
if (!getMe()->isAdmin()) {
|
||||
lError() << "Cannot change the participant admin status because I am not admin";
|
||||
return;
|
||||
}
|
||||
|
||||
SalReferOp *referOp = new SalReferOp(d->core->sal);
|
||||
LinphoneAddress *lAddr = linphone_address_new(conferenceAddress.asString().c_str());
|
||||
LinphoneAddress *lAddr = linphone_address_new(getConferenceAddress().asString().c_str());
|
||||
linphone_configure_op(d->core, referOp, lAddr, nullptr, false);
|
||||
linphone_address_unref(lAddr);
|
||||
Address referToAddr = participant->getAddress();
|
||||
|
|
@ -189,15 +211,19 @@ void ClientGroupChatRoom::setParticipantAdminStatus (shared_ptr<Participant> &pa
|
|||
|
||||
void ClientGroupChatRoom::setSubject (const string &subject) {
|
||||
L_D();
|
||||
|
||||
if (d->state != ChatRoom::State::Created) {
|
||||
lError() << "Cannot change the ClientGroupChatRoom subject in a state other than Created";
|
||||
return;
|
||||
}
|
||||
if (!me->isAdmin()) {
|
||||
|
||||
if (!getMe()->isAdmin()) {
|
||||
lError() << "Cannot change the ClientGroupChatRoom subject because I am not admin";
|
||||
return;
|
||||
}
|
||||
shared_ptr<CallSession> session = focus->getPrivate()->getSession();
|
||||
|
||||
shared_ptr<CallSession> session =
|
||||
static_cast<RemoteConferencePrivate *>(Conference::mPrivate)->focus->getPrivate()->getSession();
|
||||
if (session)
|
||||
session->update(nullptr, subject);
|
||||
else {
|
||||
|
|
@ -210,7 +236,7 @@ void ClientGroupChatRoom::setSubject (const string &subject) {
|
|||
|
||||
void ClientGroupChatRoom::onConferenceCreated (const Address &addr) {
|
||||
L_D();
|
||||
conferenceAddress = addr;
|
||||
static_cast<RemoteConferencePrivate *>(Conference::mPrivate)->conferenceAddress = addr;
|
||||
d->setState(ChatRoom::State::Created);
|
||||
_linphone_core_add_group_chat_room(d->core, addr, L_GET_C_BACK_PTR(this));
|
||||
}
|
||||
|
|
@ -223,13 +249,15 @@ void ClientGroupChatRoom::onConferenceTerminated (const Address &addr) {
|
|||
void ClientGroupChatRoom::onParticipantAdded (const Address &addr) {
|
||||
if (isMe(addr))
|
||||
return;
|
||||
|
||||
shared_ptr<Participant> participant = findParticipant(addr);
|
||||
if (participant) {
|
||||
lWarning() << "Participant " << participant << " added but already in the list of participants!";
|
||||
return;
|
||||
}
|
||||
|
||||
participant = ObjectFactory::create<Participant>(addr);
|
||||
participants.push_back(participant);
|
||||
RemoteConference::mPrivate->participants.push_back(participant);
|
||||
LinphoneChatRoom *cr = L_GET_C_BACK_PTR(this);
|
||||
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(cr);
|
||||
LinphoneChatRoomCbsParticipantAddedCb cb = linphone_chat_room_cbs_get_participant_added(cbs);
|
||||
|
|
@ -248,13 +276,13 @@ void ClientGroupChatRoom::onParticipantRemoved (const Address &addr) {
|
|||
LinphoneChatRoomCbsParticipantRemovedCb cb = linphone_chat_room_cbs_get_participant_removed(cbs);
|
||||
if (cb)
|
||||
cb(cr, L_GET_C_BACK_PTR(participant));
|
||||
participants.remove(participant);
|
||||
RemoteConference::mPrivate->participants.remove(participant);
|
||||
}
|
||||
|
||||
void ClientGroupChatRoom::onParticipantSetAdmin (const Address &addr, bool isAdmin) {
|
||||
shared_ptr<Participant> participant;
|
||||
if (isMe(addr))
|
||||
participant = me;
|
||||
participant = getMe();
|
||||
else
|
||||
participant = findParticipant(addr);
|
||||
if (!participant) {
|
||||
|
|
@ -270,7 +298,7 @@ void ClientGroupChatRoom::onParticipantSetAdmin (const Address &addr, bool isAdm
|
|||
}
|
||||
|
||||
void ClientGroupChatRoom::onSubjectChanged (const std::string &subject) {
|
||||
this->subject = subject;
|
||||
setSubject(subject);
|
||||
LinphoneChatRoom *cr = L_GET_C_BACK_PTR(this);
|
||||
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(cr);
|
||||
LinphoneChatRoomCbsSubjectChangedCb cb = linphone_chat_room_cbs_get_subject_changed(cbs);
|
||||
|
|
@ -281,7 +309,7 @@ void ClientGroupChatRoom::onSubjectChanged (const std::string &subject) {
|
|||
void ClientGroupChatRoom::onParticipantDeviceAdded (const Address &addr, const Address &gruu) {
|
||||
shared_ptr<Participant> participant;
|
||||
if (isMe(addr))
|
||||
participant = me;
|
||||
participant = getMe();
|
||||
else
|
||||
participant = findParticipant(addr);
|
||||
if (!participant) {
|
||||
|
|
@ -294,7 +322,7 @@ void ClientGroupChatRoom::onParticipantDeviceAdded (const Address &addr, const A
|
|||
void ClientGroupChatRoom::onParticipantDeviceRemoved (const Address &addr, const Address &gruu) {
|
||||
shared_ptr<Participant> participant;
|
||||
if (isMe(addr))
|
||||
participant = me;
|
||||
participant = getMe();
|
||||
else
|
||||
participant = findParticipant(addr);
|
||||
if (!participant) {
|
||||
|
|
@ -307,8 +335,11 @@ void ClientGroupChatRoom::onParticipantDeviceRemoved (const Address &addr, const
|
|||
// -----------------------------------------------------------------------------
|
||||
|
||||
void ClientGroupChatRoom::onCallSessionSetReleased (const std::shared_ptr<const CallSession> &session) {
|
||||
if (session == focus->getPrivate()->getSession())
|
||||
focus->getPrivate()->removeSession();
|
||||
ParticipantPrivate *participantPrivate =
|
||||
static_cast<RemoteConferencePrivate *>(Conference::mPrivate)->focus->getPrivate();
|
||||
|
||||
if (session == participantPrivate->getSession())
|
||||
participantPrivate->removeSession();
|
||||
}
|
||||
|
||||
void ClientGroupChatRoom::onCallSessionStateChanged (const std::shared_ptr<const CallSession> &session, LinphoneCallState state, const string &message) {
|
||||
|
|
@ -319,14 +350,13 @@ void ClientGroupChatRoom::onCallSessionStateChanged (const std::shared_ptr<const
|
|||
addr.clean();
|
||||
onConferenceCreated(addr);
|
||||
if (session->getRemoteContactAddress()->hasParam("isfocus"))
|
||||
eventHandler->subscribe(conferenceAddress);
|
||||
} else if (d->state == ChatRoom::State::TerminationPending) {
|
||||
focus->getPrivate()->getSession()->terminate();
|
||||
}
|
||||
} else {
|
||||
if ((state == LinphoneCallReleased) && (d->state == ChatRoom::State::TerminationPending))
|
||||
onConferenceTerminated(conferenceAddress);
|
||||
}
|
||||
static_cast<RemoteConferencePrivate *>(Conference::mPrivate)->eventHandler->subscribe(
|
||||
getConferenceAddress()
|
||||
);
|
||||
} else if (d->state == ChatRoom::State::TerminationPending)
|
||||
static_cast<RemoteConferencePrivate *>(Conference::mPrivate)->focus->getPrivate()->getSession()->terminate();
|
||||
} else if ((state == LinphoneCallReleased) && (d->state == ChatRoom::State::TerminationPending))
|
||||
onConferenceTerminated(getConferenceAddress());
|
||||
}
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public:
|
|||
void addParticipants (const std::list<Address> &addresses, const CallSessionParams *params, bool hasMedia) override;
|
||||
bool canHandleParticipants () const override;
|
||||
std::shared_ptr<Participant> findParticipant (const Address &addr) const override;
|
||||
const Address *getConferenceAddress () const override;
|
||||
const Address &getConferenceAddress () const override;
|
||||
int getNbParticipants () const override;
|
||||
std::list<std::shared_ptr<Participant>> getParticipants () const override;
|
||||
const std::string &getSubject () const override;
|
||||
|
|
@ -69,7 +69,7 @@ private:
|
|||
void onCallSessionStateChanged (const std::shared_ptr<const CallSession> &session, LinphoneCallState state, const std::string &message) override;
|
||||
|
||||
private:
|
||||
L_DECLARE_PRIVATE(ClientGroupChatRoom);
|
||||
L_DECLARE_PRIVATE_T(ClientGroupChatRoom, ChatRoom);
|
||||
L_DISABLE_COPY(ClientGroupChatRoom);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "c-wrapper/c-wrapper.h"
|
||||
#include "chat/chat-message/chat-message-p.h"
|
||||
#include "conference/participant.h"
|
||||
#include "logger/logger.h"
|
||||
#include "real-time-text-chat-room-p.h"
|
||||
|
||||
|
|
@ -150,9 +151,9 @@ shared_ptr<Participant> RealTimeTextChatRoom::findParticipant (const Address &ad
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const Address *RealTimeTextChatRoom::getConferenceAddress () const {
|
||||
const Address &RealTimeTextChatRoom::getConferenceAddress () const {
|
||||
lError() << "a RealTimeTextChatRoom does not have a conference address";
|
||||
return nullptr;
|
||||
return Utils::getEmptyConstRefObject<Address>();
|
||||
}
|
||||
|
||||
int RealTimeTextChatRoom::getNbParticipants () const {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public:
|
|||
void addParticipants (const std::list<Address> &addresses, const CallSessionParams *params, bool hasMedia) override;
|
||||
bool canHandleParticipants () const override;
|
||||
std::shared_ptr<Participant> findParticipant (const Address &addr) const override;
|
||||
const Address *getConferenceAddress () const override;
|
||||
const Address &getConferenceAddress () const override;
|
||||
int getNbParticipants () const override;
|
||||
std::list<std::shared_ptr<Participant>> getParticipants () const override;
|
||||
const std::string &getSubject () const override;
|
||||
|
|
|
|||
|
|
@ -23,14 +23,16 @@
|
|||
#include <list>
|
||||
#include <memory>
|
||||
|
||||
#include "address/address.h"
|
||||
#include "conference/participant.h"
|
||||
#include "conference/params/call-session-params.h"
|
||||
#include "linphone/utils/general.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class Address;
|
||||
class CallSessionParams;
|
||||
class Participant;
|
||||
|
||||
class LINPHONE_PUBLIC ConferenceInterface {
|
||||
public:
|
||||
virtual ~ConferenceInterface() = default;
|
||||
|
|
@ -39,7 +41,7 @@ public:
|
|||
virtual void addParticipants (const std::list<Address> &addresses, const CallSessionParams *params, bool hasMedia) = 0;
|
||||
virtual bool canHandleParticipants () const = 0;
|
||||
virtual std::shared_ptr<Participant> findParticipant (const Address &addr) const = 0;
|
||||
virtual const Address *getConferenceAddress () const = 0;
|
||||
virtual const Address &getConferenceAddress () const = 0;
|
||||
virtual int getNbParticipants () const = 0;
|
||||
virtual std::list<std::shared_ptr<Participant>> getParticipants () const = 0;
|
||||
virtual const std::string &getSubject () const = 0;
|
||||
|
|
|
|||
|
|
@ -20,12 +20,16 @@
|
|||
#ifndef _CONFERENCE_LISTENER_H_
|
||||
#define _CONFERENCE_LISTENER_H_
|
||||
|
||||
#include "address/address.h"
|
||||
#include <string>
|
||||
|
||||
#include "linphone/utils/general.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class Address;
|
||||
|
||||
class ConferenceListener {
|
||||
public:
|
||||
virtual void onConferenceCreated (const Address &addr) = 0;
|
||||
|
|
@ -41,4 +45,3 @@ public:
|
|||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _CONFERENCE_LISTENER_H_
|
||||
|
||||
|
|
|
|||
59
src/conference/conference-p.h
Normal file
59
src/conference/conference-p.h
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* conference-p.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 _CONFERENCE_P_H_
|
||||
#define _CONFERENCE_P_H_
|
||||
|
||||
#include <list>
|
||||
#include <memory>
|
||||
|
||||
#include "linphone/types.h"
|
||||
|
||||
#include "address/address.h"
|
||||
#include "conference.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class CallListener;
|
||||
class Participant;
|
||||
|
||||
class ConferencePrivate {
|
||||
public:
|
||||
Address conferenceAddress;
|
||||
std::list<std::shared_ptr<Participant>> participants;
|
||||
|
||||
protected:
|
||||
LinphoneCore *core = nullptr;
|
||||
CallListener *callListener = nullptr;
|
||||
|
||||
std::shared_ptr<Participant> activeParticipant;
|
||||
std::shared_ptr<Participant> me;
|
||||
std::string subject;
|
||||
|
||||
Conference *mPublic = nullptr;
|
||||
|
||||
private:
|
||||
L_DECLARE_PUBLIC(Conference);
|
||||
};
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _CONFERENCE_P_H_
|
||||
|
|
@ -17,27 +17,45 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "participant-p.h"
|
||||
|
||||
#include "conference.h"
|
||||
#include "call/call-listener.h"
|
||||
#include "conference-p.h"
|
||||
#include "conference/session/call-session-p.h"
|
||||
#include "logger/logger.h"
|
||||
#include "participant-p.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
using namespace std;
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
// =============================================================================
|
||||
Conference::Conference (ConferencePrivate &p, LinphoneCore *core, const Address &myAddress, CallListener *listener) : mPrivate(&p) {
|
||||
L_D();
|
||||
d->mPublic = this;
|
||||
d->core = core;
|
||||
d->callListener = listener;
|
||||
d->me = ObjectFactory::create<Participant>(myAddress);
|
||||
}
|
||||
|
||||
Conference::Conference (LinphoneCore *core, const Address &myAddress, CallListener *listener)
|
||||
: core(core), callListener(listener) {
|
||||
me = ObjectFactory::create<Participant>(myAddress);
|
||||
Conference::~Conference () {
|
||||
delete mPrivate;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
shared_ptr<Participant> Conference::getActiveParticipant () const {
|
||||
return activeParticipant;
|
||||
L_D();
|
||||
return d->activeParticipant;
|
||||
}
|
||||
|
||||
shared_ptr<Participant> Conference::getMe () const {
|
||||
L_D();
|
||||
return d->me;
|
||||
}
|
||||
|
||||
LinphoneCore *Conference::getCore () const {
|
||||
L_D();
|
||||
return d->core;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
@ -61,20 +79,24 @@ bool Conference::canHandleParticipants () const {
|
|||
return true;
|
||||
}
|
||||
|
||||
const Address *Conference::getConferenceAddress () const {
|
||||
return &conferenceAddress;
|
||||
const Address &Conference::getConferenceAddress () const {
|
||||
L_D();
|
||||
return d->conferenceAddress;
|
||||
}
|
||||
|
||||
int Conference::getNbParticipants () const {
|
||||
return static_cast<int>(participants.size());
|
||||
L_D();
|
||||
return static_cast<int>(d->participants.size());
|
||||
}
|
||||
|
||||
list<shared_ptr<Participant>> Conference::getParticipants () const {
|
||||
return participants;
|
||||
L_D();
|
||||
return d->participants;
|
||||
}
|
||||
|
||||
const string &Conference::getSubject () const {
|
||||
return subject;
|
||||
L_D();
|
||||
return d->subject;
|
||||
}
|
||||
|
||||
void Conference::join () {}
|
||||
|
|
@ -90,110 +112,132 @@ void Conference::removeParticipants (const list<shared_ptr<Participant>> &partic
|
|||
removeParticipant(p);
|
||||
}
|
||||
|
||||
void Conference::setParticipantAdminStatus (std::shared_ptr<Participant> &participant, bool isAdmin) {
|
||||
void Conference::setParticipantAdminStatus (shared_ptr<Participant> &participant, bool isAdmin) {
|
||||
lError() << "Conference class does not handle setParticipantAdminStatus() generically";
|
||||
}
|
||||
|
||||
void Conference::setSubject (const string &subject) {
|
||||
this->subject = subject;
|
||||
L_D();
|
||||
d->subject = subject;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void Conference::onAckBeingSent (const std::shared_ptr<const CallSession> &session, LinphoneHeaders *headers) {
|
||||
if (callListener)
|
||||
callListener->onAckBeingSent(headers);
|
||||
void Conference::onAckBeingSent (const shared_ptr<const CallSession> &session, LinphoneHeaders *headers) {
|
||||
L_D();
|
||||
if (d->callListener)
|
||||
d->callListener->onAckBeingSent(headers);
|
||||
}
|
||||
|
||||
void Conference::onAckReceived (const std::shared_ptr<const CallSession> &session, LinphoneHeaders *headers) {
|
||||
if (callListener)
|
||||
callListener->onAckReceived(headers);
|
||||
void Conference::onAckReceived (const shared_ptr<const CallSession> &session, LinphoneHeaders *headers) {
|
||||
L_D();
|
||||
if (d->callListener)
|
||||
d->callListener->onAckReceived(headers);
|
||||
}
|
||||
|
||||
void Conference::onCallSessionAccepted (const std::shared_ptr<const CallSession> &session) {
|
||||
if (callListener)
|
||||
callListener->onIncomingCallToBeAdded();
|
||||
void Conference::onCallSessionAccepted (const shared_ptr<const CallSession> &session) {
|
||||
L_D();
|
||||
if (d->callListener)
|
||||
d->callListener->onIncomingCallToBeAdded();
|
||||
}
|
||||
|
||||
void Conference::onCallSessionSetReleased (const std::shared_ptr<const CallSession> &session) {
|
||||
if (callListener)
|
||||
callListener->onCallSetReleased();
|
||||
void Conference::onCallSessionSetReleased (const shared_ptr<const CallSession> &session) {
|
||||
L_D();
|
||||
if (d->callListener)
|
||||
d->callListener->onCallSetReleased();
|
||||
}
|
||||
|
||||
void Conference::onCallSessionSetTerminated (const std::shared_ptr<const CallSession> &session) {
|
||||
if (callListener)
|
||||
callListener->onCallSetTerminated();
|
||||
void Conference::onCallSessionSetTerminated (const shared_ptr<const CallSession> &session) {
|
||||
L_D();
|
||||
if (d->callListener)
|
||||
d->callListener->onCallSetTerminated();
|
||||
}
|
||||
|
||||
void Conference::onCallSessionStateChanged (const std::shared_ptr<const CallSession> &session, LinphoneCallState state, const string &message) {
|
||||
if (callListener)
|
||||
callListener->onCallStateChanged(state, message);
|
||||
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 std::shared_ptr<const CallSession> &session) {
|
||||
if (callListener)
|
||||
callListener->onCheckForAcceptation();
|
||||
void Conference::onCheckForAcceptation (const shared_ptr<const CallSession> &session) {
|
||||
L_D();
|
||||
if (d->callListener)
|
||||
d->callListener->onCheckForAcceptation();
|
||||
}
|
||||
|
||||
void Conference::onIncomingCallSessionStarted (const std::shared_ptr<const CallSession> &session) {
|
||||
if (callListener)
|
||||
callListener->onIncomingCallStarted();
|
||||
void Conference::onIncomingCallSessionStarted (const shared_ptr<const CallSession> &session) {
|
||||
L_D();
|
||||
if (d->callListener)
|
||||
d->callListener->onIncomingCallStarted();
|
||||
}
|
||||
|
||||
void Conference::onEncryptionChanged (const std::shared_ptr<const CallSession> &session, bool activated, const string &authToken) {
|
||||
if (callListener)
|
||||
callListener->onEncryptionChanged(activated, authToken);
|
||||
void Conference::onEncryptionChanged (const shared_ptr<const CallSession> &session, bool activated, const string &authToken) {
|
||||
L_D();
|
||||
if (d->callListener)
|
||||
d->callListener->onEncryptionChanged(activated, authToken);
|
||||
}
|
||||
|
||||
void Conference::onStatsUpdated (const LinphoneCallStats *stats) {
|
||||
if (callListener)
|
||||
callListener->onStatsUpdated(stats);
|
||||
L_D();
|
||||
if (d->callListener)
|
||||
d->callListener->onStatsUpdated(stats);
|
||||
}
|
||||
|
||||
void Conference::onResetCurrentSession (const std::shared_ptr<const CallSession> &session) {
|
||||
if (callListener)
|
||||
callListener->onResetCurrentCall();
|
||||
void Conference::onResetCurrentSession (const shared_ptr<const CallSession> &session) {
|
||||
L_D();
|
||||
if (d->callListener)
|
||||
d->callListener->onResetCurrentCall();
|
||||
}
|
||||
|
||||
void Conference::onSetCurrentSession (const std::shared_ptr<const CallSession> &session) {
|
||||
if (callListener)
|
||||
callListener->onSetCurrentCall();
|
||||
void Conference::onSetCurrentSession (const shared_ptr<const CallSession> &session) {
|
||||
L_D();
|
||||
if (d->callListener)
|
||||
d->callListener->onSetCurrentCall();
|
||||
}
|
||||
|
||||
void Conference::onFirstVideoFrameDecoded (const std::shared_ptr<const CallSession> &session) {
|
||||
if (callListener)
|
||||
callListener->onFirstVideoFrameDecoded();
|
||||
void Conference::onFirstVideoFrameDecoded (const shared_ptr<const CallSession> &session) {
|
||||
L_D();
|
||||
if (d->callListener)
|
||||
d->callListener->onFirstVideoFrameDecoded();
|
||||
}
|
||||
|
||||
void Conference::onResetFirstVideoFrameDecoded (const std::shared_ptr<const CallSession> &session) {
|
||||
if (callListener)
|
||||
callListener->onResetFirstVideoFrameDecoded();
|
||||
void Conference::onResetFirstVideoFrameDecoded (const shared_ptr<const CallSession> &session) {
|
||||
L_D();
|
||||
if (d->callListener)
|
||||
d->callListener->onResetFirstVideoFrameDecoded();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
shared_ptr<Participant> Conference::findParticipant (const Address &addr) const {
|
||||
L_D();
|
||||
|
||||
Address testedAddr = addr;
|
||||
testedAddr.setPort(0);
|
||||
for (const auto &participant : participants) {
|
||||
for (const auto &participant : d->participants) {
|
||||
Address participantAddr = participant->getAddress();
|
||||
participantAddr.setPort(0);
|
||||
if (testedAddr.weakEqual(participantAddr))
|
||||
return participant;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
shared_ptr<Participant> Conference::findParticipant (const shared_ptr<const CallSession> &session) const {
|
||||
for (const auto &participant : participants) {
|
||||
L_D();
|
||||
|
||||
for (const auto &participant : d->participants) {
|
||||
if (participant->getPrivate()->getSession() == session)
|
||||
return participant;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Conference::isMe (const Address &addr) const {
|
||||
Address cleanedMe = me->getAddress();
|
||||
L_D();
|
||||
Address cleanedMe = d->me->getAddress();
|
||||
cleanedMe.setPort(0);
|
||||
Address cleanedAddr = addr;
|
||||
cleanedAddr.setPort(0);
|
||||
|
|
|
|||
|
|
@ -22,39 +22,36 @@
|
|||
|
||||
#include "linphone/types.h"
|
||||
|
||||
#include "address/address.h"
|
||||
#include "call/call-listener.h"
|
||||
#include "conference/conference-interface.h"
|
||||
#include "conference/params/call-session-params.h"
|
||||
#include "conference/participant.h"
|
||||
#include "conference/session/call-session-listener.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class CallListener;
|
||||
class CallSessionPrivate;
|
||||
class ConferencePrivate;
|
||||
|
||||
class LINPHONE_PUBLIC Conference : public ConferenceInterface, public CallSessionListener {
|
||||
friend class CallSessionPrivate;
|
||||
|
||||
public:
|
||||
virtual ~Conference() = default;
|
||||
virtual ~Conference();
|
||||
|
||||
std::shared_ptr<Participant> getActiveParticipant () const;
|
||||
std::shared_ptr<Participant> getMe () const { return me; }
|
||||
std::shared_ptr<Participant> getMe () const;
|
||||
|
||||
LinphoneCore * getCore () const { return core; }
|
||||
LinphoneCore * getCore () const;
|
||||
|
||||
std::shared_ptr<Participant> findParticipant (const std::shared_ptr<const CallSession> &session) const;
|
||||
|
||||
public:
|
||||
/* ConferenceInterface */
|
||||
void addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override;
|
||||
void addParticipants (const std::list<Address> &addresses, const CallSessionParams *params, bool hasMedia) override;
|
||||
bool canHandleParticipants () const override;
|
||||
std::shared_ptr<Participant> findParticipant (const Address &addr) const override;
|
||||
const Address *getConferenceAddress () const override;
|
||||
const Address &getConferenceAddress () const override;
|
||||
int getNbParticipants () const override;
|
||||
std::list<std::shared_ptr<Participant>> getParticipants () const override;
|
||||
const std::string &getSubject () const override;
|
||||
|
|
@ -83,21 +80,19 @@ private:
|
|||
void onResetFirstVideoFrameDecoded (const std::shared_ptr<const CallSession> &session) override;
|
||||
|
||||
protected:
|
||||
explicit Conference (LinphoneCore *core, const Address &myAddress, CallListener *listener = nullptr);
|
||||
explicit Conference (
|
||||
ConferencePrivate &p,
|
||||
LinphoneCore *core,
|
||||
const Address &myAddress,
|
||||
CallListener *listener = nullptr
|
||||
);
|
||||
|
||||
bool isMe (const Address &addr) const ;
|
||||
bool isMe (const Address &addr) const;
|
||||
|
||||
protected:
|
||||
LinphoneCore *core = nullptr;
|
||||
CallListener *callListener = nullptr;
|
||||
|
||||
std::shared_ptr<Participant> activeParticipant;
|
||||
std::shared_ptr<Participant> me;
|
||||
std::list<std::shared_ptr<Participant>> participants;
|
||||
Address conferenceAddress;
|
||||
std::string subject;
|
||||
ConferencePrivate *mPrivate = nullptr;
|
||||
|
||||
private:
|
||||
L_DECLARE_PRIVATE(Conference);
|
||||
L_DISABLE_COPY(Conference);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ string LocalConferenceEventHandlerPrivate::createNotify (ConferenceType confInfo
|
|||
}
|
||||
|
||||
string LocalConferenceEventHandlerPrivate::createNotifyFullState () {
|
||||
string entity = conf->getConferenceAddress()->asStringUriOnly();
|
||||
string entity = conf->getConferenceAddress().asStringUriOnly();
|
||||
string subject = conf->getSubject();
|
||||
ConferenceType confInfo = ConferenceType(entity);
|
||||
UsersType users;
|
||||
|
|
@ -112,7 +112,7 @@ string LocalConferenceEventHandlerPrivate::createNotifyFullState () {
|
|||
}
|
||||
|
||||
string LocalConferenceEventHandlerPrivate::createNotifyParticipantAdded (const Address &addr) {
|
||||
string entity = conf->getConferenceAddress()->asStringUriOnly();
|
||||
string entity = conf->getConferenceAddress().asStringUriOnly();
|
||||
ConferenceType confInfo = ConferenceType(entity);
|
||||
UsersType users;
|
||||
confInfo.setUsers(users);
|
||||
|
|
@ -142,7 +142,7 @@ string LocalConferenceEventHandlerPrivate::createNotifyParticipantAdded (const A
|
|||
}
|
||||
|
||||
string LocalConferenceEventHandlerPrivate::createNotifyParticipantRemoved (const Address &addr) {
|
||||
string entity = conf->getConferenceAddress()->asStringUriOnly();
|
||||
string entity = conf->getConferenceAddress().asStringUriOnly();
|
||||
ConferenceType confInfo = ConferenceType(entity);
|
||||
UsersType users;
|
||||
confInfo.setUsers(users);
|
||||
|
|
@ -156,7 +156,7 @@ string LocalConferenceEventHandlerPrivate::createNotifyParticipantRemoved (const
|
|||
}
|
||||
|
||||
string LocalConferenceEventHandlerPrivate::createNotifyParticipantAdmined (const Address &addr, bool isAdmin) {
|
||||
string entity = conf->getConferenceAddress()->asStringUriOnly();
|
||||
string entity = conf->getConferenceAddress().asStringUriOnly();
|
||||
ConferenceType confInfo = ConferenceType(entity);
|
||||
UsersType users;
|
||||
confInfo.setUsers(users);
|
||||
|
|
@ -173,7 +173,7 @@ string LocalConferenceEventHandlerPrivate::createNotifyParticipantAdmined (const
|
|||
}
|
||||
|
||||
string LocalConferenceEventHandlerPrivate::createNotifySubjectChanged () {
|
||||
string entity = conf->getConferenceAddress()->asStringUriOnly();
|
||||
string entity = conf->getConferenceAddress().asStringUriOnly();
|
||||
string subject = conf->getSubject();
|
||||
ConferenceType confInfo = ConferenceType(entity);
|
||||
ConferenceDescriptionType confDescr = ConferenceDescriptionType();
|
||||
|
|
@ -184,7 +184,7 @@ string LocalConferenceEventHandlerPrivate::createNotifySubjectChanged () {
|
|||
}
|
||||
|
||||
string LocalConferenceEventHandlerPrivate::createNotifyParticipantDeviceAdded (const Address &addr, const Address &gruu) {
|
||||
string entity = conf->getConferenceAddress()->asStringUriOnly();
|
||||
string entity = conf->getConferenceAddress().asStringUriOnly();
|
||||
string subject = conf->getSubject();
|
||||
ConferenceType confInfo = ConferenceType(entity);
|
||||
UsersType users;
|
||||
|
|
@ -209,7 +209,7 @@ string LocalConferenceEventHandlerPrivate::createNotifyParticipantDeviceAdded (c
|
|||
}
|
||||
|
||||
string LocalConferenceEventHandlerPrivate::createNotifyParticipantDeviceRemoved (const Address &addr, const Address &gruu) {
|
||||
string entity = conf->getConferenceAddress()->asStringUriOnly();
|
||||
string entity = conf->getConferenceAddress().asStringUriOnly();
|
||||
string subject = conf->getSubject();
|
||||
ConferenceType confInfo = ConferenceType(entity);
|
||||
UsersType users;
|
||||
|
|
@ -237,7 +237,7 @@ void LocalConferenceEventHandlerPrivate::sendNotify (const string ¬ify, const
|
|||
LinphoneAddress *cAddr = linphone_address_new(addr.asString().c_str());
|
||||
LinphoneEvent *lev = linphone_core_create_notify(core, cAddr, "conference");
|
||||
// Fix the From header to put the chat room URI
|
||||
lev->op->set_from(conf->getConferenceAddress()->asString().c_str());
|
||||
lev->op->set_from(conf->getConferenceAddress().asString().c_str());
|
||||
linphone_address_unref(cAddr);
|
||||
doNotify(notify, lev);
|
||||
}
|
||||
|
|
|
|||
41
src/conference/local-conference-p.h
Normal file
41
src/conference/local-conference-p.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* local-conference-p.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 _LOCAL_CONFERENCE_P_H_
|
||||
#define _LOCAL_CONFERENCE_P_H_
|
||||
|
||||
#include "conference-p.h"
|
||||
#include "local-conference.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class LocalConferenceEventHandler;
|
||||
|
||||
class LocalConferencePrivate : public ConferencePrivate {
|
||||
private:
|
||||
std::unique_ptr<LocalConferenceEventHandler> eventHandler;
|
||||
|
||||
L_DECLARE_PUBLIC(LocalConference);
|
||||
};
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _LOCAL_CONFERENCE_P_H_
|
||||
|
|
@ -17,42 +17,41 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "local-conference.h"
|
||||
#include "local-conference-event-handler.h"
|
||||
#include "local-conference-p.h"
|
||||
#include "participant-p.h"
|
||||
#include "xml/resource-lists.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
using namespace std;
|
||||
using namespace LinphonePrivate::Xsd::ResourceLists;
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LocalConference::LocalConference (LinphoneCore *core, const Address &myAddress, CallListener *listener)
|
||||
: Conference(core, myAddress, listener) {
|
||||
eventHandler = new LocalConferenceEventHandler(core, this);
|
||||
}
|
||||
|
||||
LocalConference::~LocalConference () {
|
||||
delete eventHandler;
|
||||
: Conference(*new LocalConferencePrivate, core, myAddress, listener) {
|
||||
L_D();
|
||||
d->eventHandler.reset(new LocalConferenceEventHandler(core, this));
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void LocalConference::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) {
|
||||
L_D();
|
||||
shared_ptr<Participant> participant = findParticipant(addr);
|
||||
if (participant)
|
||||
return;
|
||||
participant = ObjectFactory::create<Participant>(addr);
|
||||
participants.push_back(participant);
|
||||
if (!activeParticipant)
|
||||
activeParticipant = participant;
|
||||
d->participants.push_back(participant);
|
||||
if (!d->activeParticipant)
|
||||
d->activeParticipant = participant;
|
||||
}
|
||||
|
||||
void LocalConference::removeParticipant (const shared_ptr<const Participant> &participant) {
|
||||
for (const auto &p : participants) {
|
||||
L_D();
|
||||
for (const auto &p : d->participants) {
|
||||
if (participant->getAddress() == p->getAddress()) {
|
||||
participants.remove(p);
|
||||
d->participants.remove(p);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -60,7 +59,10 @@ void LocalConference::removeParticipant (const shared_ptr<const Participant> &pa
|
|||
|
||||
list<Address> LocalConference::parseResourceLists (string xmlBody) {
|
||||
istringstream data(xmlBody);
|
||||
unique_ptr<ResourceLists> rl = LinphonePrivate::Xsd::ResourceLists::parseResourceLists(data, Xsd::XmlSchema::Flags::dont_validate);
|
||||
unique_ptr<Xsd::ResourceLists::ResourceLists> rl = LinphonePrivate::Xsd::ResourceLists::parseResourceLists(
|
||||
data,
|
||||
Xsd::XmlSchema::Flags::dont_validate
|
||||
);
|
||||
list<Address> addresses = list<Address>();
|
||||
for (const auto &l : rl->getList()) {
|
||||
for (const auto &entry : l.getEntry()) {
|
||||
|
|
|
|||
|
|
@ -21,30 +21,25 @@
|
|||
#define _LOCAL_CONFERENCE_H_
|
||||
|
||||
#include "conference.h"
|
||||
#include "local-conference-event-handler.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class LocalConferencePrivate;
|
||||
|
||||
class LocalConference : public Conference {
|
||||
public:
|
||||
LocalConference (LinphoneCore *core, const Address &myAddress, CallListener *listener = nullptr);
|
||||
virtual ~LocalConference();
|
||||
|
||||
LocalConferenceEventHandler * getEventHandler() const { return eventHandler; }
|
||||
|
||||
public:
|
||||
/* ConferenceInterface */
|
||||
void addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override;
|
||||
void removeParticipant (const std::shared_ptr<const Participant> &participant) override;
|
||||
|
||||
std::list<Address> parseResourceLists (std::string xmlBody);
|
||||
|
||||
protected:
|
||||
LocalConferenceEventHandler *eventHandler = nullptr;
|
||||
|
||||
private:
|
||||
L_DECLARE_PRIVATE(LocalConference);
|
||||
L_DISABLE_COPY(LocalConference);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -20,14 +20,19 @@
|
|||
#ifndef _REMOTE_CONFERENCE_EVENT_HANDLER_P_H_
|
||||
#define _REMOTE_CONFERENCE_EVENT_HANDLER_P_H_
|
||||
|
||||
#include "address/address.h"
|
||||
#include "object/object-p.h"
|
||||
#include "remote-conference-event-handler.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class RemoteConferenceEventHandlerPrivate : public ObjectPrivate {
|
||||
public:
|
||||
inline unsigned int getLastNotify () const { return lastNotify; };
|
||||
inline unsigned int getLastNotify () const {
|
||||
return lastNotify;
|
||||
};
|
||||
|
||||
private:
|
||||
LinphoneCore *core = nullptr;
|
||||
|
|
@ -41,4 +46,4 @@ private:
|
|||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _REMOTE_CONFERENCE_EVENT_HANDLER_P_H_
|
||||
#endif // ifndef _REMOTE_CONFERENCE_EVENT_HANDLER_P_H_
|
||||
|
|
|
|||
43
src/conference/remote-conference-p.h
Normal file
43
src/conference/remote-conference-p.h
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* remote-conference-p.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 _REMOTE_CONFERENCE_P_H_
|
||||
#define _REMOTE_CONFERENCE_P_H_
|
||||
|
||||
#include "conference-p.h"
|
||||
#include "remote-conference.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class RemoteConferenceEventHandler;
|
||||
|
||||
class RemoteConferencePrivate : public ConferencePrivate {
|
||||
public:
|
||||
std::shared_ptr<Participant> focus;
|
||||
std::unique_ptr<RemoteConferenceEventHandler> eventHandler;
|
||||
|
||||
private:
|
||||
L_DECLARE_PUBLIC(RemoteConference);
|
||||
};
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _REMOTE_CONFERENCE_P_H_
|
||||
|
|
@ -17,57 +17,59 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "remote-conference.h"
|
||||
#include "participant-p.h"
|
||||
#include "remote-conference-event-handler.h"
|
||||
#include "remote-conference-p.h"
|
||||
#include "xml/resource-lists.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace LinphonePrivate::Xsd::ResourceLists;
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
// =============================================================================
|
||||
|
||||
using namespace std;
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
RemoteConference::RemoteConference (LinphoneCore *core, const Address &myAddress, CallListener *listener)
|
||||
: Conference(core, myAddress, listener) {
|
||||
eventHandler = new RemoteConferenceEventHandler(core, this);
|
||||
: Conference(*new RemoteConferencePrivate, core, myAddress, listener) {
|
||||
L_D();
|
||||
d->eventHandler.reset(new RemoteConferenceEventHandler(core, this));
|
||||
}
|
||||
|
||||
RemoteConference::~RemoteConference () {
|
||||
eventHandler->unsubscribe();
|
||||
delete eventHandler;
|
||||
L_D();
|
||||
d->eventHandler->unsubscribe();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void RemoteConference::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) {
|
||||
L_D();
|
||||
shared_ptr<Participant> participant = findParticipant(addr);
|
||||
if (participant)
|
||||
return;
|
||||
participant = ObjectFactory::create<Participant>(addr);
|
||||
participant->getPrivate()->createSession(*this, params, hasMedia, this);
|
||||
participants.push_back(participant);
|
||||
if (!activeParticipant)
|
||||
activeParticipant = participant;
|
||||
d->participants.push_back(participant);
|
||||
if (!d->activeParticipant)
|
||||
d->activeParticipant = participant;
|
||||
}
|
||||
|
||||
void RemoteConference::removeParticipant (const shared_ptr<const Participant> &participant) {
|
||||
for (const auto &p : participants) {
|
||||
L_D();
|
||||
for (const auto &p : d->participants) {
|
||||
if (participant->getAddress() == p->getAddress()) {
|
||||
participants.remove(p);
|
||||
d->participants.remove(p);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string RemoteConference::getResourceLists (const list<Address> &addresses) const {
|
||||
ResourceLists rl = ResourceLists();
|
||||
ListType l = ListType();
|
||||
Xsd::ResourceLists::ResourceLists rl = Xsd::ResourceLists::ResourceLists();
|
||||
Xsd::ResourceLists::ListType l = Xsd::ResourceLists::ListType();
|
||||
for (const auto &addr : addresses) {
|
||||
EntryType entry = EntryType(addr.asStringUriOnly());
|
||||
Xsd::ResourceLists::EntryType entry = Xsd::ResourceLists::EntryType(addr.asStringUriOnly());
|
||||
if (!addr.getDisplayName().empty())
|
||||
entry.setDisplayName(DisplayName(addr.getDisplayName()));
|
||||
entry.setDisplayName(Xsd::ResourceLists::DisplayName(addr.getDisplayName()));
|
||||
l.getEntry().push_back(entry);
|
||||
}
|
||||
rl.getList().push_back(l);
|
||||
|
|
@ -83,7 +85,8 @@ string RemoteConference::getResourceLists (const list<Address> &addresses) const
|
|||
void RemoteConference::onConferenceCreated (const Address &addr) {}
|
||||
|
||||
void RemoteConference::onConferenceTerminated (const Address &addr) {
|
||||
eventHandler->unsubscribe();
|
||||
L_D();
|
||||
d->eventHandler->unsubscribe();
|
||||
}
|
||||
|
||||
void RemoteConference::onParticipantAdded (const Address &addr) {}
|
||||
|
|
|
|||
|
|
@ -20,22 +20,22 @@
|
|||
#ifndef _REMOTE_CONFERENCE_H_
|
||||
#define _REMOTE_CONFERENCE_H_
|
||||
|
||||
#include "conference-listener.h"
|
||||
#include "conference.h"
|
||||
#include "remote-conference-event-handler.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class RemoteConferencePrivate;
|
||||
|
||||
class LINPHONE_PUBLIC RemoteConference : public Conference, public ConferenceListener {
|
||||
friend class ClientGroupChatRoomPrivate;
|
||||
|
||||
public:
|
||||
RemoteConference (LinphoneCore *core, const Address &myAddress, CallListener *listener = nullptr);
|
||||
virtual ~RemoteConference();
|
||||
|
||||
protected:
|
||||
std::shared_ptr<Participant> focus;
|
||||
|
||||
public:
|
||||
/* ConferenceInterface */
|
||||
void addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override;
|
||||
void removeParticipant (const std::shared_ptr<const Participant> &participant) override;
|
||||
|
|
@ -53,10 +53,8 @@ protected:
|
|||
void onParticipantDeviceAdded (const Address &addr, const Address &gruu) override;
|
||||
void onParticipantDeviceRemoved (const Address &addr, const Address &gruu) override;
|
||||
|
||||
protected:
|
||||
RemoteConferenceEventHandler *eventHandler = nullptr;
|
||||
|
||||
private:
|
||||
L_DECLARE_PRIVATE(RemoteConference);
|
||||
L_DISABLE_COPY(RemoteConference);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -19,14 +19,15 @@
|
|||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "linphone/core.h"
|
||||
#include "private.h"
|
||||
#include "liblinphone_tester.h"
|
||||
#include "conference/conference-listener.h"
|
||||
#include "conference/local-conference.h"
|
||||
#include "conference/local-conference-event-handler-p.h"
|
||||
#include "conference/local-conference-p.h"
|
||||
#include "conference/local-conference.h"
|
||||
#include "conference/participant-p.h"
|
||||
#include "conference/remote-conference-event-handler-p.h"
|
||||
#include "liblinphone_tester.h"
|
||||
#include "linphone/core.h"
|
||||
#include "private.h"
|
||||
#include "tools/private-access.h"
|
||||
#include "tools/tester.h"
|
||||
|
||||
|
|
@ -431,14 +432,12 @@ static const char *participant_unadmined_notify = \
|
|||
" </users>"\
|
||||
" </conference-info>";
|
||||
|
||||
|
||||
static const char *bobUri = "sip:bob@example.com";
|
||||
static const char *aliceUri = "sip:alice@example.com";
|
||||
static const char *frankUri = "sip:frank@example.com";
|
||||
static const char *confUri = "sips:conf233@example.com";
|
||||
|
||||
L_ENABLE_ATTR_ACCESS(RemoteConferenceEventHandlerPrivate, Address, confAddress);
|
||||
L_ENABLE_ATTR_ACCESS(Conference, Address, conferenceAddress);
|
||||
L_ENABLE_ATTR_ACCESS(LocalConferencePrivate, unique_ptr<LocalConferenceEventHandler>, eventHandler);
|
||||
|
||||
class ConferenceEventTester : public ConferenceListener {
|
||||
public:
|
||||
|
|
@ -518,8 +517,8 @@ void first_notify_parsing() {
|
|||
size_t size = strlen(first_notify) + strlen(confUri);
|
||||
char *notify = new char[size];
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
|
||||
|
||||
snprintf(notify, size, first_notify, confUri);
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
|
|
@ -555,8 +554,7 @@ void first_notify_parsing_wrong_conf() {
|
|||
size_t size = strlen(first_notify) + strlen(confUri);
|
||||
char *notify = new char[size];
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
|
||||
snprintf(notify, size, first_notify, confUri);
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
|
|
@ -587,8 +585,7 @@ void participant_added_parsing() {
|
|||
size_t size2 = strlen(participant_added_notify) + strlen(confUri);
|
||||
char *notify_added = new char[size2];
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
|
||||
snprintf(notify, size, first_notify, confUri);
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
|
|
@ -633,8 +630,7 @@ void participant_not_added_parsing() {
|
|||
size_t size2 = strlen(participant_not_added_notify) + strlen(confUri);
|
||||
char *notify_not_added = new char[size2];
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
|
||||
snprintf(notify, size, first_notify, confUri);
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
|
|
@ -676,8 +672,7 @@ void participant_deleted_parsing() {
|
|||
size_t size2 = strlen(participant_deleted_notify) + strlen(confUri);
|
||||
char *notify_deleted = new char[size2];
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
|
||||
snprintf(notify, size, first_notify, confUri);
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
|
|
@ -719,8 +714,7 @@ void participant_admined_parsing() {
|
|||
size_t size2 = strlen(participant_admined_notify) + strlen(confUri);
|
||||
char *notify_admined = new char[size2];
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
|
||||
snprintf(notify, size, first_notify, confUri);
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
|
|
@ -761,8 +755,7 @@ void participant_unadmined_parsing() {
|
|||
size_t size2 = strlen(participant_unadmined_notify) + strlen(confUri);
|
||||
char *notify_unadmined = new char[size2];
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
|
||||
snprintf(notify, size, first_notify, confUri);
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
|
|
@ -813,12 +806,13 @@ void send_first_notify() {
|
|||
localConf.setSubject("A random test subject");
|
||||
shared_ptr<Participant> alice = localConf.findParticipant(aliceAddr);
|
||||
L_GET_PRIVATE(alice)->setAdmin(true);
|
||||
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(localConf.getEventHandler());
|
||||
L_ATTR_GET(static_cast<Conference &>(localConf), conferenceAddress) = addr;
|
||||
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(
|
||||
L_ATTR_GET(L_GET_PRIVATE(localConf), eventHandler)
|
||||
);
|
||||
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
|
||||
string notify = localHandlerPrivate->createNotifyFullState();
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
BC_ASSERT_STRING_EQUAL(tester.confSubject.c_str(), "A random test subject");
|
||||
|
|
@ -861,12 +855,13 @@ void send_added_notify() {
|
|||
localConf.addParticipant(aliceAddr, ¶ms, false);
|
||||
shared_ptr<Participant> alice = localConf.findParticipant(aliceAddr);
|
||||
L_GET_PRIVATE(alice)->setAdmin(true);
|
||||
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(localConf.getEventHandler());
|
||||
L_ATTR_GET(static_cast<Conference &>(localConf), conferenceAddress) = addr;
|
||||
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(
|
||||
L_ATTR_GET(L_GET_PRIVATE(localConf), eventHandler)
|
||||
);
|
||||
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
|
||||
string notify = localHandlerPrivate->createNotifyFullState();
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
|
||||
|
|
@ -916,12 +911,13 @@ void send_removed_notify() {
|
|||
localConf.addParticipant(aliceAddr, ¶ms, false);
|
||||
shared_ptr<Participant> alice = localConf.findParticipant(aliceAddr);
|
||||
L_GET_PRIVATE(alice)->setAdmin(true);
|
||||
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(localConf.getEventHandler());
|
||||
L_ATTR_GET(static_cast<Conference &>(localConf), conferenceAddress) = addr;
|
||||
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(
|
||||
L_ATTR_GET(L_GET_PRIVATE(localConf), eventHandler)
|
||||
);
|
||||
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
|
||||
string notify = localHandlerPrivate->createNotifyFullState();
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
|
||||
|
|
@ -968,11 +964,13 @@ void send_admined_notify() {
|
|||
localConf.addParticipant(aliceAddr, ¶ms, false);
|
||||
shared_ptr<Participant> alice = localConf.findParticipant(aliceAddr);
|
||||
L_GET_PRIVATE(alice)->setAdmin(true);
|
||||
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(localConf.getEventHandler());
|
||||
L_ATTR_GET(static_cast<Conference &>(localConf), conferenceAddress) = addr;
|
||||
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(
|
||||
L_ATTR_GET(L_GET_PRIVATE(localConf), eventHandler)
|
||||
);
|
||||
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
|
||||
string notify = localHandlerPrivate->createNotifyFullState();
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
|
||||
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
|
||||
|
|
@ -1018,11 +1016,13 @@ void send_unadmined_notify() {
|
|||
localConf.addParticipant(aliceAddr, ¶ms, false);
|
||||
shared_ptr<Participant> alice = localConf.findParticipant(aliceAddr);
|
||||
L_GET_PRIVATE(alice)->setAdmin(true);
|
||||
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(localConf.getEventHandler());
|
||||
L_ATTR_GET(static_cast<Conference &>(localConf), conferenceAddress) = addr;
|
||||
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(
|
||||
L_ATTR_GET(L_GET_PRIVATE(localConf), eventHandler)
|
||||
);
|
||||
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
|
||||
string notify = localHandlerPrivate->createNotifyFullState();
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
|
||||
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
|
||||
|
|
@ -1070,12 +1070,13 @@ void send_subject_changed_notify () {
|
|||
localConf.setSubject("A random test subject");
|
||||
shared_ptr<Participant> alice = localConf.findParticipant(aliceAddr);
|
||||
L_GET_PRIVATE(alice)->setAdmin(true);
|
||||
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(localConf.getEventHandler());
|
||||
L_ATTR_GET(static_cast<Conference &>(localConf), conferenceAddress) = addr;
|
||||
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(
|
||||
L_ATTR_GET(L_GET_PRIVATE(localConf), eventHandler)
|
||||
);
|
||||
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
|
||||
string notify = localHandlerPrivate->createNotifyFullState();
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
BC_ASSERT_STRING_EQUAL(tester.confSubject.c_str(), "A random test subject");
|
||||
|
|
@ -1124,12 +1125,13 @@ void send_device_added_notify() {
|
|||
localConf.addParticipant(aliceAddr, ¶ms, false);
|
||||
shared_ptr<Participant> alice = localConf.findParticipant(aliceAddr);
|
||||
L_GET_PRIVATE(alice)->setAdmin(true);
|
||||
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(localConf.getEventHandler());
|
||||
L_ATTR_GET(static_cast<Conference &>(localConf), conferenceAddress) = addr;
|
||||
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(
|
||||
L_ATTR_GET(L_GET_PRIVATE(localConf), eventHandler)
|
||||
);
|
||||
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
|
||||
string notify = localHandlerPrivate->createNotifyFullState();
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
BC_ASSERT_EQUAL(tester.participantDevices.size(), 2, int, "%d");
|
||||
|
|
@ -1176,12 +1178,13 @@ void send_device_removed_notify() {
|
|||
localConf.setSubject("A random test subject");
|
||||
shared_ptr<Participant> alice = localConf.findParticipant(aliceAddr);
|
||||
L_GET_PRIVATE(alice)->setAdmin(true);
|
||||
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(localConf.getEventHandler());
|
||||
L_ATTR_GET(static_cast<Conference &>(localConf), conferenceAddress) = addr;
|
||||
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(
|
||||
L_ATTR_GET(L_GET_PRIVATE(localConf), eventHandler)
|
||||
);
|
||||
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
|
||||
string notify = localHandlerPrivate->createNotifyFullState();
|
||||
|
||||
RemoteConferenceEventHandlerPrivate *remoteHandlerPrivate = L_GET_PRIVATE(tester.handler);
|
||||
L_ATTR_GET(remoteHandlerPrivate, confAddress) = addr;
|
||||
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
|
||||
tester.handler->notifyReceived(notify);
|
||||
|
||||
BC_ASSERT_EQUAL(tester.participantDevices.size(), 2, int, "%d");
|
||||
|
|
|
|||
|
|
@ -36,9 +36,9 @@ class Tester {
|
|||
public:
|
||||
Tester () = delete;
|
||||
|
||||
template<typename Object>
|
||||
static constexpr decltype(std::declval<Object>().getPrivate()) getPrivate (Object *cppObject) {
|
||||
return cppObject->getPrivate();
|
||||
template<typename T>
|
||||
static constexpr decltype(std::declval<T>().getPrivate()) getPrivate (T *object) {
|
||||
return object->getPrivate();
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue