Use IdentityAddress in conference.

This commit is contained in:
Ghislain MARY 2017-11-21 10:43:20 +01:00
parent 7b3df0c474
commit bb5b22b932
25 changed files with 143 additions and 153 deletions

View file

@ -234,7 +234,11 @@ void linphone_chat_room_add_participant (LinphoneChatRoom *cr, const LinphoneAdd
}
void linphone_chat_room_add_participants (LinphoneChatRoom *cr, const bctbx_list_t *addresses) {
L_GET_CPP_PTR_FROM_C_OBJECT(cr)->addParticipants(L_GET_RESOLVED_CPP_LIST_FROM_C_LIST(addresses, Address), nullptr, false);
list<LinphonePrivate::Address> lAddr = L_GET_RESOLVED_CPP_LIST_FROM_C_LIST(addresses, Address);
list<LinphonePrivate::IdentityAddress> lIdentAddr;
for (const auto &addr : lAddr)
lIdentAddr.push_back(LinphonePrivate::IdentityAddress(addr));
L_GET_CPP_PTR_FROM_C_OBJECT(cr)->addParticipants(lIdentAddr, nullptr, false);
}
bool_t linphone_chat_room_can_handle_participants (const LinphoneChatRoom *cr) {

View file

@ -46,16 +46,16 @@ bool BasicChatRoom::canHandleParticipants () const {
return false;
}
const Address &BasicChatRoom::getConferenceAddress () const {
const IdentityAddress &BasicChatRoom::getConferenceAddress () const {
lError() << "a BasicChatRoom does not have a conference address";
return Utils::getEmptyConstRefObject<Address>();
return Utils::getEmptyConstRefObject<IdentityAddress>();
}
void BasicChatRoom::addParticipant (const Address &, const CallSessionParams *, bool) {
void BasicChatRoom::addParticipant (const IdentityAddress &, const CallSessionParams *, bool) {
lError() << "addParticipant() is not allowed on a BasicChatRoom";
}
void BasicChatRoom::addParticipants (const list<Address> &, const CallSessionParams *, bool) {
void BasicChatRoom::addParticipants (const list<IdentityAddress> &, const CallSessionParams *, bool) {
lError() << "addParticipants() is not allowed on a BasicChatRoom";
}
@ -67,7 +67,7 @@ void BasicChatRoom::removeParticipants (const list<shared_ptr<Participant>> &) {
lError() << "removeParticipants() is not allowed on a BasicChatRoom";
}
shared_ptr<Participant> BasicChatRoom::findParticipant (const Address &) const {
shared_ptr<Participant> BasicChatRoom::findParticipant (const IdentityAddress &) const {
lError() << "findParticipant() is not allowed on a BasicChatRoom";
return nullptr;
}

View file

@ -34,17 +34,17 @@ class LINPHONE_PUBLIC BasicChatRoom : public ChatRoom {
public:
CapabilitiesMask getCapabilities () const override;
const Address &getConferenceAddress () const override;
const IdentityAddress &getConferenceAddress () const override;
bool canHandleParticipants () const 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;
void addParticipant (const IdentityAddress &addr, const CallSessionParams *params, bool hasMedia) override;
void addParticipants (const std::list<IdentityAddress> &addresses, const CallSessionParams *params, bool hasMedia) override;
void removeParticipant (const std::shared_ptr<const Participant> &participant) override;
void removeParticipants (const std::list<std::shared_ptr<Participant>> &participants) override;
std::shared_ptr<Participant> findParticipant (const Address &addr) const override;
std::shared_ptr<Participant> findParticipant (const IdentityAddress &addr) const override;
std::shared_ptr<Participant> getMe () const override;
int getNbParticipants () const override;

View file

@ -31,7 +31,7 @@ class ClientGroupChatRoomPrivate : public ChatRoomPrivate {
public:
ClientGroupChatRoomPrivate () = default;
std::list<Address> cleanAddressesList (const std::list<Address> &addresses) const;
std::list<IdentityAddress> cleanAddressesList (const std::list<IdentityAddress> &addresses) const;
std::shared_ptr<CallSession> createSession ();
void notifyReceived (const std::string &body);
void multipartNotifyReceived (const std::string &body);

View file

@ -39,13 +39,13 @@ LINPHONE_BEGIN_NAMESPACE
// -----------------------------------------------------------------------------
list<Address> ClientGroupChatRoomPrivate::cleanAddressesList (const list<Address> &addresses) const {
list<IdentityAddress> ClientGroupChatRoomPrivate::cleanAddressesList (const list<IdentityAddress> &addresses) const {
L_Q();
list<Address> cleanedList(addresses);
list<IdentityAddress> cleanedList(addresses);
cleanedList.sort();
cleanedList.unique();
for (auto it = cleanedList.begin(); it != cleanedList.end();) {
if (q->findParticipant(*it) || (q->getMe()->getAddress() == IdentityAddress(*it)))
if (q->findParticipant(*it) || (q->getMe()->getAddress() == *it))
it = cleanedList.erase(it);
else
it++;
@ -64,7 +64,7 @@ shared_ptr<CallSession> ClientGroupChatRoomPrivate::createSession () {
shared_ptr<Participant> focus = qConference->getPrivate()->focus;
shared_ptr<CallSession> session = focus->getPrivate()->createSession(*q, &csp, false, q);
const Address &myAddress = q->getMe()->getAddress();
session->configure(LinphoneCallOutgoing, nullptr, nullptr, myAddress, focus->getContactAddress());
session->configure(LinphoneCallOutgoing, nullptr, nullptr, myAddress, focus->getAddress());
session->initiateOutgoing();
return session;
}
@ -105,25 +105,25 @@ bool ClientGroupChatRoom::canHandleParticipants () const {
return RemoteConference::canHandleParticipants();
}
const Address &ClientGroupChatRoom::getConferenceAddress () const {
const IdentityAddress &ClientGroupChatRoom::getConferenceAddress () const {
return RemoteConference::getConferenceAddress();
}
void ClientGroupChatRoom::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) {
list<Address> addresses;
void ClientGroupChatRoom::addParticipant (const IdentityAddress &addr, const CallSessionParams *params, bool hasMedia) {
list<IdentityAddress> addresses;
addresses.push_back(addr);
addParticipants(addresses, params, hasMedia);
}
void ClientGroupChatRoom::addParticipants (
const list<Address> &addresses,
const list<IdentityAddress> &addresses,
const CallSessionParams *params,
bool hasMedia
) {
L_D();
L_D_T(RemoteConference, dConference);
list<Address> addressesList = d->cleanAddressesList(addresses);
list<IdentityAddress> addressesList = d->cleanAddressesList(addresses);
if (addressesList.empty())
return;
@ -166,7 +166,7 @@ void ClientGroupChatRoom::removeParticipants (const list<shared_ptr<Participant>
RemoteConference::removeParticipants(participants);
}
shared_ptr<Participant> ClientGroupChatRoom::findParticipant (const Address &addr) const {
shared_ptr<Participant> ClientGroupChatRoom::findParticipant (const IdentityAddress &addr) const {
return RemoteConference::findParticipant(addr);
}
@ -264,7 +264,7 @@ void ClientGroupChatRoom::leave () {
void ClientGroupChatRoom::onChatMessageReceived (const shared_ptr<ChatMessage> &msg) {}
void ClientGroupChatRoom::onConferenceCreated (const Address &addr) {
void ClientGroupChatRoom::onConferenceCreated (const IdentityAddress &addr) {
L_D();
L_D_T(RemoteConference, dConference);
dConference->conferenceAddress = addr;
@ -272,14 +272,14 @@ void ClientGroupChatRoom::onConferenceCreated (const Address &addr) {
getCore()->getPrivate()->insertChatRoom(getSharedFromThis());
}
void ClientGroupChatRoom::onConferenceTerminated (const Address &addr) {
void ClientGroupChatRoom::onConferenceTerminated (const IdentityAddress &addr) {
L_D();
L_D_T(RemoteConference, dConference);
dConference->eventHandler->resetLastNotify();
d->setState(ChatRoom::State::Terminated);
}
void ClientGroupChatRoom::onFirstNotifyReceived (const Address &addr) {
void ClientGroupChatRoom::onFirstNotifyReceived (const IdentityAddress &addr) {
L_D();
d->setState(ChatRoom::State::Created);
getCore()->getPrivate()->insertChatRoomWithDb(getSharedFromThis());
@ -288,7 +288,7 @@ void ClientGroupChatRoom::onFirstNotifyReceived (const Address &addr) {
void ClientGroupChatRoom::onParticipantAdded (const shared_ptr<ConferenceParticipantEvent> &event, bool isFullState) {
L_D_T(RemoteConference, dConference);
const Address &addr = event->getParticipantAddress();
const IdentityAddress &addr = event->getParticipantAddress();
if (isMe(addr))
return;
@ -318,7 +318,7 @@ void ClientGroupChatRoom::onParticipantRemoved (const shared_ptr<ConferenceParti
L_D_T(RemoteConference, dConference);
const Address &addr = event->getParticipantAddress();
const IdentityAddress &addr = event->getParticipantAddress();
shared_ptr<Participant> participant = findParticipant(addr);
if (!participant) {
lWarning() << "Participant " << addr.asString() << " removed but not in the list of participants!";
@ -337,7 +337,7 @@ void ClientGroupChatRoom::onParticipantRemoved (const shared_ptr<ConferenceParti
}
void ClientGroupChatRoom::onParticipantSetAdmin (const shared_ptr<ConferenceParticipantEvent> &event, bool isFullState) {
const Address &addr = event->getParticipantAddress();
const IdentityAddress &addr = event->getParticipantAddress();
shared_ptr<Participant> participant;
if (isMe(addr))
participant = getMe();
@ -383,7 +383,7 @@ void ClientGroupChatRoom::onSubjectChanged (const shared_ptr<ConferenceSubjectEv
}
void ClientGroupChatRoom::onParticipantDeviceAdded (const shared_ptr<ConferenceParticipantDeviceEvent> &event, bool isFullState) {
const Address &addr = event->getParticipantAddress();
const IdentityAddress &addr = event->getParticipantAddress();
shared_ptr<Participant> participant;
if (isMe(addr))
participant = getMe();
@ -410,7 +410,7 @@ void ClientGroupChatRoom::onParticipantDeviceAdded (const shared_ptr<ConferenceP
void ClientGroupChatRoom::onParticipantDeviceRemoved (const shared_ptr<ConferenceParticipantDeviceEvent> &event, bool isFullState) {
(void)isFullState;
const Address &addr = event->getParticipantAddress();
const IdentityAddress &addr = event->getParticipantAddress();
shared_ptr<Participant> participant;
if (isMe(addr))
participant = getMe();
@ -450,7 +450,7 @@ void ClientGroupChatRoom::onCallSessionStateChanged (
if (state == LinphoneCallConnected) {
if (d->state == ChatRoom::State::CreationPending) {
Address addr(session->getRemoteContactAddress()->asStringUriOnly());
IdentityAddress addr(session->getRemoteContactAddress()->asStringUriOnly());
onConferenceCreated(addr);
if (session->getRemoteContactAddress()->hasParam("isfocus"))
dConference->eventHandler->subscribe(getChatRoomId());

View file

@ -43,17 +43,17 @@ public:
CapabilitiesMask getCapabilities () const override;
const Address &getConferenceAddress () const override;
const IdentityAddress &getConferenceAddress () const override;
bool canHandleParticipants () const 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;
void addParticipant (const IdentityAddress &addr, const CallSessionParams *params, bool hasMedia) override;
void addParticipants (const std::list<IdentityAddress> &addresses, const CallSessionParams *params, bool hasMedia) override;
void removeParticipant (const std::shared_ptr<const Participant> &participant) override;
void removeParticipants (const std::list<std::shared_ptr<Participant>> &participants) override;
std::shared_ptr<Participant> findParticipant (const Address &addr) const override;
std::shared_ptr<Participant> findParticipant (const IdentityAddress &addr) const override;
std::shared_ptr<Participant> getMe () const override;
int getNbParticipants () const override;
@ -73,9 +73,9 @@ private:
void onChatMessageReceived (const std::shared_ptr<ChatMessage> &msg) override;
void onConferenceCreated (const Address &addr) override;
void onConferenceTerminated (const Address &addr) override;
void onFirstNotifyReceived (const Address &addr) override;
void onConferenceCreated (const IdentityAddress &addr) override;
void onConferenceTerminated (const IdentityAddress &addr) override;
void onFirstNotifyReceived (const IdentityAddress &addr) override;
void onParticipantAdded (const std::shared_ptr<ConferenceParticipantEvent> &event, bool isFullState) override;
void onParticipantRemoved (const std::shared_ptr<ConferenceParticipantEvent> &event, bool isFullState) override;
void onParticipantSetAdmin (const std::shared_ptr<ConferenceParticipantEvent> &event, bool isFullState) override;

View file

@ -37,7 +37,7 @@ class ServerGroupChatRoomPrivate : public ChatRoomPrivate {
public:
ServerGroupChatRoomPrivate () = default;
std::shared_ptr<Participant> addParticipant (const Address &addr);
std::shared_ptr<Participant> addParticipant (const IdentityAddress &addr);
void confirmCreation ();
void confirmJoining (SalCallOp *op);
std::shared_ptr<Participant> findRemovedParticipant (const std::shared_ptr<const CallSession> &session) const;
@ -46,7 +46,7 @@ public:
void subscribeReceived (LinphoneEvent *event);
void update (SalCallOp *op);
void dispatchMessage (const Address &fromAddr, const Content &content);
void dispatchMessage (const IdentityAddress &fromAddr, const Content &content);
void storeOrUpdateMessage (const std::shared_ptr<ChatMessage> &msg) override;
LinphoneReason messageReceived (SalOp *op, const SalMessage *msg) override;
void setConferenceAddress (const IdentityAddress &confAddr);

View file

@ -29,7 +29,7 @@ LINPHONE_BEGIN_NAMESPACE
// -----------------------------------------------------------------------------
shared_ptr<Participant> ServerGroupChatRoomPrivate::addParticipant (const Address &) {
shared_ptr<Participant> ServerGroupChatRoomPrivate::addParticipant (const IdentityAddress &) {
return nullptr;
}
@ -55,7 +55,7 @@ void ServerGroupChatRoomPrivate::update (SalCallOp *) {}
// -----------------------------------------------------------------------------
void ServerGroupChatRoomPrivate::dispatchMessage (const Address &, const Content &) {}
void ServerGroupChatRoomPrivate::dispatchMessage (const IdentityAddress &, const Content &) {}
void ServerGroupChatRoomPrivate::storeOrUpdateMessage (const shared_ptr<ChatMessage> &) {}
@ -79,7 +79,7 @@ bool ServerGroupChatRoomPrivate::isAdminLeft () const {
ServerGroupChatRoom::ServerGroupChatRoom (const shared_ptr<Core> &core, SalCallOp *op) :
ChatRoom(*new ServerGroupChatRoomPrivate, core, ChatRoomId(IdentityAddress(op->get_to()), IdentityAddress(op->get_to()))),
LocalConference(core, Address(op->get_to()), nullptr) {}
LocalConference(core, IdentityAddress(op->get_to()), nullptr) {}
int ServerGroupChatRoom::getCapabilities () const {
return 0;
@ -89,11 +89,11 @@ bool ServerGroupChatRoom::canHandleParticipants () const {
return false;
}
void ServerGroupChatRoom::addParticipant (const Address &, const CallSessionParams *, bool) {}
void ServerGroupChatRoom::addParticipant (const IdentityAddress &, const CallSessionParams *, bool) {}
void ServerGroupChatRoom::addParticipants (const list<Address> &, const CallSessionParams *, bool) {}
void ServerGroupChatRoom::addParticipants (const list<IdentityAddress> &, const CallSessionParams *, bool) {}
const Address &ServerGroupChatRoom::getConferenceAddress () const {
const IdentityAddress &ServerGroupChatRoom::getConferenceAddress () const {
return LocalConference::getConferenceAddress();
}
@ -101,7 +101,7 @@ void ServerGroupChatRoom::removeParticipant (const shared_ptr<const Participant>
void ServerGroupChatRoom::removeParticipants (const list<shared_ptr<Participant>> &) {}
shared_ptr<Participant> ServerGroupChatRoom::findParticipant (const Address &) const {
shared_ptr<Participant> ServerGroupChatRoom::findParticipant (const IdentityAddress &) const {
return nullptr;
}

View file

@ -41,17 +41,17 @@ public:
CapabilitiesMask getCapabilities () const override;
const Address &getConferenceAddress () const override;
const IdentityAddress &getConferenceAddress () const override;
bool canHandleParticipants () const 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;
void addParticipant (const IdentityAddress &addr, const CallSessionParams *params, bool hasMedia) override;
void addParticipants (const std::list<IdentityAddress> &addresses, const CallSessionParams *params, bool hasMedia) override;
void removeParticipant (const std::shared_ptr<const Participant> &participant) override;
void removeParticipants (const std::list<std::shared_ptr<Participant>> &participants) override;
std::shared_ptr<Participant> findParticipant (const Address &addr) const override;
std::shared_ptr<Participant> findParticipant (const IdentityAddress &addr) const override;
std::shared_ptr<Participant> getMe () const override;
int getNbParticipants () const override;

View file

@ -29,7 +29,7 @@
LINPHONE_BEGIN_NAMESPACE
class Address;
class IdentityAddress;
class CallSessionParams;
class Participant;
@ -37,11 +37,11 @@ class LINPHONE_PUBLIC ConferenceInterface {
public:
virtual ~ConferenceInterface() = default;
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 void addParticipant (const IdentityAddress &addr, const CallSessionParams *params, bool hasMedia) = 0;
virtual void addParticipants (const std::list<IdentityAddress> &addresses, const CallSessionParams *params, bool hasMedia) = 0;
virtual bool canHandleParticipants () const = 0;
virtual std::shared_ptr<Participant> findParticipant (const Address &addr) const = 0;
virtual const Address &getConferenceAddress () const = 0;
virtual std::shared_ptr<Participant> findParticipant (const IdentityAddress &addr) const = 0;
virtual const IdentityAddress &getConferenceAddress () const = 0;
virtual std::shared_ptr<Participant> getMe () const = 0;
virtual int getNbParticipants () const = 0;
virtual std::list<std::shared_ptr<Participant>> getParticipants () const = 0;

View file

@ -31,13 +31,13 @@
LINPHONE_BEGIN_NAMESPACE
class Address;
class IdentityAddress;
class ConferenceListener {
public:
virtual void onConferenceCreated (const Address &addr) = 0;
virtual void onConferenceTerminated (const Address &addr) = 0;
virtual void onFirstNotifyReceived (const Address &addr) = 0;
virtual void onConferenceCreated (const IdentityAddress &addr) = 0;
virtual void onConferenceTerminated (const IdentityAddress &addr) = 0;
virtual void onFirstNotifyReceived (const IdentityAddress &addr) = 0;
virtual void onParticipantAdded (const std::shared_ptr<ConferenceParticipantEvent> &event, bool isFullState) = 0;
virtual void onParticipantRemoved (const std::shared_ptr<ConferenceParticipantEvent> &event, bool isFullState) = 0;
virtual void onParticipantSetAdmin (const std::shared_ptr<ConferenceParticipantEvent> &event, bool isFullState) = 0;

View file

@ -20,7 +20,7 @@
#ifndef _CONFERENCE_P_H_
#define _CONFERENCE_P_H_
#include "address/address.h"
#include "address/identity-address.h"
#include "conference.h"
// =============================================================================
@ -32,7 +32,7 @@ class Participant;
class ConferencePrivate {
public:
Address conferenceAddress;
IdentityAddress conferenceAddress;
std::list<std::shared_ptr<Participant>> participants;
protected:

View file

@ -32,7 +32,7 @@ LINPHONE_BEGIN_NAMESPACE
Conference::Conference (
ConferencePrivate &p,
const shared_ptr<Core> &core,
const Address &myAddress,
const IdentityAddress &myAddress,
CallListener *listener
) : CoreAccessor(core), mPrivate(&p) {
L_D();
@ -54,12 +54,12 @@ shared_ptr<Participant> Conference::getActiveParticipant () const {
// -----------------------------------------------------------------------------
void Conference::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) {
void Conference::addParticipant (const IdentityAddress &addr, const CallSessionParams *params, bool hasMedia) {
lError() << "Conference class does not handle addParticipant() generically";
}
void Conference::addParticipants (const list<Address> &addresses, const CallSessionParams *params, bool hasMedia) {
list<Address> sortedAddresses(addresses);
void Conference::addParticipants (const list<IdentityAddress> &addresses, const CallSessionParams *params, bool hasMedia) {
list<IdentityAddress> sortedAddresses(addresses);
sortedAddresses.sort();
sortedAddresses.unique();
for (const auto &addr: sortedAddresses) {
@ -73,7 +73,7 @@ bool Conference::canHandleParticipants () const {
return true;
}
const Address &Conference::getConferenceAddress () const {
const IdentityAddress &Conference::getConferenceAddress () const {
L_D();
return d->conferenceAddress;
}
@ -208,12 +208,13 @@ void Conference::onResetFirstVideoFrameDecoded (const shared_ptr<const CallSessi
// -----------------------------------------------------------------------------
shared_ptr<Participant> Conference::findParticipant (const Address &addr) const {
shared_ptr<Participant> Conference::findParticipant (const IdentityAddress &addr) const {
L_D();
IdentityAddress simpleAddr(addr);
IdentityAddress searchedAddr(addr);
searchedAddr.setGruu("");
for (const auto &participant : d->participants) {
if (participant->getAddress() == simpleAddr)
if (participant->getAddress() == searchedAddr)
return participant;
}
@ -231,7 +232,7 @@ shared_ptr<Participant> Conference::findParticipant (const shared_ptr<const Call
return nullptr;
}
bool Conference::isMe (const Address &addr) const {
bool Conference::isMe (const IdentityAddress &addr) const {
L_D();
IdentityAddress simpleAddr(addr);
return d->me->getAddress() == simpleAddr;

View file

@ -48,11 +48,11 @@ public:
std::shared_ptr<Participant> findParticipant (const std::shared_ptr<const CallSession> &session) const;
/* ConferenceInterface */
void addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override;
void addParticipants (const std::list<Address> &addresses, const CallSessionParams *params, bool hasMedia) override;
void addParticipant (const IdentityAddress &addr, const CallSessionParams *params, bool hasMedia) override;
void addParticipants (const std::list<IdentityAddress> &addresses, const CallSessionParams *params, bool hasMedia) override;
bool canHandleParticipants () const override;
std::shared_ptr<Participant> findParticipant (const Address &addr) const override;
const Address &getConferenceAddress () const override;
std::shared_ptr<Participant> findParticipant (const IdentityAddress &addr) const override;
const IdentityAddress &getConferenceAddress () const override;
std::shared_ptr<Participant> getMe () const override;
int getNbParticipants () const override;
std::list<std::shared_ptr<Participant>> getParticipants () const override;
@ -85,11 +85,11 @@ protected:
explicit Conference (
ConferencePrivate &p,
const std::shared_ptr<Core> &core,
const Address &myAddress,
const IdentityAddress &myAddress,
CallListener *listener = nullptr
);
bool isMe (const Address &addr) const;
bool isMe (const IdentityAddress &addr) const;
ConferencePrivate *mPrivate = nullptr;

View file

@ -102,7 +102,7 @@ string LocalConferenceEventHandlerPrivate::createNotify (ConferenceType confInfo
}
string LocalConferenceEventHandlerPrivate::createNotifyFullState (int notifyId) {
string entity = conf->getConferenceAddress().asStringUriOnly();
string entity = conf->getConferenceAddress().asString();
string subject = conf->getSubject();
ConferenceType confInfo = ConferenceType(entity);
UsersType users;
@ -122,7 +122,7 @@ string LocalConferenceEventHandlerPrivate::createNotifyFullState (int notifyId)
user.setState(StateType::full);
for (const auto &device : participant->getPrivate()->getDevices()) {
const string &gruu = device->getGruu().asString();
const string &gruu = device->getAddress().asString();
EndpointType endpoint = EndpointType();
endpoint.setEntity(gruu);
endpoint.setState(StateType::full);
@ -224,7 +224,7 @@ string LocalConferenceEventHandlerPrivate::createNotifyMultipart (int notifyId)
}
string LocalConferenceEventHandlerPrivate::createNotifyParticipantAdded (const Address &addr, int notifyId) {
string entity = conf->getConferenceAddress().asStringUriOnly();
string entity = conf->getConferenceAddress().asString();
ConferenceType confInfo = ConferenceType(entity);
UsersType users;
confInfo.setUsers(users);
@ -235,7 +235,7 @@ string LocalConferenceEventHandlerPrivate::createNotifyParticipantAdded (const A
shared_ptr<Participant> p = conf->findParticipant(addr);
if (p) {
for (const auto &device : p->getPrivate()->getDevices()) {
const string &gruu = device->getGruu().asString();
const string &gruu = device->getAddress().asString();
EndpointType endpoint = EndpointType();
endpoint.setEntity(gruu);
endpoint.setState(StateType::full);
@ -254,7 +254,7 @@ string LocalConferenceEventHandlerPrivate::createNotifyParticipantAdded (const A
}
string LocalConferenceEventHandlerPrivate::createNotifyParticipantRemoved (const Address &addr, int notifyId) {
string entity = conf->getConferenceAddress().asStringUriOnly();
string entity = conf->getConferenceAddress().asString();
ConferenceType confInfo = ConferenceType(entity);
UsersType users;
confInfo.setUsers(users);
@ -268,7 +268,7 @@ string LocalConferenceEventHandlerPrivate::createNotifyParticipantRemoved (const
}
string LocalConferenceEventHandlerPrivate::createNotifyParticipantAdmined (const Address &addr, bool isAdmin, int notifyId) {
string entity = conf->getConferenceAddress().asStringUriOnly();
string entity = conf->getConferenceAddress().asString();
ConferenceType confInfo = ConferenceType(entity);
UsersType users;
confInfo.setUsers(users);
@ -289,7 +289,7 @@ string LocalConferenceEventHandlerPrivate::createNotifySubjectChanged (int notif
}
string LocalConferenceEventHandlerPrivate::createNotifySubjectChanged (const string &subject, int notifyId) {
string entity = conf->getConferenceAddress().asStringUriOnly();
string entity = conf->getConferenceAddress().asString();
ConferenceType confInfo = ConferenceType(entity);
ConferenceDescriptionType confDescr = ConferenceDescriptionType();
confDescr.setSubject(subject);
@ -299,7 +299,7 @@ string LocalConferenceEventHandlerPrivate::createNotifySubjectChanged (const str
}
string LocalConferenceEventHandlerPrivate::createNotifyParticipantDeviceAdded (const Address &addr, const Address &gruu, int notifyId) {
string entity = conf->getConferenceAddress().asStringUriOnly();
string entity = conf->getConferenceAddress().asString();
ConferenceType confInfo = ConferenceType(entity);
UsersType users;
confInfo.setUsers(users);
@ -323,7 +323,7 @@ string LocalConferenceEventHandlerPrivate::createNotifyParticipantDeviceAdded (c
}
string LocalConferenceEventHandlerPrivate::createNotifyParticipantDeviceRemoved (const Address &addr, const Address &gruu, int notifyId) {
string entity = conf->getConferenceAddress().asStringUriOnly();
string entity = conf->getConferenceAddress().asString();
ConferenceType confInfo = ConferenceType(entity);
UsersType users;
confInfo.setUsers(users);
@ -383,16 +383,16 @@ void LocalConferenceEventHandler::subscribeReceived (LinphoneEvent *lev) {
if (linphone_event_get_subscription_state(lev) == LinphoneSubscriptionActive) {
unsigned int lastNotify = static_cast<unsigned int>(Utils::stoi(linphone_event_get_custom_header(lev, "Last-Notify-Version")));
if (lastNotify == 0) {
lInfo() << "Sending initial notify of conference:" << d->conf->getConferenceAddress().asStringUriOnly() << " to: " << device->getGruu().asString();
lInfo() << "Sending initial notify of conference:" << d->conf->getConferenceAddress().asString() << " to: " << device->getAddress().asString();
device->setConferenceSubscribeEvent(lev);
d->notifyFullState(d->createNotifyFullState(), device);
} else if (lastNotify < d->lastNotify) {
lInfo() << "Sending all missed notify for conference:" << d->conf->getConferenceAddress().asStringUriOnly() <<
lInfo() << "Sending all missed notify for conference:" << d->conf->getConferenceAddress().asString() <<
" from: " << lastNotify << " to: " << participant->getAddress().asString();
d->notifyParticipantDevice(d->createNotifyMultipart(static_cast<int>(lastNotify)), device);
} else if (lastNotify > d->lastNotify) {
lError() << "last notify received by client: [" << lastNotify <<"] for conference:" <<
d->conf->getConferenceAddress().asStringUriOnly() <<
d->conf->getConferenceAddress().asString() <<
" should not be higher than last notify sent by server: [" << d->lastNotify << "]";
}
} else if (linphone_event_get_subscription_state(lev) == LinphoneSubscriptionTerminated)

View file

@ -28,7 +28,7 @@ using namespace std;
LINPHONE_BEGIN_NAMESPACE
LocalConference::LocalConference (const shared_ptr<Core> &core, const Address &myAddress, CallListener *listener)
LocalConference::LocalConference (const shared_ptr<Core> &core, const IdentityAddress &myAddress, CallListener *listener)
: Conference(*new LocalConferencePrivate, core, myAddress, listener) {
L_D();
d->eventHandler.reset(new LocalConferenceEventHandler(this));
@ -36,7 +36,7 @@ LocalConference::LocalConference (const shared_ptr<Core> &core, const Address &m
// -----------------------------------------------------------------------------
void LocalConference::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) {
void LocalConference::addParticipant (const IdentityAddress &addr, const CallSessionParams *params, bool hasMedia) {
L_D();
shared_ptr<Participant> participant = findParticipant(addr);
if (participant)
@ -57,18 +57,16 @@ void LocalConference::removeParticipant (const shared_ptr<const Participant> &pa
}
}
list<Address> LocalConference::parseResourceLists (const string &xmlBody) {
list<IdentityAddress> LocalConference::parseResourceLists (const string &xmlBody) {
istringstream data(xmlBody);
unique_ptr<Xsd::ResourceLists::ResourceLists> rl = LinphonePrivate::Xsd::ResourceLists::parseResourceLists(
data,
Xsd::XmlSchema::Flags::dont_validate
);
list<Address> addresses = list<Address>();
list<IdentityAddress> addresses = list<IdentityAddress>();
for (const auto &l : rl->getList()) {
for (const auto &entry : l.getEntry()) {
Address addr(entry.getUri());
if (entry.getDisplayName().present())
addr.setDisplayName(entry.getDisplayName().get());
IdentityAddress addr(entry.getUri());
addresses.push_back(addr);
}
}

View file

@ -32,13 +32,13 @@ class LocalConference : public Conference {
friend class ServerGroupChatRoomPrivate;
public:
LocalConference (const std::shared_ptr<Core> &core, const Address &myAddress, CallListener *listener = nullptr);
LocalConference (const std::shared_ptr<Core> &core, const IdentityAddress &myAddress, CallListener *listener = nullptr);
/* ConferenceInterface */
void addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override;
void addParticipant (const IdentityAddress &addr, const CallSessionParams *params, bool hasMedia) override;
void removeParticipant (const std::shared_ptr<const Participant> &participant) override;
std::list<Address> parseResourceLists (const std::string &xmlBody);
std::list<IdentityAddress> parseResourceLists (const std::string &xmlBody);
private:
L_DECLARE_PRIVATE(LocalConference);

View file

@ -39,7 +39,7 @@ ParticipantDevice::~ParticipantDevice () {
}
bool ParticipantDevice::operator== (const ParticipantDevice &device) const {
return (mGruu == device.getGruu());
return (mGruu == device.getAddress());
}
void ParticipantDevice::setConferenceSubscribeEvent (LinphoneEvent *ev) {

View file

@ -41,7 +41,7 @@ public:
bool operator== (const ParticipantDevice &device) const;
inline const IdentityAddress &getGruu () const { return mGruu; }
inline const IdentityAddress &getAddress () const { return mGruu; }
inline std::shared_ptr<CallSession> getSession () const { return mSession; }
inline void setSession (std::shared_ptr<CallSession> session) { mSession = session; }

View file

@ -40,7 +40,6 @@ public:
inline void removeSession () { session.reset(); }
inline void setAddress (const IdentityAddress &newAddr) { addr = newAddr; }
inline void setAdmin (bool isAdmin) { this->isAdmin = isAdmin; }
inline void setContactAddress (const Address &contactAddr) { this->contactAddr = contactAddr; }
std::shared_ptr<ParticipantDevice> findDevice (const IdentityAddress &gruu) const;
std::shared_ptr<ParticipantDevice> findDevice (const std::shared_ptr<const CallSession> &session);
const std::list<std::shared_ptr<ParticipantDevice>> &getDevices () const;
@ -49,7 +48,6 @@ public:
private:
IdentityAddress addr;
Address contactAddr;
bool isAdmin = false;
std::shared_ptr<CallSession> session;
std::list<std::shared_ptr<ParticipantDevice>> devices;

View file

@ -47,7 +47,7 @@ shared_ptr<CallSession> ParticipantPrivate::createSession (
shared_ptr<ParticipantDevice> ParticipantPrivate::findDevice (const IdentityAddress &gruu) const {
for (const auto &device : devices) {
if (device->getGruu() == gruu)
if (device->getAddress() == gruu)
return device;
}
return nullptr;
@ -76,7 +76,7 @@ shared_ptr<ParticipantDevice> ParticipantPrivate::addDevice (const IdentityAddre
void ParticipantPrivate::removeDevice (const IdentityAddress &gruu) {
for (auto it = devices.begin(); it != devices.end(); it++) {
if ((*it)->getGruu() == gruu) {
if ((*it)->getAddress() == gruu) {
devices.erase(it);
return;
}
@ -85,16 +85,14 @@ void ParticipantPrivate::removeDevice (const IdentityAddress &gruu) {
// =============================================================================
Participant::Participant (const Address &address) : Object(*new ParticipantPrivate) {
Participant::Participant (const IdentityAddress &address) : Object(*new ParticipantPrivate) {
L_D();
d->contactAddr = address;
d->addr = IdentityAddress(address);
d->addr = address;
}
Participant::Participant (Address &&address) : Object(*new ParticipantPrivate) {
Participant::Participant (IdentityAddress &&address) : Object(*new ParticipantPrivate) {
L_D();
d->contactAddr = move(address);
d->addr = IdentityAddress(address);
d->addr = address;
}
// -----------------------------------------------------------------------------
@ -104,11 +102,6 @@ const IdentityAddress& Participant::getAddress () const {
return d->addr;
}
const Address& Participant::getContactAddress () const {
L_D();
return d->contactAddr;
}
// -----------------------------------------------------------------------------
bool Participant::isAdmin () const {

View file

@ -22,7 +22,6 @@
#include <list>
#include "address/address.h"
#include "address/identity-address.h"
#include "object/object.h"
#include "conference/params/call-session-params.h"
@ -50,11 +49,10 @@ class Participant : public Object {
friend class ServerGroupChatRoomPrivate;
public:
explicit Participant (const Address &address);
explicit Participant (Address &&address);
explicit Participant (const IdentityAddress &address);
explicit Participant (IdentityAddress &&address);
const IdentityAddress& getAddress () const;
const Address& getContactAddress () const;
bool isAdmin () const;
private:

View file

@ -30,7 +30,7 @@ LINPHONE_BEGIN_NAMESPACE
RemoteConference::RemoteConference (
const shared_ptr<Core> &core,
const Address &myAddress,
const IdentityAddress &myAddress,
CallListener *listener
) : Conference(*new RemoteConferencePrivate, core, myAddress, listener) {
L_D();
@ -44,7 +44,7 @@ RemoteConference::~RemoteConference () {
// -----------------------------------------------------------------------------
void RemoteConference::addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) {
void RemoteConference::addParticipant (const IdentityAddress &addr, const CallSessionParams *params, bool hasMedia) {
L_D();
shared_ptr<Participant> participant = findParticipant(addr);
if (participant)
@ -66,13 +66,11 @@ void RemoteConference::removeParticipant (const shared_ptr<const Participant> &p
}
}
string RemoteConference::getResourceLists (const list<Address> &addresses) const {
string RemoteConference::getResourceLists (const list<IdentityAddress> &addresses) const {
Xsd::ResourceLists::ResourceLists rl = Xsd::ResourceLists::ResourceLists();
Xsd::ResourceLists::ListType l = Xsd::ResourceLists::ListType();
for (const auto &addr : addresses) {
Xsd::ResourceLists::EntryType entry = Xsd::ResourceLists::EntryType(addr.asStringUriOnly());
if (!addr.getDisplayName().empty())
entry.setDisplayName(Xsd::ResourceLists::DisplayName(addr.getDisplayName()));
Xsd::ResourceLists::EntryType entry = Xsd::ResourceLists::EntryType(addr.asString());
l.getEntry().push_back(entry);
}
rl.getList().push_back(l);
@ -85,14 +83,14 @@ string RemoteConference::getResourceLists (const list<Address> &addresses) const
// -----------------------------------------------------------------------------
void RemoteConference::onConferenceCreated (const Address &addr) {}
void RemoteConference::onConferenceCreated (const IdentityAddress &addr) {}
void RemoteConference::onConferenceTerminated (const Address &addr) {
void RemoteConference::onConferenceTerminated (const IdentityAddress &addr) {
L_D();
d->eventHandler->unsubscribe();
}
void RemoteConference::onFirstNotifyReceived (const Address &addr) {}
void RemoteConference::onFirstNotifyReceived (const IdentityAddress &addr) {}
void RemoteConference::onParticipantAdded (const std::shared_ptr<ConferenceParticipantEvent> &event, bool isFullState) {
(void)event;

View file

@ -34,20 +34,20 @@ class LINPHONE_PUBLIC RemoteConference : public Conference, public ConferenceLis
friend class ClientGroupChatRoomPrivate;
public:
RemoteConference (const std::shared_ptr<Core> &core, const Address &myAddress, CallListener *listener = nullptr);
RemoteConference (const std::shared_ptr<Core> &core, const IdentityAddress &myAddress, CallListener *listener = nullptr);
virtual ~RemoteConference();
/* ConferenceInterface */
void addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override;
void addParticipant (const IdentityAddress &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) const;
std::string getResourceLists (const std::list<IdentityAddress> &addresses) const;
protected:
/* ConferenceListener */
void onConferenceCreated (const Address &addr) override;
void onConferenceTerminated (const Address &addr) override;
void onFirstNotifyReceived (const Address &addr) override;
void onConferenceCreated (const IdentityAddress &addr) override;
void onConferenceTerminated (const IdentityAddress &addr) override;
void onFirstNotifyReceived (const IdentityAddress &addr) override;
void onParticipantAdded (const std::shared_ptr<ConferenceParticipantEvent> &event, bool isFullState) override;
void onParticipantRemoved (const std::shared_ptr<ConferenceParticipantEvent> &event, bool isFullState) override;
void onParticipantSetAdmin (const std::shared_ptr<ConferenceParticipantEvent> &event, bool isFullState) override;

View file

@ -448,9 +448,9 @@ public:
~ConferenceEventTester ();
private:
void onConferenceCreated (const Address &addr) override;
void onConferenceTerminated (const Address &addr) override;
void onFirstNotifyReceived (const Address &addr) override;
void onConferenceCreated (const IdentityAddress &addr) override;
void onConferenceTerminated (const IdentityAddress &addr) override;
void onFirstNotifyReceived (const IdentityAddress &addr) override;
void onParticipantAdded (const shared_ptr<ConferenceParticipantEvent> &event, bool isFullState) override;
void onParticipantRemoved (const shared_ptr<ConferenceParticipantEvent> &event, bool isFullState) override;
void onParticipantSetAdmin (const shared_ptr<ConferenceParticipantEvent> &event, bool isFullState) override;
@ -473,28 +473,28 @@ ConferenceEventTester::~ConferenceEventTester () {
delete handler;
}
void ConferenceEventTester::onConferenceCreated (const Address &addr) {}
void ConferenceEventTester::onConferenceCreated (const IdentityAddress &addr) {}
void ConferenceEventTester::onConferenceTerminated (const Address &addr) {}
void ConferenceEventTester::onConferenceTerminated (const IdentityAddress &addr) {}
void ConferenceEventTester::onFirstNotifyReceived (const Address &addr) {}
void ConferenceEventTester::onFirstNotifyReceived (const IdentityAddress &addr) {}
void ConferenceEventTester::onParticipantAdded (const shared_ptr<ConferenceParticipantEvent> &event, bool isFullState) {
(void)isFullState; // unused
const Address addr = event->getParticipantAddress();
const IdentityAddress addr = event->getParticipantAddress();
participants.insert(pair<string, bool>(addr.asString(), FALSE));
participantDevices.insert(pair<string, int>(addr.asString(), 0));
}
void ConferenceEventTester::onParticipantRemoved (const shared_ptr<ConferenceParticipantEvent> &event, bool isFullState) {
(void)isFullState; // unused
const Address addr = event->getParticipantAddress();
const IdentityAddress addr = event->getParticipantAddress();
participants.erase(addr.asString());
participantDevices.erase(addr.asString());
}
void ConferenceEventTester::onParticipantSetAdmin (const shared_ptr<ConferenceParticipantEvent> &event, bool isFullState) {
(void)isFullState; // unused
const Address addr = event->getParticipantAddress();
const IdentityAddress addr = event->getParticipantAddress();
auto it = participants.find(addr.asString());
if (it != participants.end())
it->second = (event->getType() == EventLog::Type::ConferenceParticipantSetAdmin);
@ -507,7 +507,7 @@ void ConferenceEventTester::onSubjectChanged(const shared_ptr<ConferenceSubjectE
void ConferenceEventTester::onParticipantDeviceAdded (const shared_ptr<ConferenceParticipantDeviceEvent> &event, bool isFullState) {
(void)isFullState; // unused
const Address addr = event->getParticipantAddress();
const IdentityAddress addr = event->getParticipantAddress();
auto it = participantDevices.find(addr.asString());
if (it != participantDevices.end())
it->second++;
@ -516,7 +516,7 @@ void ConferenceEventTester::onParticipantDeviceAdded (const shared_ptr<Conferenc
void ConferenceEventTester::onParticipantDeviceRemoved (const shared_ptr<ConferenceParticipantDeviceEvent> &event, bool isFullState) {
(void)isFullState; // unused
const Address addr = event->getParticipantAddress();
const IdentityAddress addr = event->getParticipantAddress();
auto it = participantDevices.find(addr.asString());
if (it != participantDevices.end() && it->second > 0)
it->second--;
@ -827,7 +827,7 @@ void send_first_notify() {
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(
L_ATTR_GET(L_GET_PRIVATE(localConf), eventHandler)
);
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
const_cast<IdentityAddress &>(localConf.getConferenceAddress()) = addr;
string notify = localHandlerPrivate->createNotifyFullState();
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
@ -876,7 +876,7 @@ void send_added_notify() {
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(
L_ATTR_GET(L_GET_PRIVATE(localConf), eventHandler)
);
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
const_cast<IdentityAddress &>(localConf.getConferenceAddress()) = addr;
string notify = localHandlerPrivate->createNotifyFullState();
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
@ -932,7 +932,7 @@ void send_removed_notify() {
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(
L_ATTR_GET(L_GET_PRIVATE(localConf), eventHandler)
);
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
const_cast<IdentityAddress &>(localConf.getConferenceAddress()) = addr;
string notify = localHandlerPrivate->createNotifyFullState();
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
@ -985,7 +985,7 @@ void send_admined_notify() {
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(
L_ATTR_GET(L_GET_PRIVATE(localConf), eventHandler)
);
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
const_cast<IdentityAddress &>(localConf.getConferenceAddress()) = addr;
string notify = localHandlerPrivate->createNotifyFullState();
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
@ -1037,7 +1037,7 @@ void send_unadmined_notify() {
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(
L_ATTR_GET(L_GET_PRIVATE(localConf), eventHandler)
);
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
const_cast<IdentityAddress &>(localConf.getConferenceAddress()) = addr;
string notify = localHandlerPrivate->createNotifyFullState();
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
@ -1091,7 +1091,7 @@ void send_subject_changed_notify () {
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(
L_ATTR_GET(L_GET_PRIVATE(localConf), eventHandler)
);
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
const_cast<IdentityAddress &>(localConf.getConferenceAddress()) = addr;
string notify = localHandlerPrivate->createNotifyFullState();
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
@ -1150,7 +1150,7 @@ void send_device_added_notify() {
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(
L_ATTR_GET(L_GET_PRIVATE(localConf), eventHandler)
);
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
const_cast<IdentityAddress &>(localConf.getConferenceAddress()) = addr;
string notify = localHandlerPrivate->createNotifyFullState();
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;
@ -1203,7 +1203,7 @@ void send_device_removed_notify() {
LocalConferenceEventHandlerPrivate *localHandlerPrivate = L_GET_PRIVATE(
L_ATTR_GET(L_GET_PRIVATE(localConf), eventHandler)
);
const_cast<Address &>(localConf.getConferenceAddress()) = addr;
const_cast<IdentityAddress &>(localConf.getConferenceAddress()) = addr;
string notify = localHandlerPrivate->createNotifyFullState();
const_cast<IdentityAddress &>(tester.handler->getChatRoomId().getPeerAddress()) = addr;