Commit 48f19110 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Fixed chat room creation returned value if participants list only contains...

Fixed chat room creation returned value if participants list only contains invalid addresses like ourselves
parent e2ead014
......@@ -362,8 +362,9 @@ LINPHONE_PUBLIC void linphone_chat_room_add_participant (LinphoneChatRoom *cr, c
* Use linphone_chat_room_can_handle_participants() to know if this chat room handles participants.
* @param[in] cr A #LinphoneChatRoom object
* @param[in] addresses \bctbx_list{LinphoneAddress}
* @return True if everything is OK, False otherwise
*/
LINPHONE_PUBLIC void linphone_chat_room_add_participants (LinphoneChatRoom *cr, const bctbx_list_t *addresses);
LINPHONE_PUBLIC bool_t linphone_chat_room_add_participants (LinphoneChatRoom *cr, const bctbx_list_t *addresses);
/**
* Tells whether a chat room is able to handle participants.
......
......@@ -291,12 +291,12 @@ void linphone_chat_room_add_participant (LinphoneChatRoom *cr, const LinphoneAdd
);
}
void linphone_chat_room_add_participants (LinphoneChatRoom *cr, const bctbx_list_t *addresses) {
bool_t linphone_chat_room_add_participants (LinphoneChatRoom *cr, const bctbx_list_t *addresses) {
list<LinphonePrivate::Address> lAddr = L_GET_RESOLVED_CPP_LIST_FROM_C_LIST(addresses, Address);
list<LinphonePrivate::IdentityAddress> lIdentAddr;
for (const auto &addr : lAddr)
lIdentAddr.push_back(LinphonePrivate::IdentityAddress(addr));
L_GET_CPP_PTR_FROM_C_OBJECT(cr)->addParticipants(lIdentAddr, nullptr, false);
return L_GET_CPP_PTR_FROM_C_OBJECT(cr)->addParticipants(lIdentAddr, nullptr, false);
}
bool_t linphone_chat_room_can_handle_participants (const LinphoneChatRoom *cr) {
......
......@@ -272,7 +272,10 @@ shared_ptr<AbstractChatRoom> CorePrivate::createChatRoom(const shared_ptr<ChatRo
return nullptr;
}
chatRoom->addParticipants(participants, nullptr, false);
if (!chatRoom->addParticipants(participants, nullptr, false)) {
lWarning() << "Couldn't add participants to newly created chat room, aborting";
return nullptr;
}
#else
lWarning() << "Advanced IM such as group chat is disabled!";
return nullptr;
......
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