Commit 1f15bc62 authored by Ghislain MARY's avatar Ghislain MARY

Do not create a fallback chatroom when invited to a group chat room.

parent edd26b98
......@@ -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<SalReferOp *>(op)->reply(SalReasonNone);
return;
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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<LinphonePrivate::ClientGroupChatRoom> cgcr = make_shared<LinphonePrivate::ClientGroupChatRoom>(
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);
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<LinphonePrivate::ClientGroupToBasicChatRoom>(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;
}
......
......@@ -150,7 +150,8 @@ shared_ptr<AbstractChatRoom> 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
)
);
}
......
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