From 790b948683ebda3d4cc5a577ae6214efba88078b Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 12 Feb 2018 14:44:57 +0100 Subject: [PATCH] Add back pointer to the Participant in a ParticipantDevice. --- src/conference/participant-device.cpp | 5 ++--- src/conference/participant-device.h | 6 +++++- src/conference/participant.cpp | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/conference/participant-device.cpp b/src/conference/participant-device.cpp index ea8b1c7a8..e04ecef3f 100644 --- a/src/conference/participant-device.cpp +++ b/src/conference/participant-device.cpp @@ -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) diff --git a/src/conference/participant-device.h b/src/conference/participant-device.h index 09fa3101c..f1abe8e1e 100644 --- a/src/conference/participant-device.h +++ b/src/conference/participant-device.h @@ -23,6 +23,7 @@ #include #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 getSession () const { return mSession; } inline void setSession (std::shared_ptr 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 mSession; LinphoneEvent *mConferenceSubscribeEvent = nullptr; diff --git a/src/conference/participant.cpp b/src/conference/participant.cpp index f67694d4e..68d6e26f7 100644 --- a/src/conference/participant.cpp +++ b/src/conference/participant.cpp @@ -47,10 +47,11 @@ shared_ptr ParticipantPrivate::createSession ( // ----------------------------------------------------------------------------- shared_ptr ParticipantPrivate::addDevice (const IdentityAddress &gruu) { + L_Q(); shared_ptr device = findDevice(gruu); if (device) return device; - device = make_shared(gruu); + device = make_shared(q, gruu); devices.push_back(device); return device; }