conference-participant-event.cpp 2.42 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/*
 * 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/>.
 */

Ronan's avatar
Ronan committed
19
#include "address/address.h"
20 21 22 23 24 25 26 27 28 29 30 31
#include "conference-event-p.h"

#include "conference-participant-event.h"

// =============================================================================

using namespace std;

LINPHONE_BEGIN_NAMESPACE

class ConferenceParticipantEventPrivate : public ConferenceEventPrivate {
public:
32
	shared_ptr<const Address> participantAddress;
33 34 35 36 37 38
};

// -----------------------------------------------------------------------------

ConferenceParticipantEvent::ConferenceParticipantEvent (
	Type type,
39 40
	const shared_ptr<const Address> &conferenceAddress,
	const shared_ptr<const Address> &participantAddress
41 42 43
) : ConferenceEvent(*new ConferenceParticipantEventPrivate, type, conferenceAddress) {
	L_D(ConferenceParticipantEvent);
	L_ASSERT(
44 45 46 47
		type == Type::ConferenceParticipantAdded ||
		type == Type::ConferenceParticipantRemoved ||
		type == Type::ConferenceParticipantSetAdmin ||
		type == Type::ConferenceParticipantUnsetAdmin
48 49
	);
	L_ASSERT(participantAddress);
Ronan's avatar
Ronan committed
50
	d->participantAddress = make_shared<Address>(*participantAddress);
51 52 53 54 55 56 57 58 59
}

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);
Ronan's avatar
Ronan committed
60
		d->participantAddress = make_shared<Address>(*src.getPrivate()->participantAddress);
61 62 63 64 65
	}

	return *this;
}

66
shared_ptr<const Address> ConferenceParticipantEvent::getParticipantAddress () const {
Ronan's avatar
Ronan committed
67 68
	L_D(const ConferenceParticipantEvent);
	return d->participantAddress;
69 70 71
}

LINPHONE_END_NAMESPACE