Commit 1ca9d64a authored by Ronan's avatar Ronan
Browse files

feat(core): avoid virtual inheritance of CoreAccessor

parent 6dd6e829
......@@ -30,13 +30,13 @@ using namespace std;
LINPHONE_BEGIN_NAMESPACE
BasicChatRoom::BasicChatRoom (const shared_ptr<Core> &core, const ChatRoomId &chatRoomId) :
BasicChatRoom(*new BasicChatRoomPrivate, core, chatRoomId) {}
ChatRoom(*new BasicChatRoomPrivate, core, chatRoomId) {}
BasicChatRoom::BasicChatRoom (
BasicChatRoomPrivate &p,
const std::shared_ptr<Core> &core,
const ChatRoomId &chatRoomId
) : CoreAccessor(core), ChatRoom(p, core, chatRoomId) {}
) : ChatRoom(p, core, chatRoomId) {}
BasicChatRoom::CapabilitiesMask BasicChatRoom::getCapabilities () const {
return static_cast<CapabilitiesMask>(Capabilities::Basic);
......
......@@ -449,7 +449,7 @@ void ChatRoomPrivate::onIsComposingRefreshNeeded () {
// =============================================================================
ChatRoom::ChatRoom (ChatRoomPrivate &p, const shared_ptr<Core> &core, const ChatRoomId &chatRoomId) :
CoreAccessor(core), Object(p) {
Object(p), CoreAccessor(core) {
L_D();
d->chatRoomId = chatRoomId;
......
......@@ -30,7 +30,7 @@ LINPHONE_BEGIN_NAMESPACE
class ChatRoomPrivate;
class LINPHONE_PUBLIC ChatRoom : public Object, virtual public CoreAccessor, public ConferenceInterface {
class LINPHONE_PUBLIC ChatRoom : public Object, public CoreAccessor, public ConferenceInterface {
friend class Core;
friend class CorePrivate;
friend class ChatMessage;
......
......@@ -81,14 +81,17 @@ ClientGroupChatRoom::ClientGroupChatRoom (
const std::string &factoryUri,
const IdentityAddress &me,
const std::string &subject
) : CoreAccessor(core),
ChatRoom(*new ClientGroupChatRoomPrivate, core, ChatRoomId(IdentityAddress(), me)),
) : ChatRoom(*new ClientGroupChatRoomPrivate, core, ChatRoomId(IdentityAddress(), me)),
RemoteConference(core, me, nullptr) {
L_D_T(RemoteConference, dConference);
dConference->focus = make_shared<Participant>(Address(factoryUri));
RemoteConference::setSubject(subject);
}
shared_ptr<Core> ClientGroupChatRoom::getCore () const {
return ChatRoom::getCore();
}
ClientGroupChatRoom::CapabilitiesMask ClientGroupChatRoom::getCapabilities () const {
return static_cast<CapabilitiesMask>(Capabilities::Conference);
}
......
......@@ -39,6 +39,8 @@ public:
const std::string &subject
);
std::shared_ptr<Core> getCore () const;
CapabilitiesMask getCapabilities () const override;
const Address &getConferenceAddress () const override;
......
......@@ -104,7 +104,7 @@ void RealTimeTextChatRoomPrivate::sendMessage (const shared_ptr<ChatMessage> &ms
// =============================================================================
RealTimeTextChatRoom::RealTimeTextChatRoom (const shared_ptr<Core> &core, const ChatRoomId &chatRoomId) :
CoreAccessor(core), BasicChatRoom(*new RealTimeTextChatRoomPrivate, core, chatRoomId) {}
BasicChatRoom(*new RealTimeTextChatRoomPrivate, core, chatRoomId) {}
RealTimeTextChatRoom::CapabilitiesMask RealTimeTextChatRoom::getCapabilities () const {
return BasicChatRoom::getCapabilities() | static_cast<CapabilitiesMask>(Capabilities::RealTimeText);
......
......@@ -77,7 +77,7 @@ bool ServerGroupChatRoomPrivate::isAdminLeft () const {
// =============================================================================
ServerGroupChatRoom::ServerGroupChatRoom (const shared_ptr<Core> &core, SalCallOp *op) : CoreAccessor(core),
ServerGroupChatRoom::ServerGroupChatRoom (const shared_ptr<Core> &core, SalCallOp *op) :
ChatRoom(*new ServerGroupChatRoomPrivate, core, ChatRoomId(IdentityAddress(op->get_to()), IdentityAddress(op->get_to()))),
LocalConference(core, Address(op->get_to()), nullptr) {}
......
......@@ -37,7 +37,7 @@ class ConferencePrivate;
class LINPHONE_PUBLIC Conference :
public ConferenceInterface,
public CallSessionListener,
virtual public CoreAccessor {
public CoreAccessor {
friend class CallSessionPrivate;
public:
......
......@@ -29,7 +29,7 @@ using namespace std;
LINPHONE_BEGIN_NAMESPACE
LocalConference::LocalConference (const shared_ptr<Core> &core, const Address &myAddress, CallListener *listener)
: CoreAccessor(core), Conference(*new LocalConferencePrivate, core, myAddress, listener) {
: Conference(*new LocalConferencePrivate, core, myAddress, listener) {
L_D();
d->eventHandler.reset(new LocalConferenceEventHandler(this));
}
......
......@@ -32,7 +32,7 @@ RemoteConference::RemoteConference (
const shared_ptr<Core> &core,
const Address &myAddress,
CallListener *listener
) : CoreAccessor(core), Conference(*new RemoteConferencePrivate, core, myAddress, listener) {
) : Conference(*new RemoteConferencePrivate, core, myAddress, listener) {
L_D();
d->eventHandler.reset(new RemoteConferenceEventHandler(this));
}
......
......@@ -19,12 +19,14 @@
#include <map>
#include <string>
#include "address/identity-address.h"
#include "conference/conference-listener.h"
#include "conference/local-conference-event-handler-p.h"
#include "conference/handlers/local-conference-event-handler-p.h"
#include "conference/handlers/remote-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 "conference/remote-conference.h"
#include "liblinphone_tester.h"
#include "linphone/core.h"
#include "private.h"
......@@ -440,7 +442,7 @@ static const char *confUri = "sips:conf233@example.com";
L_ENABLE_ATTR_ACCESS(LocalConferencePrivate, unique_ptr<LocalConferenceEventHandler>, eventHandler);
class ConferenceEventTester : public ConferenceListener {
class ConferenceEventTester : public RemoteConference {
public:
ConferenceEventTester (LinphoneCore *core, const Address &confAddr);
~ConferenceEventTester ();
......@@ -463,8 +465,8 @@ public:
string confSubject;
};
ConferenceEventTester::ConferenceEventTester (LinphoneCore *core, const Address &confAddr) {
handler = new RemoteConferenceEventHandler(core, this);
ConferenceEventTester::ConferenceEventTester (LinphoneCore *core, const Address &confAddr) : RemoteConference(core->cppCore, confAddr) {
handler = new RemoteConferenceEventHandler(this);
}
ConferenceEventTester::~ConferenceEventTester () {
......@@ -533,7 +535,7 @@ void first_notify_parsing() {
size_t size = strlen(first_notify) + strlen(confUri);
char *notify = new char[size];
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
snprintf(notify, size, first_notify, confUri);
tester.handler->notifyReceived(notify);
......@@ -570,7 +572,7 @@ void first_notify_parsing_wrong_conf() {
size_t size = strlen(first_notify) + strlen(confUri);
char *notify = new char[size];
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
snprintf(notify, size, first_notify, confUri);
tester.handler->notifyReceived(notify);
......@@ -601,7 +603,7 @@ void participant_added_parsing() {
size_t size2 = strlen(participant_added_notify) + strlen(confUri);
char *notify_added = new char[size2];
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
snprintf(notify, size, first_notify, confUri);
tester.handler->notifyReceived(notify);
......@@ -646,7 +648,7 @@ void participant_not_added_parsing() {
size_t size2 = strlen(participant_not_added_notify) + strlen(confUri);
char *notify_not_added = new char[size2];
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
snprintf(notify, size, first_notify, confUri);
tester.handler->notifyReceived(notify);
......@@ -688,7 +690,7 @@ void participant_deleted_parsing() {
size_t size2 = strlen(participant_deleted_notify) + strlen(confUri);
char *notify_deleted = new char[size2];
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
snprintf(notify, size, first_notify, confUri);
tester.handler->notifyReceived(notify);
......@@ -730,7 +732,7 @@ void participant_admined_parsing() {
size_t size2 = strlen(participant_admined_notify) + strlen(confUri);
char *notify_admined = new char[size2];
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
snprintf(notify, size, first_notify, confUri);
tester.handler->notifyReceived(notify);
......@@ -771,7 +773,7 @@ void participant_unadmined_parsing() {
size_t size2 = strlen(participant_unadmined_notify) + strlen(confUri);
char *notify_unadmined = new char[size2];
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
snprintf(notify, size, first_notify, confUri);
tester.handler->notifyReceived(notify);
......@@ -804,7 +806,7 @@ void send_first_notify() {
Address addr(identityStr);
bctbx_free(identityStr);
ConferenceEventTester tester(marie->lc, addr);
LocalConference localConf(pauline->lc, addr);
LocalConference localConf(pauline->lc->cppCore, addr);
LinphoneAddress *cBobAddr = linphone_core_interpret_url(marie->lc, bobUri);
char *bobAddrStr = linphone_address_as_string(cBobAddr);
Address bobAddr(bobAddrStr);
......@@ -828,7 +830,7 @@ void send_first_notify() {
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
string notify = localHandlerPrivate->createNotifyFullState();
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
tester.handler->notifyReceived(notify);
BC_ASSERT_STRING_EQUAL(tester.confSubject.c_str(), "A random test subject");
......@@ -849,7 +851,7 @@ void send_added_notify() {
Address addr(identityStr);
bctbx_free(identityStr);
ConferenceEventTester tester(marie->lc, addr);
LocalConference localConf(pauline->lc, addr);
LocalConference localConf(pauline->lc->cppCore, addr);
LinphoneAddress *cBobAddr = linphone_core_interpret_url(marie->lc, bobUri);
char *bobAddrStr = linphone_address_as_string(cBobAddr);
Address bobAddr(bobAddrStr);
......@@ -877,7 +879,7 @@ void send_added_notify() {
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
string notify = localHandlerPrivate->createNotifyFullState();
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
tester.handler->notifyReceived(notify);
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
......@@ -910,7 +912,7 @@ void send_removed_notify() {
Address addr(identityStr);
bctbx_free(identityStr);
ConferenceEventTester tester(marie->lc, addr);
LocalConference localConf(pauline->lc, addr);
LocalConference localConf(pauline->lc->cppCore, addr);
LinphoneAddress *cBobAddr = linphone_core_interpret_url(marie->lc, bobUri);
char *bobAddrStr = linphone_address_as_string(cBobAddr);
Address bobAddr(bobAddrStr);
......@@ -933,7 +935,7 @@ void send_removed_notify() {
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
string notify = localHandlerPrivate->createNotifyFullState();
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
tester.handler->notifyReceived(notify);
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
......@@ -963,7 +965,7 @@ void send_admined_notify() {
Address addr(identityStr);
bctbx_free(identityStr);
ConferenceEventTester tester(marie->lc, addr);
LocalConference localConf(pauline->lc, addr);
LocalConference localConf(pauline->lc->cppCore, addr);
LinphoneAddress *cBobAddr = linphone_core_interpret_url(marie->lc, bobUri);
char *bobAddrStr = linphone_address_as_string(cBobAddr);
Address bobAddr(bobAddrStr);
......@@ -986,7 +988,7 @@ void send_admined_notify() {
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
string notify = localHandlerPrivate->createNotifyFullState();
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
tester.handler->notifyReceived(notify);
BC_ASSERT_EQUAL(tester.participants.size(), 2, int, "%d");
......@@ -1015,7 +1017,7 @@ void send_unadmined_notify() {
Address addr(identityStr);
bctbx_free(identityStr);
ConferenceEventTester tester(marie->lc, addr);
LocalConference localConf(pauline->lc, addr);
LocalConference localConf(pauline->lc->cppCore, addr);
LinphoneAddress *cBobAddr = linphone_core_interpret_url(marie->lc, bobUri);
char *bobAddrStr = linphone_address_as_string(cBobAddr);
Address bobAddr(bobAddrStr);
......@@ -1038,7 +1040,7 @@ void send_unadmined_notify() {
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
string notify = localHandlerPrivate->createNotifyFullState();
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
tester.handler->notifyReceived(notify);
......@@ -1068,7 +1070,7 @@ void send_subject_changed_notify () {
Address addr(identityStr);
bctbx_free(identityStr);
ConferenceEventTester tester(marie->lc, addr);
LocalConference localConf(pauline->lc, addr);
LocalConference localConf(pauline->lc->cppCore, addr);
LinphoneAddress *cBobAddr = linphone_core_interpret_url(marie->lc, bobUri);
char *bobAddrStr = linphone_address_as_string(cBobAddr);
Address bobAddr(bobAddrStr);
......@@ -1092,7 +1094,7 @@ void send_subject_changed_notify () {
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
string notify = localHandlerPrivate->createNotifyFullState();
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
tester.handler->notifyReceived(notify);
BC_ASSERT_STRING_EQUAL(tester.confSubject.c_str(), "A random test subject");
......@@ -1128,7 +1130,7 @@ void send_device_added_notify() {
Address addr(identityStr);
bctbx_free(identityStr);
ConferenceEventTester tester(marie->lc, addr);
LocalConference localConf(pauline->lc, addr);
LocalConference localConf(pauline->lc->cppCore, addr);
LinphoneAddress *cBobAddr = linphone_core_interpret_url(marie->lc, bobUri);
char *bobAddrStr = linphone_address_as_string(cBobAddr);
Address bobAddr(bobAddrStr);
......@@ -1151,7 +1153,7 @@ void send_device_added_notify() {
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
string notify = localHandlerPrivate->createNotifyFullState();
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
tester.handler->notifyReceived(notify);
BC_ASSERT_EQUAL(tester.participantDevices.size(), 2, int, "%d");
......@@ -1180,7 +1182,7 @@ void send_device_removed_notify() {
Address addr(identityStr);
bctbx_free(identityStr);
ConferenceEventTester tester(marie->lc, addr);
LocalConference localConf(pauline->lc, addr);
LocalConference localConf(pauline->lc->cppCore, addr);
LinphoneAddress *cBobAddr = linphone_core_interpret_url(marie->lc, bobUri);
char *bobAddrStr = linphone_address_as_string(cBobAddr);
Address bobAddr(bobAddrStr);
......@@ -1204,7 +1206,7 @@ void send_device_removed_notify() {
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
string notify = localHandlerPrivate->createNotifyFullState();
const_cast<Address &>(tester.handler->getConfAddress()) = addr;
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
tester.handler->notifyReceived(notify);
BC_ASSERT_EQUAL(tester.participantDevices.size(), 2, int, "%d");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment