...
 
Commits (3)
......@@ -143,6 +143,7 @@ void BasicToClientGroupChatRoom::migrate(const std::shared_ptr<ClientGroupChatRo
shared_ptr<BasicToClientGroupChatRoom> btcgcr = static_pointer_cast<BasicToClientGroupChatRoom>(chatRoom);
btcgcr->getCore()->getPrivate()->replaceChatRoom(chatRoom, clientGroupChatRoom);
btcgcr->getPrivate()->chatRoom = clientGroupChatRoom;
btcgcr->getPrivate()->setupProxy();
} else {
LinphoneChatRoom *lcr = L_GET_C_BACK_PTR(chatRoom);
L_SET_CPP_PTR_FROM_C_OBJECT(lcr, clientGroupChatRoom);
......
......@@ -99,9 +99,10 @@ public:
ConferenceId conferenceId;
private:
protected:
AbstractChatRoom *proxyChatRoom = nullptr;
private:
ChatRoom::State state = ChatRoom::State::None;
time_t creationTime = std::time(nullptr);
......
......@@ -161,7 +161,7 @@ void ClientGroupChatRoomPrivate::onChatRoomInsertInDatabaseRequested (const shar
void ClientGroupChatRoomPrivate::onChatRoomDeleteRequested (const shared_ptr<AbstractChatRoom> &chatRoom) {
L_Q();
q->getCore()->deleteChatRoom(q->getSharedFromThis());
q->getCore()->deleteChatRoom(chatRoom);
setState(ClientGroupChatRoom::State::Deleted);
}
......@@ -403,7 +403,7 @@ void ClientGroupChatRoom::deleteFromDb () {
leave();
return;
}
d->chatRoomListener->onChatRoomDeleteRequested(getSharedFromThis());
d->chatRoomListener->onChatRoomDeleteRequested(d->proxyChatRoom ? d->proxyChatRoom->getSharedFromThis() : getSharedFromThis());
}
list<shared_ptr<EventLog>> ClientGroupChatRoom::getHistory (int nLast) const {
......@@ -674,7 +674,7 @@ void ClientGroupChatRoom::onConferenceTerminated (const IdentityAddress &addr) {
if (d->deletionOnTerminationEnabled) {
d->deletionOnTerminationEnabled = false;
d->chatRoomListener->onChatRoomDeleteRequested(getSharedFromThis());
d->chatRoomListener->onChatRoomDeleteRequested(d->proxyChatRoom ? d->proxyChatRoom->getSharedFromThis() : getSharedFromThis());
}
}
......@@ -692,8 +692,18 @@ void ClientGroupChatRoom::onFirstNotifyReceived (const IdentityAddress &addr) {
if (getParticipantCount() == 1 && d->capabilities & ClientGroupChatRoom::Capabilities::OneToOne) {
ConferenceId id(getParticipants().front()->getAddress(), getMe()->getAddress());
chatRoom = getCore()->findChatRoom(id);
if (chatRoom && (chatRoom->getCapabilities() & ChatRoom::Capabilities::Basic))
performMigration = true;
if (chatRoom) {
auto capabilities = chatRoom->getCapabilities();
bool migrationEnabled = !!linphone_config_get_int(
linphone_core_get_config(getCore()->getCCore()),
"misc",
"enable_basic_to_client_group_chat_room_migration",
FALSE
);
if (migrationEnabled && (capabilities & ChatRoom::Capabilities::Basic) && (capabilities & ChatRoom::Capabilities::Migratable)) {
performMigration = true;
}
}
}
if (performMigration)
......@@ -883,4 +893,9 @@ void ClientGroupChatRoom::onParticipantDeviceRemoved (const shared_ptr<Conferenc
_linphone_chat_room_notify_participant_device_removed(cr, L_GET_C_BACK_PTR(event));
}
void ClientGroupChatRoom::onParticipantsCleared () {
L_D_T(RemoteConference, dConference);
dConference->participants.clear();
}
LINPHONE_END_NAMESPACE
......@@ -127,6 +127,8 @@ private:
void onParticipantSetAdmin (const std::shared_ptr<ConferenceParticipantEvent> &event, bool isFullState) override;
void onSubjectChanged (const std::shared_ptr<ConferenceSubjectEvent> &event, bool isFullState) override;
void onParticipantsCleared () override;
L_DECLARE_PRIVATE(ClientGroupChatRoom);
L_DISABLE_COPY(ClientGroupChatRoom);
};
......
......@@ -538,7 +538,7 @@ void ServerGroupChatRoomPrivate::addParticipantDevice (const shared_ptr<Particip
inviteDevice(device);
break;
case ParticipantDevice::State::Left:
if (!findFilteredParticipant(participant->getAddress()))
if (findFilteredParticipant(participant->getAddress()))
inviteDevice(device);
break;
case ParticipantDevice::State::Leaving:
......
......@@ -55,7 +55,7 @@ private:
};
inline std::ostream &operator<< (std::ostream &os, const ConferenceId &conferenceId) {
os << "ConferenceId(" << conferenceId.getPeerAddress() << ", local=" << conferenceId.getLocalAddress() << ")";
os << "ConferenceId(peer=" << conferenceId.getPeerAddress() << ", local=" << conferenceId.getLocalAddress() << ")";
return os;
}
......
......@@ -44,6 +44,8 @@ public:
virtual void onSubjectChanged (const std::shared_ptr<ConferenceSubjectEvent> &event, bool isFullState) {}
virtual void onParticipantDeviceAdded (const std::shared_ptr<ConferenceParticipantDeviceEvent> &event, bool isFullState) {}
virtual void onParticipantDeviceRemoved (const std::shared_ptr<ConferenceParticipantDeviceEvent> &event, bool isFullState) {}
virtual void onParticipantsCleared () {}
};
LINPHONE_END_NAMESPACE
......
......@@ -95,9 +95,11 @@ void RemoteConferenceEventHandlerPrivate::simpleNotifyReceived (const string &xm
}
}
if (isFullState)
confListener->onParticipantsCleared();
auto &users = confInfo->getUsers();
if (!users.present())
return;
if (!users.present()) return;
// 4. Notify changes on users.
for (auto &user : users->getUser()) {
......@@ -150,7 +152,7 @@ void RemoteConferenceEventHandlerPrivate::simpleNotifyReceived (const string &xm
for (const auto &endpoint : user.getEndpoint()) {
if (!endpoint.getEntity().present())
break;
continue;
Address gruu(endpoint.getEntity().get());
StateType state = endpoint.getState();
......
......@@ -201,7 +201,7 @@ void CorePrivate::replaceChatRoom (const shared_ptr<AbstractChatRoom> &replacedC
const ConferenceId &newConferenceId = newChatRoom->getConferenceId();
if (replacedChatRoom->getCapabilities() & ChatRoom::Capabilities::Proxy) {
chatRooms.remove(newChatRoom);
chatRoomsById.erase(newConferenceId);
chatRoomsById.erase(replacedConferenceId);
chatRoomsById[newConferenceId] = replacedChatRoom;
} else {
chatRooms.remove(replacedChatRoom);
......
This diff is collapsed.