Prevent application from being notified of error in creation of ClientGroupChatRoom in case of fallback to BasicChatRoom.

This commit is contained in:
Ghislain MARY 2018-01-25 14:19:39 +01:00
parent 359b7bde4b
commit a8955e1647
4 changed files with 23 additions and 1 deletions

View file

@ -69,10 +69,12 @@ public:
return;
if ((newState == CallSession::State::Error) && (cgcr->getState() == ChatRoom::State::CreationPending)
&& (session->getReason() == LinphoneReasonNotAcceptable) && (invitedAddresses.size() == 1)) {
teardownCallbacks();
cgcr->getPrivate()->onCallSessionStateChanged(session, newState, message);
cgcr->getPrivate()->setCallSessionListener(nullptr);
cgcr->getPrivate()->setChatRoomListener(nullptr);
Core::deleteChatRoom(q->getSharedFromThis());
setupCallbacks();
LinphoneChatRoom *lcr = L_GET_C_BACK_PTR(q);
shared_ptr<AbstractChatRoom> bcr = cgcr->getCore()->onlyGetOrCreateBasicChatRoom(invitedAddresses.front());
L_SET_CPP_PTR_FROM_C_OBJECT(lcr, bcr);

View file

@ -65,6 +65,7 @@ public:
}
void setupCallbacks ();
void teardownCallbacks ();
std::shared_ptr<AbstractChatRoom> chatRoom;

View file

@ -118,6 +118,26 @@ void ProxyChatRoomPrivate::setupCallbacks () {
linphone_chat_room_cbs_set_undecryptable_message_received(cbs, undecryptableMessageReceived);
}
void ProxyChatRoomPrivate::teardownCallbacks () {
LinphoneChatRoom *lcr = L_GET_C_BACK_PTR(chatRoom);
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(lcr);
linphone_chat_room_cbs_set_chat_message_received(cbs, nullptr);
linphone_chat_room_cbs_set_chat_message_sent(cbs, nullptr);
linphone_chat_room_cbs_set_conference_address_generation(cbs, nullptr);
linphone_chat_room_cbs_set_is_composing_received(cbs, nullptr);
linphone_chat_room_cbs_set_message_received(cbs, nullptr);
linphone_chat_room_cbs_set_participant_added(cbs, nullptr);
linphone_chat_room_cbs_set_participant_admin_status_changed(cbs, nullptr);
linphone_chat_room_cbs_set_participant_device_added(cbs, nullptr);
linphone_chat_room_cbs_set_participant_device_fetched(cbs, nullptr);
linphone_chat_room_cbs_set_participant_device_removed(cbs, nullptr);
linphone_chat_room_cbs_set_participant_removed(cbs, nullptr);
linphone_chat_room_cbs_set_participants_capabilities_checked(cbs, nullptr);
linphone_chat_room_cbs_set_state_changed(cbs, nullptr);
linphone_chat_room_cbs_set_subject_changed(cbs, nullptr);
linphone_chat_room_cbs_set_undecryptable_message_received(cbs, nullptr);
}
// -----------------------------------------------------------------------------
ProxyChatRoom::ProxyChatRoom (ProxyChatRoomPrivate &p, const shared_ptr<ChatRoom> &chatRoom) :

View file

@ -1557,7 +1557,6 @@ static void group_chat_room_fallback_to_basic_chat_room (void) {
// Check that the group chat room creation fails and that a fallback to a basic chat room is done
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreationPending, initialMarieStats.number_of_LinphoneChatRoomStateCreationPending + 1, 10000));
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreationFailed, initialMarieStats.number_of_LinphoneChatRoomStateCreationFailed + 1, 10000));
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreated, initialMarieStats.number_of_LinphoneChatRoomStateCreated + 1, 10000));
BC_ASSERT_EQUAL(linphone_chat_room_get_nb_participants(marieCr), 1, int, "%d");
BC_ASSERT_TRUE(linphone_chat_room_get_capabilities(marieCr) & LinphoneChatRoomCapabilitiesBasic);