Commit 698a0d52 authored by Ronan's avatar Ronan

feat(c-types): add conference participant event interface

parent b5235a14
......@@ -30,10 +30,26 @@
extern "C" {
#endif
L_DECLARE_C_STRUCT(ConferenceParticipantEvent);
L_DECLARE_C_STRUCT(EventLog);
L_DECLARE_C_STRUCT(Message);
L_DECLARE_C_STRUCT(MessageEvent);
// TODO: Remove me in the future.
typedef struct SalAddress LinphoneAddress;
// -----------------------------------------------------------------------------
// Conference Participant Event.
// -----------------------------------------------------------------------------
LINPHONE_PUBLIC LinphoneConferenceParticipantEvent *conference_participant_event_new (
LinphoneEventLogType type,
const LinphoneAddress *conferenceAddress,
const LinphoneAddress *participantAddress
);
LINPHONE_PUBLIC const LinphoneAddress *conference_participant_event_get_participant_address ();
// -----------------------------------------------------------------------------
// Event log.
// -----------------------------------------------------------------------------
......
......@@ -29,7 +29,7 @@ LINPHONE_BEGIN_NAMESPACE
class ConferenceEventPrivate : public EventLogPrivate {
private:
std::shared_ptr<Address> address;
std::shared_ptr<const Address> address;
L_DECLARE_PUBLIC(ConferenceEvent);
};
......
......@@ -26,20 +26,22 @@ using namespace std;
LINPHONE_BEGIN_NAMESPACE
ConferenceEvent::ConferenceEvent (Type type, const shared_ptr<Address> &address) :
ConferenceEvent::ConferenceEvent (Type type, const shared_ptr<const Address> &address) :
EventLog(*new ConferenceEventPrivate, type) {
L_D(ConferenceEvent);
L_ASSERT(type == ConferenceCreatedEvent || type == ConferenceDestroyedEvent);
L_ASSERT(address);
// TODO: Duplicate address.
d->address = address;
}
ConferenceEvent::ConferenceEvent (const ConferenceEvent &src) : ConferenceEvent(src.getType(), src.getAddress()) {}
ConferenceEvent::ConferenceEvent (ConferenceEventPrivate &p, Type type, const shared_ptr<Address> &address) :
ConferenceEvent::ConferenceEvent (ConferenceEventPrivate &p, Type type, const shared_ptr<const Address> &address) :
EventLog(p, type) {
L_D(ConferenceEvent);
L_ASSERT(address);
// TODO: Duplicate address.
d->address = address;
}
......@@ -47,13 +49,14 @@ ConferenceEvent &ConferenceEvent::operator= (const ConferenceEvent &src) {
L_D(ConferenceEvent);
if (this != &src) {
EventLog::operator=(src);
// TODO: Duplicate address.
d->address = src.getPrivate()->address;
}
return *this;
}
shared_ptr<Address> ConferenceEvent::getAddress () const {
shared_ptr<const Address> ConferenceEvent::getAddress () const {
// TODO.
return nullptr;
}
......
......@@ -32,16 +32,16 @@ class ConferenceEventPrivate;
class LINPHONE_PUBLIC ConferenceEvent : public EventLog {
public:
ConferenceEvent (Type type, const std::shared_ptr<Address> &address);
ConferenceEvent (Type type, const std::shared_ptr<const Address> &address);
ConferenceEvent (const ConferenceEvent &src);
virtual ~ConferenceEvent () = default;
ConferenceEvent &operator= (const ConferenceEvent &src);
std::shared_ptr<Address> getAddress () const;
std::shared_ptr<const Address> getAddress () const;
protected:
ConferenceEvent (ConferenceEventPrivate &p, Type type, const std::shared_ptr<Address> &address);
ConferenceEvent (ConferenceEventPrivate &p, Type type, const std::shared_ptr<const Address> &address);
private:
L_DECLARE_PRIVATE(ConferenceEvent);
......
......@@ -28,15 +28,15 @@ LINPHONE_BEGIN_NAMESPACE
class ConferenceParticipantEventPrivate : public ConferenceEventPrivate {
public:
shared_ptr<Address> participantAddress;
shared_ptr<const Address> participantAddress;
};
// -----------------------------------------------------------------------------
ConferenceParticipantEvent::ConferenceParticipantEvent (
Type type,
const shared_ptr<Address> &conferenceAddress,
const shared_ptr<Address> &participantAddress
const shared_ptr<const Address> &conferenceAddress,
const shared_ptr<const Address> &participantAddress
) : ConferenceEvent(*new ConferenceParticipantEventPrivate, type, conferenceAddress) {
L_D(ConferenceParticipantEvent);
L_ASSERT(
......@@ -46,6 +46,7 @@ ConferenceParticipantEvent::ConferenceParticipantEvent (
type == ConferenceParticipantUnsetAdminEvent
);
L_ASSERT(participantAddress);
// TODO: Duplicate address.
d->participantAddress = participantAddress;
}
......@@ -56,13 +57,14 @@ ConferenceParticipantEvent &ConferenceParticipantEvent::operator= (const Confere
L_D(ConferenceParticipantEvent);
if (this != &src) {
ConferenceEvent::operator=(src);
// TODO: Duplicate address.
d->participantAddress = src.getPrivate()->participantAddress;
}
return *this;
}
shared_ptr<Address> ConferenceParticipantEvent::getParticipantAddress () const {
shared_ptr<const Address> ConferenceParticipantEvent::getParticipantAddress () const {
// TODO.
return nullptr;
}
......
......@@ -31,14 +31,14 @@ class LINPHONE_PUBLIC ConferenceParticipantEvent : public ConferenceEvent {
public:
ConferenceParticipantEvent (
Type type,
const std::shared_ptr<Address> &conferenceAddress,
const std::shared_ptr<Address> &participantAddress
const std::shared_ptr<const Address> &conferenceAddress,
const std::shared_ptr<const Address> &participantAddress
);
ConferenceParticipantEvent (const ConferenceParticipantEvent &src);
ConferenceParticipantEvent &operator= (const ConferenceParticipantEvent &src);
std::shared_ptr<Address> getParticipantAddress () const;
std::shared_ptr<const Address> getParticipantAddress () const;
private:
L_DECLARE_PRIVATE(ConferenceParticipantEvent);
......
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