Commit f00a5b0c authored by Ronan's avatar Ronan Committed by Ronan

fix(callbacks): avoid invalid cast to client group chat room if a chat room was created as basic

parent 7d8de88f
Pipeline #439 failed with stage
in 0 seconds
......@@ -140,11 +140,16 @@ static void call_received(SalCallOp *h) {
shared_ptr<AbstractChatRoom> chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(
ChatRoomId(IdentityAddress(h->getFrom()), IdentityAddress(h->getTo()))
);
if (!chatRoom) {
if (chatRoom && chatRoom->getCapabilities() & ChatRoom::Capabilities::Basic) {
lError() << "Invalid basic chat room found. It should have been a ClientGroupChatRoom... Recreating it...";
chatRoom->deleteFromDb();
chatRoom.reset();
}
if (!chatRoom)
chatRoom = L_GET_PRIVATE_FROM_C_OBJECT(lc)->createClientGroupChatRoom(
h->getSubject(), h->getRemoteContact(), h->getRemoteBody(), false
);
}
const char *oneToOneChatRoomStr = sal_custom_header_find(h->getRecvCustomHeaders(), "One-To-One-Chat-Room");
if (oneToOneChatRoomStr && (strcmp(oneToOneChatRoomStr, "true") == 0))
L_GET_PRIVATE(static_pointer_cast<ClientGroupChatRoom>(chatRoom))->addOneToOneCapability();
......
......@@ -234,7 +234,7 @@ namespace Private {
>::type * \
>(CLASS::mPrivate);
// Get Private data of class in a multiple inheritance case.
// Get Public data of class in a multiple inheritance case.
#define L_Q_T(CLASS, NAME) \
auto const NAME = static_cast< \
LinphonePrivate::Private::AddConstMirror< \
......
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