diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index ad4dc533ac1e5efcb7c80f7245c747f03f74aa56..644428e5f14a78d5733df76d0b0c095ffa0fe19e 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -727,7 +727,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){ } else { LinphoneChatRoom *cr = L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(ChatRoomId(addr, IdentityAddress(op->get_to())))); if (!cr) - cr = _linphone_client_group_chat_room_new(lc, addr.asString().c_str(), nullptr); + cr = _linphone_client_group_chat_room_new(lc, addr.asString().c_str(), nullptr, FALSE); L_GET_CPP_PTR_FROM_C_OBJECT(cr)->join(); static_cast(op)->reply(SalReasonNone); return; diff --git a/coreapi/chat.c b/coreapi/chat.c index c07993bae0b8bb89d7cb3970664c9686f0bb9486..64f041fef16d1a4b3c2bde432f7ea0f52e0719dc 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -86,12 +86,6 @@ LinphoneChatRoom *linphone_core_create_client_group_chat_room (LinphoneCore *lc, return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->createClientGroupChatRoom(L_C_TO_STRING(subject))); } -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(); - return cr; -} - LinphoneChatRoom *_linphone_core_create_server_group_chat_room (LinphoneCore *lc, LinphonePrivate::SalCallOp *op) { return _linphone_server_group_chat_room_new(lc, op); } diff --git a/coreapi/private_functions.h b/coreapi/private_functions.h index d95a060aa832ef3417003832fc1ad916c745b41e..5065f2f7bda29b0dcbefffe0f34b5b7fb5f73893 100644 --- a/coreapi/private_functions.h +++ b/coreapi/private_functions.h @@ -275,7 +275,7 @@ void _linphone_proxy_config_unregister(LinphoneProxyConfig *obj); void _linphone_proxy_config_release_ops(LinphoneProxyConfig *obj); /*chat*/ -LinphoneChatRoom *_linphone_client_group_chat_room_new (LinphoneCore *core, const char *uri, const char *subject); +LinphoneChatRoom *_linphone_client_group_chat_room_new (LinphoneCore *core, const char *uri, const char *subject, bool_t fallback); LinphoneChatRoom *_linphone_server_group_chat_room_new (LinphoneCore *core, LinphonePrivate::SalCallOp *op); void linphone_chat_room_set_call(LinphoneChatRoom *cr, LinphoneCall *call); LinphoneChatRoomCbs * linphone_chat_room_cbs_new (void); diff --git a/src/c-wrapper/api/c-chat-room.cpp b/src/c-wrapper/api/c-chat-room.cpp index 3099f1c03f0c52360b7e2cac61ad3959a3f3865f..56b6566ea5b4b2098d2a3bd7479d4cb5029feb8a 100644 --- a/src/c-wrapper/api/c-chat-room.cpp +++ b/src/c-wrapper/api/c-chat-room.cpp @@ -409,7 +409,7 @@ void linphone_chat_room_set_user_data (LinphoneChatRoom *cr, void *ud) { // Constructor and destructor functions. // ============================================================================= -LinphoneChatRoom *_linphone_client_group_chat_room_new (LinphoneCore *core, const char *uri, const char *subject) { +LinphoneChatRoom *_linphone_client_group_chat_room_new (LinphoneCore *core, const char *uri, const char *subject, bool_t fallback) { LinphoneAddress *addr = linphone_address_new(uri); LinphoneProxyConfig *proxy = linphone_core_lookup_known_proxy(core, addr); linphone_address_unref(addr); @@ -427,15 +427,18 @@ LinphoneChatRoom *_linphone_client_group_chat_room_new (LinphoneCore *core, cons if (from.empty()) from = linphone_core_get_primary_contact(core); LinphonePrivate::IdentityAddress me(from); - // Create a ClientGroupToBasicChatRoom to handle fallback from ClientGroupChatRoom to BasicGroupChatRoom if - // only one participant is invited and that it does not support group chat shared_ptr cgcr = make_shared( L_GET_CPP_PTR_FROM_C_OBJECT(core), L_C_TO_STRING(uri), me, L_C_TO_STRING(subject)); - L_GET_PRIVATE(cgcr)->setState(LinphonePrivate::ChatRoom::State::Instantiated); LinphoneChatRoom *cr = L_INIT(ChatRoom); - L_SET_CPP_PTR_FROM_C_OBJECT(cr, make_shared(cgcr)); - L_GET_PRIVATE(cgcr)->setCallSessionListener(L_GET_PRIVATE_FROM_C_OBJECT(cr)); - L_GET_PRIVATE(cgcr)->setChatRoomListener(L_GET_PRIVATE_FROM_C_OBJECT(cr)); + if (fallback) { + // Create a ClientGroupToBasicChatRoom to handle fallback from ClientGroupChatRoom to BasicGroupChatRoom if + // only one participant is invited and that it does not support group chat + L_SET_CPP_PTR_FROM_C_OBJECT(cr, make_shared(cgcr)); + L_GET_PRIVATE(cgcr)->setCallSessionListener(L_GET_PRIVATE_FROM_C_OBJECT(cr)); + L_GET_PRIVATE(cgcr)->setChatRoomListener(L_GET_PRIVATE_FROM_C_OBJECT(cr)); + } else + L_SET_CPP_PTR_FROM_C_OBJECT(cr, cgcr); + L_GET_PRIVATE(cgcr)->setState(LinphonePrivate::ChatRoom::State::Instantiated); return cr; } diff --git a/src/core/core-chat-room.cpp b/src/core/core-chat-room.cpp index 3c92d662a6cd12dfdbbe269833817eed7c63754d..1386060c37f7fdcaae97e4f1d13c8f7a09bc7287 100644 --- a/src/core/core-chat-room.cpp +++ b/src/core/core-chat-room.cpp @@ -150,7 +150,8 @@ shared_ptr Core::createClientGroupChatRoom (const string &subj _linphone_client_group_chat_room_new( getCCore(), linphone_core_get_conference_factory_uri(getCCore()), - L_STRING_TO_C(subject) + L_STRING_TO_C(subject), + TRUE ) ); }