mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 12:38:09 +00:00
Do not return a Participant in the addParticipant() method of the conference interface because the addition can be done asynchronously.
This commit is contained in:
parent
181d14d774
commit
4eb16ce346
16 changed files with 23 additions and 30 deletions
|
|
@ -242,9 +242,8 @@ LINPHONE_PUBLIC LinphoneChatRoomState linphone_chat_room_get_state (const Linpho
|
|||
* Use linphone_chat_room_can_handle_participants() to know if this chat room handles participants.
|
||||
* @param[in] cr A LinphoneChatRoom object
|
||||
* @param[in] addr The address of the participant to add to the chat room
|
||||
* @return The newly added participant or NULL in case of failure
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneParticipant * linphone_chat_room_add_participant (LinphoneChatRoom *cr, const LinphoneAddress *addr);
|
||||
LINPHONE_PUBLIC void linphone_chat_room_add_participant (LinphoneChatRoom *cr, const LinphoneAddress *addr);
|
||||
|
||||
/**
|
||||
* Add several participants to a chat room at once. This may fail if this type of chat room does not handle participants.
|
||||
|
|
|
|||
|
|
@ -211,10 +211,8 @@ LinphoneChatRoomState linphone_chat_room_get_state (const LinphoneChatRoom *cr)
|
|||
return (LinphoneChatRoomState)L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getState();
|
||||
}
|
||||
|
||||
LinphoneParticipant *linphone_chat_room_add_participant (LinphoneChatRoom *cr, const LinphoneAddress *addr) {
|
||||
return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(cr)->addParticipant(
|
||||
*L_GET_CPP_PTR_FROM_C_OBJECT(addr), nullptr, false)
|
||||
);
|
||||
void linphone_chat_room_add_participant (LinphoneChatRoom *cr, const LinphoneAddress *addr) {
|
||||
L_GET_CPP_PTR_FROM_C_OBJECT(cr)->addParticipant(*L_GET_CPP_PTR_FROM_C_OBJECT(addr), nullptr, false);
|
||||
}
|
||||
|
||||
void linphone_chat_room_add_participants (LinphoneChatRoom *cr, const bctbx_list_t *addresses) {
|
||||
|
|
|
|||
|
|
@ -231,7 +231,8 @@ Call::Call (
|
|||
d->conference = new LocalConference(core, *myAddress, d);
|
||||
}
|
||||
const Address *remoteAddress = (direction == LinphoneCallIncoming) ? &from : &to;
|
||||
shared_ptr<Participant> participant = d->conference->addParticipant(*remoteAddress, msp, true);
|
||||
d->conference->addParticipant(*remoteAddress, msp, true);
|
||||
shared_ptr<Participant> participant = d->conference->getParticipants().front();
|
||||
participant->getPrivate()->getSession()->configure(direction, cfg, op, from, to);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,9 +35,8 @@ BasicChatRoom::BasicChatRoom (LinphoneCore *core, const Address &peerAddress) :
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
shared_ptr<Participant> BasicChatRoom::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) {
|
||||
void BasicChatRoom::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) {
|
||||
lError() << "addParticipant() is not allowed on a BasicChatRoom";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void BasicChatRoom::addParticipants (const list<Address> &addresses, const CallSessionParams *params, bool hasMedia) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public:
|
|||
virtual ~BasicChatRoom () = default;
|
||||
|
||||
/* ConferenceInterface. */
|
||||
std::shared_ptr<Participant> addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override;
|
||||
void addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override;
|
||||
void addParticipants (const std::list<Address> &addresses, const CallSessionParams *params, bool hasMedia) override;
|
||||
bool canHandleParticipants () const override;
|
||||
const Address *getConferenceAddress () const override;
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@ ClientGroupChatRoom::ClientGroupChatRoom (LinphoneCore *core, const Address &me,
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
shared_ptr<Participant> ClientGroupChatRoom::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) {
|
||||
activeParticipant = ObjectFactory::create<Participant>(addr);
|
||||
activeParticipant->getPrivate()->createSession(*this, params, hasMedia, this);
|
||||
return activeParticipant;
|
||||
void ClientGroupChatRoom::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) {
|
||||
list<Address> addresses;
|
||||
addresses.push_back(addr);
|
||||
addParticipants(addresses, params, hasMedia);
|
||||
}
|
||||
|
||||
void ClientGroupChatRoom::addParticipants (const list<Address> &addresses, const CallSessionParams *params, bool hasMedia) {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public:
|
|||
|
||||
public:
|
||||
/* ConferenceInterface */
|
||||
std::shared_ptr<Participant> addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override;
|
||||
void addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override;
|
||||
void addParticipants (const std::list<Address> &addresses, const CallSessionParams *params, bool hasMedia) override;
|
||||
bool canHandleParticipants () const override;
|
||||
const Address *getConferenceAddress () const override;
|
||||
|
|
|
|||
|
|
@ -131,9 +131,8 @@ LinphoneCall *RealTimeTextChatRoom::getCall () const {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
shared_ptr<Participant> RealTimeTextChatRoom::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) {
|
||||
void RealTimeTextChatRoom::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) {
|
||||
lError() << "addParticipant() is not allowed on a RealTimeTextChatRoom";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void RealTimeTextChatRoom::addParticipants (const list<Address> &addresses, const CallSessionParams *params, bool hasMedia) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public:
|
|||
LinphoneCall *getCall () const;
|
||||
|
||||
/* ConferenceInterface */
|
||||
std::shared_ptr<Participant> addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override;
|
||||
void addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override;
|
||||
void addParticipants (const std::list<Address> &addresses, const CallSessionParams *params, bool hasMedia) override;
|
||||
bool canHandleParticipants () const override;
|
||||
const Address *getConferenceAddress () const override;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class LINPHONE_PUBLIC ConferenceInterface {
|
|||
public:
|
||||
virtual ~ConferenceInterface() = default;
|
||||
|
||||
virtual std::shared_ptr<Participant> addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) = 0;
|
||||
virtual void addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) = 0;
|
||||
virtual void addParticipants (const std::list<Address> &addresses, const CallSessionParams *params, bool hasMedia) = 0;
|
||||
virtual bool canHandleParticipants () const = 0;
|
||||
virtual const Address *getConferenceAddress () const = 0;
|
||||
|
|
|
|||
|
|
@ -40,9 +40,8 @@ shared_ptr<Participant> Conference::getActiveParticipant () const {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
shared_ptr<Participant> Conference::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) {
|
||||
void Conference::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) {
|
||||
lError() << "Conference class does not handle addParticipant() generically";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Conference::addParticipants (const list<Address> &addresses, const CallSessionParams *params, bool hasMedia) {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public:
|
|||
|
||||
public:
|
||||
/* ConferenceInterface */
|
||||
std::shared_ptr<Participant> addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override;
|
||||
void addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override;
|
||||
void addParticipants (const std::list<Address> &addresses, const CallSessionParams *params, bool hasMedia) override;
|
||||
bool canHandleParticipants () const override;
|
||||
const Address *getConferenceAddress () const override;
|
||||
|
|
|
|||
|
|
@ -38,16 +38,15 @@ LocalConference::~LocalConference () {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
shared_ptr<Participant> LocalConference::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) {
|
||||
void LocalConference::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) {
|
||||
shared_ptr<Participant> participant = findParticipant(addr);
|
||||
if (participant)
|
||||
return participant;
|
||||
return;
|
||||
participant = ObjectFactory::create<Participant>(addr);
|
||||
participant->getPrivate()->createSession(*this, params, hasMedia, this);
|
||||
participants.push_back(participant);
|
||||
if (!activeParticipant)
|
||||
activeParticipant = participant;
|
||||
return participant;
|
||||
}
|
||||
|
||||
void LocalConference::removeParticipant (const shared_ptr<const Participant> &participant) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public:
|
|||
|
||||
public:
|
||||
/* ConferenceInterface */
|
||||
std::shared_ptr<Participant> addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override;
|
||||
void addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override;
|
||||
void removeParticipant (const std::shared_ptr<const Participant> &participant) override;
|
||||
|
||||
std::list<Address> parseResourceLists (std::string xmlBody);
|
||||
|
|
|
|||
|
|
@ -39,16 +39,15 @@ RemoteConference::~RemoteConference () {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
shared_ptr<Participant> RemoteConference::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) {
|
||||
void RemoteConference::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) {
|
||||
shared_ptr<Participant> participant = findParticipant(addr);
|
||||
if (participant)
|
||||
return participant;
|
||||
return;
|
||||
participant = ObjectFactory::create<Participant>(addr);
|
||||
participant->getPrivate()->createSession(*this, params, hasMedia, this);
|
||||
participants.push_back(participant);
|
||||
if (!activeParticipant)
|
||||
activeParticipant = participant;
|
||||
return participant;
|
||||
}
|
||||
|
||||
void RemoteConference::removeParticipant (const shared_ptr<const Participant> &participant) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ protected:
|
|||
|
||||
public:
|
||||
/* ConferenceInterface */
|
||||
std::shared_ptr<Participant> addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override;
|
||||
void addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override;
|
||||
void removeParticipant (const std::shared_ptr<const Participant> &participant) override;
|
||||
|
||||
std::string getResourceLists (const std::list<Address> &addresses);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue