Commit 790b9486 authored by Ghislain MARY's avatar Ghislain MARY

Add back pointer to the Participant in a ParticipantDevice.

parent 2ad51e7a
......@@ -29,9 +29,8 @@ LINPHONE_BEGIN_NAMESPACE
ParticipantDevice::ParticipantDevice () {}
ParticipantDevice::ParticipantDevice (const IdentityAddress &gruu) {
mGruu = gruu;
}
ParticipantDevice::ParticipantDevice (const Participant *participant, const IdentityAddress &gruu)
: mParticipant(participant), mGruu(gruu) {}
ParticipantDevice::~ParticipantDevice () {
if (mConferenceSubscribeEvent)
......
......@@ -23,6 +23,7 @@
#include <string>
#include "address/identity-address.h"
#include "linphone/types.h"
#include "linphone/utils/general.h"
......@@ -31,6 +32,7 @@
LINPHONE_BEGIN_NAMESPACE
class CallSession;
class Participant;
class ParticipantDevice {
public:
......@@ -42,12 +44,13 @@ public:
};
ParticipantDevice ();
explicit ParticipantDevice (const IdentityAddress &gruu);
explicit ParticipantDevice (const Participant *participant, const IdentityAddress &gruu);
virtual ~ParticipantDevice ();
bool operator== (const ParticipantDevice &device) const;
inline const IdentityAddress &getAddress () const { return mGruu; }
const Participant *getParticipant () const { return mParticipant; }
inline std::shared_ptr<CallSession> getSession () const { return mSession; }
inline void setSession (std::shared_ptr<CallSession> session) { mSession = session; }
inline State getState () const { return mState; }
......@@ -60,6 +63,7 @@ public:
bool isValid () const { return mGruu.isValid(); }
private:
const Participant *mParticipant = nullptr;
IdentityAddress mGruu;
std::shared_ptr<CallSession> mSession;
LinphoneEvent *mConferenceSubscribeEvent = nullptr;
......
......@@ -47,10 +47,11 @@ shared_ptr<CallSession> ParticipantPrivate::createSession (
// -----------------------------------------------------------------------------
shared_ptr<ParticipantDevice> ParticipantPrivate::addDevice (const IdentityAddress &gruu) {
L_Q();
shared_ptr<ParticipantDevice> device = findDevice(gruu);
if (device)
return device;
device = make_shared<ParticipantDevice>(gruu);
device = make_shared<ParticipantDevice>(q, gruu);
devices.push_back(device);
return device;
}
......
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