mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
Change getId() to getConferenceAddress() in the conference interface.
This commit is contained in:
parent
68b9c2f425
commit
b5c4007d59
13 changed files with 37 additions and 30 deletions
|
|
@ -262,11 +262,11 @@ LINPHONE_PUBLIC void linphone_chat_room_add_participants (LinphoneChatRoom *cr,
|
|||
LINPHONE_PUBLIC bool_t linphone_chat_room_can_handle_participants (const LinphoneChatRoom *cr);
|
||||
|
||||
/**
|
||||
* Get the conference ID of the chat room.
|
||||
* Get the conference address of the chat room.
|
||||
* @param[in] cr A LinphoneChatRoom object
|
||||
* @return The conference ID of the chat room or NULL if this type of chat room is not conference based
|
||||
* @return The conference address of the chat room or NULL if this type of chat room is not conference based
|
||||
*/
|
||||
LINPHONE_PUBLIC const char * linphone_chat_room_get_id (const LinphoneChatRoom *cr);
|
||||
LINPHONE_PUBLIC const LinphoneAddress *linphone_chat_room_get_conference_address (const LinphoneChatRoom *cr);
|
||||
|
||||
/**
|
||||
* Get the number of participants in the chat room (that is without ourselves).
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ L_DECLARE_C_OBJECT_IMPL_WITH_XTORS(
|
|||
ChatRoom,
|
||||
_linphone_chat_room_constructor, _linphone_chat_room_destructor,
|
||||
LinphoneChatRoomCbs *cbs;
|
||||
mutable LinphoneAddress *conferenceAddressCache;
|
||||
LinphoneAddress *peerAddressCache;
|
||||
)
|
||||
|
||||
|
|
@ -48,6 +49,10 @@ static void _linphone_chat_room_constructor (LinphoneChatRoom *cr) {
|
|||
static void _linphone_chat_room_destructor (LinphoneChatRoom *cr) {
|
||||
linphone_chat_room_cbs_unref(cr->cbs);
|
||||
cr->cbs = nullptr;
|
||||
if (cr->conferenceAddressCache) {
|
||||
linphone_address_unref(cr->conferenceAddressCache);
|
||||
cr->conferenceAddressCache = nullptr;
|
||||
}
|
||||
if (cr->peerAddressCache) {
|
||||
linphone_address_unref(cr->peerAddressCache);
|
||||
cr->peerAddressCache = nullptr;
|
||||
|
|
@ -220,9 +225,16 @@ bool_t linphone_chat_room_can_handle_participants (const LinphoneChatRoom *cr) {
|
|||
return L_GET_CPP_PTR_FROM_C_OBJECT(cr)->canHandleParticipants();
|
||||
}
|
||||
|
||||
const char *linphone_chat_room_get_id (const LinphoneChatRoom *cr) {
|
||||
string id = L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getId();
|
||||
return id.empty() ? nullptr : id.c_str();
|
||||
const LinphoneAddress *linphone_chat_room_get_conference_address (const LinphoneChatRoom *cr) {
|
||||
if (cr->conferenceAddressCache) {
|
||||
linphone_address_unref(cr->conferenceAddressCache);
|
||||
}
|
||||
auto addr = L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getConferenceAddress();
|
||||
if (addr)
|
||||
cr->conferenceAddressCache = linphone_address_new(addr->asString().c_str());
|
||||
else
|
||||
cr->conferenceAddressCache = nullptr;
|
||||
return cr->conferenceAddressCache;
|
||||
}
|
||||
|
||||
int linphone_chat_room_get_nb_participants (const LinphoneChatRoom *cr) {
|
||||
|
|
|
|||
|
|
@ -35,8 +35,6 @@ public:
|
|||
virtual ~BasicChatRoomPrivate () = default;
|
||||
|
||||
private:
|
||||
std::string dummyConferenceId;
|
||||
|
||||
L_DECLARE_PUBLIC(BasicChatRoom);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -48,10 +48,9 @@ bool BasicChatRoom::canHandleParticipants () const {
|
|||
return false;
|
||||
}
|
||||
|
||||
const string& BasicChatRoom::getId () const {
|
||||
L_D(const BasicChatRoom);
|
||||
lError() << "a BasicChatRoom does not have a conference id";
|
||||
return d->dummyConferenceId;
|
||||
const Address *BasicChatRoom::getConferenceAddress () const {
|
||||
lError() << "a BasicChatRoom does not have a conference address";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int BasicChatRoom::getNbParticipants () const {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public:
|
|||
std::shared_ptr<Participant> 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 std::string &getId () const override;
|
||||
const Address *getConferenceAddress () const override;
|
||||
int getNbParticipants () const override;
|
||||
std::list<std::shared_ptr<Participant>> getParticipants () const override;
|
||||
void removeParticipant (const std::shared_ptr<const Participant> &participant) override;
|
||||
|
|
|
|||
|
|
@ -77,8 +77,8 @@ bool ClientGroupChatRoom::canHandleParticipants () const {
|
|||
return RemoteConference::canHandleParticipants();
|
||||
}
|
||||
|
||||
const string& ClientGroupChatRoom::getId () const {
|
||||
return RemoteConference::getId();
|
||||
const Address *ClientGroupChatRoom::getConferenceAddress () const {
|
||||
return RemoteConference::getConferenceAddress();
|
||||
}
|
||||
|
||||
int ClientGroupChatRoom::getNbParticipants () const {
|
||||
|
|
@ -101,6 +101,7 @@ void ClientGroupChatRoom::removeParticipants (const list<shared_ptr<Participant>
|
|||
|
||||
void ClientGroupChatRoom::onConferenceCreated (const Address &addr) {
|
||||
L_D(ClientGroupChatRoom);
|
||||
conferenceAddress = addr;
|
||||
d->setState(ChatRoom::State::Created);
|
||||
}
|
||||
|
||||
|
|
@ -156,8 +157,8 @@ void ClientGroupChatRoom::onParticipantSetAdmin (const Address &addr, bool isAdm
|
|||
|
||||
void ClientGroupChatRoom::onCallSessionStateChanged (const CallSession &session, LinphoneCallState state, const string &message) {
|
||||
if (state == LinphoneCallConnected) {
|
||||
// TODO: Get the conference ID instead of the remote address
|
||||
onConferenceCreated(session.getRemoteAddress());
|
||||
Address addr(session.getRemoteContact());
|
||||
onConferenceCreated(addr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public:
|
|||
std::shared_ptr<Participant> 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 std::string& getId () const override;
|
||||
const Address *getConferenceAddress () const override;
|
||||
int getNbParticipants () const override;
|
||||
std::list<std::shared_ptr<Participant>> getParticipants () const override;
|
||||
void removeParticipant (const std::shared_ptr<const Participant> &participant) override;
|
||||
|
|
|
|||
|
|
@ -46,8 +46,6 @@ public:
|
|||
LinphoneChatMessage *pendingMessage = nullptr;
|
||||
|
||||
private:
|
||||
std::string dummyConferenceId;
|
||||
|
||||
L_DECLARE_PUBLIC(RealTimeTextChatRoom);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -152,10 +152,9 @@ bool RealTimeTextChatRoom::canHandleParticipants () const {
|
|||
return false;
|
||||
}
|
||||
|
||||
const string& RealTimeTextChatRoom::getId () const {
|
||||
L_D(const RealTimeTextChatRoom);
|
||||
lError() << "a RealTimeTextChatRoom does not have a conference id";
|
||||
return d->dummyConferenceId;
|
||||
const Address *RealTimeTextChatRoom::getConferenceAddress () const {
|
||||
lError() << "a RealTimeTextChatRoom does not have a conference address";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int RealTimeTextChatRoom::getNbParticipants () const {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public:
|
|||
std::shared_ptr<Participant> 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 std::string& getId () const override;
|
||||
const Address *getConferenceAddress () const override;
|
||||
int getNbParticipants () const override;
|
||||
std::list<std::shared_ptr<Participant>> getParticipants () const override;
|
||||
void removeParticipant (const std::shared_ptr<const Participant> &participant) override;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public:
|
|||
virtual std::shared_ptr<Participant> 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 std::string& getId () const = 0;
|
||||
virtual const Address *getConferenceAddress () const = 0;
|
||||
virtual int getNbParticipants () const = 0;
|
||||
virtual std::list<std::shared_ptr<Participant>> getParticipants () const = 0;
|
||||
virtual void removeParticipant (const std::shared_ptr<const Participant> &participant) = 0;
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ bool Conference::canHandleParticipants () const {
|
|||
return true;
|
||||
}
|
||||
|
||||
const string& Conference::getId () const {
|
||||
return id;
|
||||
const Address *Conference::getConferenceAddress () const {
|
||||
return &conferenceAddress;
|
||||
}
|
||||
|
||||
int Conference::getNbParticipants () const {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public:
|
|||
std::shared_ptr<Participant> 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 std::string& getId () const override;
|
||||
const Address *getConferenceAddress () const override;
|
||||
int getNbParticipants () const override;
|
||||
std::list<std::shared_ptr<Participant>> getParticipants () const override;
|
||||
void removeParticipant (const std::shared_ptr<const Participant> &participant) override;
|
||||
|
|
@ -85,7 +85,7 @@ protected:
|
|||
std::shared_ptr<Participant> activeParticipant;
|
||||
std::shared_ptr<Participant> me;
|
||||
std::list<std::shared_ptr<Participant>> participants;
|
||||
std::string id;
|
||||
Address conferenceAddress;
|
||||
|
||||
private:
|
||||
L_DISABLE_COPY(Conference);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue