Commit fe37c289 authored by Benjamin REIS's avatar Benjamin REIS

Fix 'Conference event' tester

parent 47da8088
......@@ -56,6 +56,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
conference/conference-listener.h
conference/conference.h
conference/local-conference.h
conference/local-conference-event-handler-p.h
conference/local-conference-event-handler.h
conference/params/call-session-params-p.h
conference/params/call-session-params.h
......@@ -64,6 +65,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
conference/participant-p.h
conference/participant.h
conference/remote-conference.h
conference/remote-conference-event-handler-p.h
conference/remote-conference-event-handler.h
conference/session/call-session-listener.h
conference/session/call-session-p.h
......
/*
* local-conference-event-handler-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_EVENT_HANDLER_P_H_
#define _LOCAL_CONFERENCE_EVENT_HANDLER_P_H_
#include <string>
#include "local-conference-event-handler.h"
#include "object/object-p.h"
LINPHONE_BEGIN_NAMESPACE
class LocalConferenceEventHandlerPrivate : public ObjectPrivate {
public:
void notifyFullState (const std::string &notify, LinphoneEvent *lev);
void notifyAllExcept (const std::string &notify, const Address &addr);
void notifyAll (const std::string &notify);
std::string createNotifyFullState ();
std::string createNotifyParticipantAdded (const Address &addr);
std::string createNotifyParticipantRemoved (const Address &addr);
std::string createNotifyParticipantAdmined (const Address &addr, bool isAdmin);
std::string createNotifySubjectChanged ();
private:
LinphoneCore *core = nullptr;
LocalConference *conf = nullptr;
void sendNotify (const std::string &notify, const Address &addr);
L_DECLARE_PUBLIC(LocalConferenceEventHandler);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _LOCAL_CONFERENCE_EVENT_HANDLER_P_H_
......@@ -19,7 +19,7 @@
#include "conference/local-conference.h"
#include "conference/participant-p.h"
#include "local-conference-event-handler.h"
#include "local-conference-event-handler-p.h"
#include "object/object-p.h"
#include "private.h"
......@@ -34,27 +34,9 @@ LINPHONE_BEGIN_NAMESPACE
using namespace Xsd::ConferenceInfo;
class LocalConferenceEventHandlerPrivate : public ObjectPrivate {
public:
void notifyFullState (string notify, LinphoneEvent *lev);
void notifyAllExcept (string notify, const Address &addr);
void notifyAll (string notify);
string createNotifyFullState ();
string createNotifyParticipantAdded (const Address &addr);
string createNotifyParticipantRemoved (const Address &addr);
string createNotifyParticipantAdmined (const Address &addr, bool isAdmin);
string createNotifySubjectChanged ();
LinphoneCore *core = nullptr;
LocalConference *conf = nullptr;
private:
void sendNotify (string notify, const Address &addr);
};
// -----------------------------------------------------------------------------
static void doNotify (string notify, LinphoneEvent *lev) {
static void doNotify (const string &notify, LinphoneEvent *lev) {
LinphoneContent *content = linphone_core_create_content(lev->lc);
linphone_content_set_buffer(content, notify.c_str(), strlen(notify.c_str()));
linphone_event_notify(lev, content);
......@@ -72,18 +54,18 @@ static string createNotify (ConferenceType confInfo) {
// -----------------------------------------------------------------------------
void LocalConferenceEventHandlerPrivate::notifyFullState (string notify, LinphoneEvent *lev) {
void LocalConferenceEventHandlerPrivate::notifyFullState (const string &notify, LinphoneEvent *lev) {
doNotify(notify, lev);
}
void LocalConferenceEventHandlerPrivate::notifyAllExcept (string notify, const Address &addr) {
void LocalConferenceEventHandlerPrivate::notifyAllExcept (const string &notify, const Address &addr) {
for (const auto &participant : conf->getParticipants()) {
if (participant->getPrivate()->isSubscribedToConferenceEventPackage() && (addr != participant->getAddress()))
sendNotify(notify, addr);
}
}
void LocalConferenceEventHandlerPrivate::notifyAll (string notify) {
void LocalConferenceEventHandlerPrivate::notifyAll (const string &notify) {
for (const auto &participant : conf->getParticipants()) {
if (participant->getPrivate()->isSubscribedToConferenceEventPackage())
sendNotify(notify, participant->getAddress());
......@@ -175,7 +157,7 @@ string LocalConferenceEventHandlerPrivate::createNotifySubjectChanged () {
return(createNotify(confInfo));
}
void LocalConferenceEventHandlerPrivate::sendNotify (string notify, const Address &addr) {
void LocalConferenceEventHandlerPrivate::sendNotify (const string &notify, const Address &addr) {
LinphoneAddress *cAddr = linphone_address_new(addr.asString().c_str());
LinphoneEvent *lev = linphone_core_create_notify(core, cAddr, "conference");
linphone_address_unref(cAddr);
......
......@@ -20,11 +20,8 @@
#ifndef _LOCAL_CONFERENCE_EVENT_HANDLER_H_
#define _LOCAL_CONFERENCE_EVENT_HANDLER_H_
#include <string>
#include "linphone/types.h"
#include "address/address.h"
#include "linphone/types.h"
#include "object/object.h"
LINPHONE_BEGIN_NAMESPACE
......
/*
* remote-conference-event-handler-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_EVENT_HANDLER_P_H_
#define _REMOTE_CONFERENCE_EVENT_HANDLER_P_H_
#include "object/object-p.h"
#include "remote-conference-event-handler.h"
LINPHONE_BEGIN_NAMESPACE
class RemoteConferenceEventHandlerPrivate : public ObjectPrivate {
private:
LinphoneCore *core = nullptr;
ConferenceListener *listener = nullptr;
Address confAddress;
LinphoneEvent *lev = nullptr;
L_DECLARE_PUBLIC(RemoteConferenceEventHandler);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _REMOTE_CONFERENCE_EVENT_HANDLER_P_H_
\ No newline at end of file
......@@ -17,12 +17,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "remote-conference-event-handler.h"
#include "logger/logger.h"
#include "object/object-p.h"
#include "private.h"
#include "logger/logger.h"
#include "remote-conference-event-handler-p.h"
#include "xml/conference-info.h"
// =============================================================================
......@@ -33,14 +30,6 @@ LINPHONE_BEGIN_NAMESPACE
using namespace Xsd::ConferenceInfo;
class RemoteConferenceEventHandlerPrivate : public ObjectPrivate {
public:
LinphoneCore *core = nullptr;
ConferenceListener *listener = nullptr;
Address confAddress;
LinphoneEvent *lev = nullptr;
};
// -----------------------------------------------------------------------------
RemoteConferenceEventHandler::RemoteConferenceEventHandler(LinphoneCore *core, ConferenceListener *listener)
......
......@@ -196,7 +196,7 @@ set(SOURCE_FILES_C
set(SOURCE_FILES_CXX
clonable-object-tester.cpp
# conference-event-tester.cpp
conference-event-tester.cpp
conference-tester.cpp
cpim-tester.cpp
multipart-tester.cpp
......
This diff is collapsed.
......@@ -563,7 +563,7 @@ void liblinphone_tester_add_suites() {
bc_tester_add_suite(&account_creator_test_suite);
bc_tester_add_suite(&stun_test_suite);
bc_tester_add_suite(&event_test_suite);
//bc_tester_add_suite(&conference_event_test_suite);
bc_tester_add_suite(&conference_event_test_suite);
bc_tester_add_suite(&conference_test_suite);
bc_tester_add_suite(&flexisip_test_suite);
bc_tester_add_suite(&remote_provisioning_test_suite);
......
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