From b272c08e9b55a0271cd413c4e3bc0a5989dbd887 Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Tue, 8 Feb 2022 16:23:56 +0100 Subject: [PATCH] Fix bug preventing the sending of voice recording messages in some contexts --- Classes/ChatConversationView.m | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m index 8c33a4e4a..bf7d86be8 100644 --- a/Classes/ChatConversationView.m +++ b/Classes/ChatConversationView.m @@ -526,20 +526,26 @@ static UICompositeViewDescription *compositeDescription = nil; LOGW(@"Cannot send message: No chatroom"); return FALSE; } - + LinphoneChatMessage *msg = rootMessage; + BOOL basic = [ChatConversationView isBasicChatRoom:_chatRoom]; + if (!basic && message && message.length > 0) { + linphone_chat_message_add_utf8_text_content(msg, message.UTF8String); + } + if (externalUrl) { linphone_chat_message_set_external_body_url(msg, [[externalUrl absoluteString] UTF8String]); } - if (message && message.length > 0) { - if ([ChatConversationView isBasicChatRoom:_chatRoom]) - linphone_chat_message_send(linphone_chat_room_create_message_from_utf8(_chatRoom, message.UTF8String)); - else { - linphone_chat_message_add_utf8_text_content(msg, message.UTF8String); - linphone_chat_message_send(msg); - } + bctbx_list_t const *contentList = linphone_chat_message_get_contents(msg); + if (bctbx_list_size(contentList) > 0) { + linphone_chat_message_send(msg); } + + if (basic && message && message.length > 0) { + linphone_chat_message_send(linphone_chat_room_create_message_from_utf8(_chatRoom, message.UTF8String)); + } + return TRUE; }