From a17289a013ca1e30d5f33115891ead8922a3290d Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Fri, 25 Aug 2017 14:50:21 +0200 Subject: [PATCH] feat(Event): add `ConferenceParticipantEvent` --- src/CMakeLists.txt | 3 + src/event/conference-event-p.h | 39 ++++++++++++ src/event/conference-event.cpp | 19 +++--- src/event/conference-event.h | 2 +- src/event/conference-participant-event.cpp | 70 ++++++++++++++++++++++ src/event/conference-participant-event.h | 49 +++++++++++++++ 6 files changed, 172 insertions(+), 10 deletions(-) create mode 100644 src/event/conference-event-p.h create mode 100644 src/event/conference-participant-event.cpp create mode 100644 src/event/conference-participant-event.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index aa481ec68..128049d35 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -39,7 +39,9 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES db/provider/db-session.h enums.h event/call-event.h + event/conference-event-p.h event/conference-event.h + event/conference-participant-event.h event/event.h event/message-event.h logger/logger.h @@ -68,6 +70,7 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES db/provider/db-session.cpp event/call-event.cpp event/conference-event.cpp + event/conference-participant-event.cpp event/event.cpp event/message-event.cpp logger/logger.cpp diff --git a/src/event/conference-event-p.h b/src/event/conference-event-p.h new file mode 100644 index 000000000..d4fcd9b65 --- /dev/null +++ b/src/event/conference-event-p.h @@ -0,0 +1,39 @@ +/* + * conference-event-p.h + * Copyright (C) 2017 Belledonne Communications SARL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef _CONFERENCE_EVENT_P_H_ +#define _CONFERENCE_EVENT_P_H_ + +#include "conference-event.h" + +#include "event-p.h" + +// ============================================================================= + +LINPHONE_BEGIN_NAMESPACE + +class ConferenceEventPrivate : public EventPrivate { +private: + std::shared_ptr
address; + + L_DECLARE_PUBLIC(ConferenceEvent); +}; + +LINPHONE_END_NAMESPACE + +#endif // ifndef _CONFERENCE_EVENT_P_H_ diff --git a/src/event/conference-event.cpp b/src/event/conference-event.cpp index e2ae54200..a75d22657 100644 --- a/src/event/conference-event.cpp +++ b/src/event/conference-event.cpp @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -#include "event-p.h" +#include "conference-event-p.h" #include "conference-event.h" @@ -26,14 +26,8 @@ using namespace std; LINPHONE_BEGIN_NAMESPACE -class ConferenceEventPrivate : public EventPrivate { -public: - shared_ptr
address; -}; - -// ----------------------------------------------------------------------------- - -ConferenceEvent::ConferenceEvent (Type type, const shared_ptr
&address) : Event(*new ConferenceEventPrivate, type) { +ConferenceEvent::ConferenceEvent (Type type, const shared_ptr
&address) : + Event(*new ConferenceEventPrivate, type) { L_D(ConferenceEvent); L_ASSERT(type == ConferenceCreatedEvent || type == ConferenceDestroyedEvent); L_ASSERT(address); @@ -42,6 +36,13 @@ ConferenceEvent::ConferenceEvent (Type type, const shared_ptr
&address) ConferenceEvent::ConferenceEvent (const ConferenceEvent &src) : ConferenceEvent(src.getType(), src.getAddress()) {} +ConferenceEvent::ConferenceEvent (ConferenceEventPrivate &p, Type type, const shared_ptr
&address) : + Event(p, type) { + L_D(ConferenceEvent); + L_ASSERT(address); + d->address = address; +} + ConferenceEvent &ConferenceEvent::operator= (const ConferenceEvent &src) { L_D(ConferenceEvent); if (this != &src) { diff --git a/src/event/conference-event.h b/src/event/conference-event.h index c063f7ac3..5a499b215 100644 --- a/src/event/conference-event.h +++ b/src/event/conference-event.h @@ -41,7 +41,7 @@ public: std::shared_ptr
getAddress () const; protected: - ConferenceEvent (ConferenceEventPrivate &p, Type type); + ConferenceEvent (ConferenceEventPrivate &p, Type type, const std::shared_ptr
&address); private: L_DECLARE_PRIVATE(ConferenceEvent); diff --git a/src/event/conference-participant-event.cpp b/src/event/conference-participant-event.cpp new file mode 100644 index 000000000..5cb0a1ce7 --- /dev/null +++ b/src/event/conference-participant-event.cpp @@ -0,0 +1,70 @@ +/* + * conference-participant-event.cpp + * Copyright (C) 2017 Belledonne Communications SARL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "conference-event-p.h" + +#include "conference-participant-event.h" + +// ============================================================================= + +using namespace std; + +LINPHONE_BEGIN_NAMESPACE + +class ConferenceParticipantEventPrivate : public ConferenceEventPrivate { +public: + shared_ptr
participantAddress; +}; + +// ----------------------------------------------------------------------------- + +ConferenceParticipantEvent::ConferenceParticipantEvent ( + Type type, + const shared_ptr
&conferenceAddress, + const shared_ptr
&participantAddress +) : ConferenceEvent(*new ConferenceParticipantEventPrivate, type, conferenceAddress) { + L_D(ConferenceParticipantEvent); + L_ASSERT( + type == ConferenceParticipantAddedEvent || + type == ConferenceParticipantRemovedEvent || + type == ConferenceParticipantSetAdminEvent || + type == ConferenceParticipantUnsetAdminEvent + ); + L_ASSERT(participantAddress); + d->participantAddress = participantAddress; +} + +ConferenceParticipantEvent::ConferenceParticipantEvent (const ConferenceParticipantEvent &src) : + ConferenceParticipantEvent(src.getType(), src.getAddress(), src.getParticipantAddress()) {} + +ConferenceParticipantEvent &ConferenceParticipantEvent::operator= (const ConferenceParticipantEvent &src) { + L_D(ConferenceParticipantEvent); + if (this != &src) { + ConferenceEvent::operator=(src); + d->participantAddress = src.getPrivate()->participantAddress; + } + + return *this; +} + +shared_ptr
ConferenceParticipantEvent::getParticipantAddress () const { + // TODO. + return nullptr; +} + +LINPHONE_END_NAMESPACE diff --git a/src/event/conference-participant-event.h b/src/event/conference-participant-event.h new file mode 100644 index 000000000..9b65f1002 --- /dev/null +++ b/src/event/conference-participant-event.h @@ -0,0 +1,49 @@ +/* + * conference-participant-event.h + * Copyright (C) 2017 Belledonne Communications SARL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef _CONFERENCE_PARTICIPANT_EVENT_H_ +#define _CONFERENCE_PARTICIPANT_EVENT_H_ + +#include "conference-event.h" + +// ============================================================================= + +LINPHONE_BEGIN_NAMESPACE + +class ConferenceParticipantEventPrivate; + +class LINPHONE_PUBLIC ConferenceParticipantEvent : public ConferenceEvent { +public: + ConferenceParticipantEvent ( + Type type, + const std::shared_ptr
&conferenceAddress, + const std::shared_ptr
&participantAddress + ); + ConferenceParticipantEvent (const ConferenceParticipantEvent &src); + + ConferenceParticipantEvent &operator= (const ConferenceParticipantEvent &src); + + std::shared_ptr
getParticipantAddress () const; + +private: + L_DECLARE_PRIVATE(ConferenceParticipantEvent); +}; + +LINPHONE_END_NAMESPACE + +#endif // ifndef _CONFERENCE_PARTICIPANT_EVENT_H_