Commit 53c83d35 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Fixed ChatRoom state changed with Created state before RAM insertion breaking find

parent 94c08dce
......@@ -799,6 +799,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
} else {
LinphoneChatRoom *cr = _linphone_client_group_chat_room_new(lc, addr.asString().c_str(), nullptr);
L_GET_CPP_PTR_FROM_C_OBJECT(cr)->join();
L_GET_PRIVATE(lc->cppCore)->insertChatRoom(L_GET_CPP_PTR_FROM_C_OBJECT(cr));
L_GET_PRIVATE_FROM_C_OBJECT(cr)->setState(LinphonePrivate::ChatRoom::State::Created);
L_GET_PRIVATE(lc->cppCore)->insertChatRoomWithDb(L_GET_CPP_PTR_FROM_C_OBJECT(cr));
static_cast<SalReferOp *>(op)->reply(SalReasonNone);
......
......@@ -82,12 +82,14 @@ LinphoneChatRoom *linphone_core_create_client_group_chat_room (LinphoneCore *lc,
LinphoneChatRoom *_linphone_core_join_client_group_chat_room (LinphoneCore *lc, const LinphonePrivate::Address &addr) {
LinphoneChatRoom *cr = _linphone_client_group_chat_room_new(lc, addr.asString().c_str(), nullptr);
L_GET_CPP_PTR_FROM_C_OBJECT(cr)->join();
L_GET_PRIVATE(lc->cppCore)->insertChatRoom(L_GET_CPP_PTR_FROM_C_OBJECT(cr));
L_GET_PRIVATE(lc->cppCore)->insertChatRoomWithDb(L_GET_CPP_PTR_FROM_C_OBJECT(cr));
return cr;
}
LinphoneChatRoom *_linphone_core_create_server_group_chat_room (LinphoneCore *lc, LinphonePrivate::SalCallOp *op) {
LinphoneChatRoom *cr = _linphone_server_group_chat_room_new(lc, op);
L_GET_PRIVATE(lc->cppCore)->insertChatRoom(L_GET_CPP_PTR_FROM_C_OBJECT(cr));
L_GET_PRIVATE(lc->cppCore)->insertChatRoomWithDb(L_GET_CPP_PTR_FROM_C_OBJECT(cr));
return cr;
}
......
......@@ -254,6 +254,7 @@ void ClientGroupChatRoom::onConferenceCreated (const Address &addr) {
L_D_T(RemoteConference, dConference);
dConference->conferenceAddress = addr;
d->peerAddress = addr;
d->core->cppCore->getPrivate()->insertChatRoom(getSharedFromThis());
d->setState(ChatRoom::State::Created);
d->core->cppCore->getPrivate()->insertChatRoomWithDb(getSharedFromThis());
}
......
......@@ -66,6 +66,7 @@ shared_ptr<ChatRoom> CorePrivate::createChatRoom (const Address &peerAddress, bo
chatRoom = ObjectFactory::create<BasicChatRoom>(cCore, peerAddress);
ChatRoomPrivate *dChatRoom = chatRoom->getPrivate();
insertChatRoom(chatRoom);
dChatRoom->setState(ChatRoom::State::Instantiated);
dChatRoom->setState(ChatRoom::State::Created);
......@@ -74,7 +75,6 @@ shared_ptr<ChatRoom> CorePrivate::createChatRoom (const Address &peerAddress, bo
void CorePrivate::insertChatRoom (const shared_ptr<ChatRoom> &chatRoom) {
L_ASSERT(chatRoom);
L_ASSERT(chatRoom->getState() == ChatRoom::State::Created);
Address cleanedPeerAddress = getCleanedPeerAddress(chatRoom->getPeerAddress());
......@@ -104,7 +104,7 @@ void CorePrivate::deleteChatRoom (const string &peerAddress) {
}
void CorePrivate::insertChatRoomWithDb (const shared_ptr<ChatRoom> &chatRoom) {
insertChatRoom(chatRoom);
L_ASSERT(chatRoom->getState() == ChatRoom::State::Created);
ChatRoom::CapabilitiesMask capabilities = chatRoom->getCapabilities();
mainDb->insertChatRoom(
......
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