Commit f92da345 authored by Ghislain MARY's avatar Ghislain MARY

Keep the gruu address of the client group chat room focus participant.

parent 59f9c18b
......@@ -66,7 +66,7 @@ shared_ptr<CallSession> ClientGroupChatRoomPrivate::createSession () {
const Address &myAddress = q->getMe()->getAddress();
Address myCleanedAddress(myAddress);
myCleanedAddress.setUriParam("gr"); // Remove gr parameter for INVITE
session->configure(LinphoneCallOutgoing, nullptr, nullptr, myCleanedAddress, focus->getAddress());
session->configure(LinphoneCallOutgoing, nullptr, nullptr, myCleanedAddress, focus->getPrivate()->getDevices().front()->getAddress());
session->initiateOutgoing();
return session;
}
......@@ -87,13 +87,15 @@ void ClientGroupChatRoomPrivate::onChatMessageReceived (const shared_ptr<ChatMes
ClientGroupChatRoom::ClientGroupChatRoom (
const shared_ptr<Core> &core,
const string &factoryUri,
const string &uri,
const IdentityAddress &me,
const string &subject
) : ChatRoom(*new ClientGroupChatRoomPrivate, core, ChatRoomId(IdentityAddress(), me)),
RemoteConference(core, me, nullptr) {
L_D_T(RemoteConference, dConference);
dConference->focus = make_shared<Participant>(Address(factoryUri));
IdentityAddress focusAddr(uri);
dConference->focus = make_shared<Participant>(focusAddr);
dConference->focus->getPrivate()->addDevice(focusAddr);
RemoteConference::setSubject(subject);
}
......@@ -298,6 +300,8 @@ void ClientGroupChatRoom::onConferenceCreated (const IdentityAddress &addr) {
L_D_T(RemoteConference, dConference);
dConference->conferenceAddress = addr;
dConference->focus->getPrivate()->setAddress(addr);
dConference->focus->getPrivate()->clearDevices();
dConference->focus->getPrivate()->addDevice(addr);
d->chatRoomId = ChatRoomId(addr, d->chatRoomId.getLocalAddress());
getCore()->getPrivate()->insertChatRoom(getSharedFromThis());
}
......
......@@ -40,10 +40,12 @@ public:
inline void removeSession () { session.reset(); }
inline void setAddress (const IdentityAddress &newAddr) { addr = newAddr; }
inline void setAdmin (bool isAdmin) { this->isAdmin = isAdmin; }
std::shared_ptr<ParticipantDevice> addDevice (const IdentityAddress &gruu);
void clearDevices ();
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;
std::shared_ptr<ParticipantDevice> addDevice (const IdentityAddress &gruu);
void removeDevice (const IdentityAddress &gruu);
private:
......
......@@ -46,6 +46,19 @@ shared_ptr<CallSession> ParticipantPrivate::createSession (
// -----------------------------------------------------------------------------
shared_ptr<ParticipantDevice> ParticipantPrivate::addDevice (const IdentityAddress &gruu) {
shared_ptr<ParticipantDevice> device = findDevice(gruu);
if (device)
return device;
device = make_shared<ParticipantDevice>(gruu);
devices.push_back(device);
return device;
}
void ParticipantPrivate::clearDevices () {
devices.clear();
}
shared_ptr<ParticipantDevice> ParticipantPrivate::findDevice (const IdentityAddress &gruu) const {
for (const auto &device : devices) {
if (device->getAddress() == gruu)
......@@ -66,15 +79,6 @@ const list<shared_ptr<ParticipantDevice>> &ParticipantPrivate::getDevices () con
return devices;
}
shared_ptr<ParticipantDevice> ParticipantPrivate::addDevice (const IdentityAddress &gruu) {
shared_ptr<ParticipantDevice> device = findDevice(gruu);
if (device)
return device;
device = make_shared<ParticipantDevice>(gruu);
devices.push_back(device);
return device;
}
void ParticipantPrivate::removeDevice (const IdentityAddress &gruu) {
for (auto it = devices.begin(); it != devices.end(); it++) {
if ((*it)->getAddress() == gruu) {
......
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