Commit a17289a0 authored by Ronan's avatar Ronan

feat(Event): add `ConferenceParticipantEvent`

parent 133d58d6
......@@ -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
......
/*
* 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 <http://www.gnu.org/licenses/>.
*/
#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> address;
L_DECLARE_PUBLIC(ConferenceEvent);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _CONFERENCE_EVENT_P_H_
......@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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> address;
};
// -----------------------------------------------------------------------------
ConferenceEvent::ConferenceEvent (Type type, const shared_ptr<Address> &address) : Event(*new ConferenceEventPrivate, type) {
ConferenceEvent::ConferenceEvent (Type type, const shared_ptr<Address> &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> &address)
ConferenceEvent::ConferenceEvent (const ConferenceEvent &src) : ConferenceEvent(src.getType(), src.getAddress()) {}
ConferenceEvent::ConferenceEvent (ConferenceEventPrivate &p, Type type, const shared_ptr<Address> &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) {
......
......@@ -41,7 +41,7 @@ public:
std::shared_ptr<Address> getAddress () const;
protected:
ConferenceEvent (ConferenceEventPrivate &p, Type type);
ConferenceEvent (ConferenceEventPrivate &p, Type type, const std::shared_ptr<Address> &address);
private:
L_DECLARE_PRIVATE(ConferenceEvent);
......
/*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "conference-event-p.h"
#include "conference-participant-event.h"
// =============================================================================
using namespace std;
LINPHONE_BEGIN_NAMESPACE
class ConferenceParticipantEventPrivate : public ConferenceEventPrivate {
public:
shared_ptr<Address> participantAddress;
};
// -----------------------------------------------------------------------------
ConferenceParticipantEvent::ConferenceParticipantEvent (
Type type,
const shared_ptr<Address> &conferenceAddress,
const shared_ptr<Address> &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<Address> ConferenceParticipantEvent::getParticipantAddress () const {
// TODO.
return nullptr;
}
LINPHONE_END_NAMESPACE
/*
* 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 <http://www.gnu.org/licenses/>.
*/
#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<Address> &conferenceAddress,
const std::shared_ptr<Address> &participantAddress
);
ConferenceParticipantEvent (const ConferenceParticipantEvent &src);
ConferenceParticipantEvent &operator= (const ConferenceParticipantEvent &src);
std::shared_ptr<Address> getParticipantAddress () const;
private:
L_DECLARE_PRIVATE(ConferenceParticipantEvent);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _CONFERENCE_PARTICIPANT_EVENT_H_
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