diff --git a/submodules/linphone b/submodules/linphone index c0048ed88..030b1c05d 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit c0048ed884a411dc29f92daf7bf4c6941074675a +Subproject commit 030b1c05d5d77dac2d34a1be1c98516a8fb9887a diff --git a/tests/src/components/chat/ChatModel.cpp b/tests/src/components/chat/ChatModel.cpp index b82a258c7..40fdee62e 100644 --- a/tests/src/components/chat/ChatModel.cpp +++ b/tests/src/components/chat/ChatModel.cpp @@ -251,7 +251,7 @@ void ChatModel::setSipAddress (const QString &sip_address) { // TODO: Remove me in a future linphone core version. if (message->getState() == linphone::ChatMessageStateInProgress) - map["status"] = linphone::ChatMessageStateDelivered; + map["status"] = linphone::ChatMessageStateNotDelivered; m_entries << qMakePair(map, static_pointer_cast(message)); } @@ -344,19 +344,29 @@ void ChatModel::resendMessage (int id) { } const ChatEntryData &entry = m_entries[id]; - if (entry.first["type"] != EntryType::MessageEntry) { + const QVariantMap &map = entry.first; + + if (map["type"] != EntryType::MessageEntry) { qWarning() << QStringLiteral("Unable to resend entry %1. It's not a message.").arg(id); return; } - shared_ptr message = static_pointer_cast(entry.second); - - switch (message->getState()) { + switch (map["status"].toInt()) { case MessageStatusFileTransferError: - case MessageStatusNotDelivered: - message->setListener(m_message_handlers); - m_chat_room->sendChatMessage(message); + case MessageStatusNotDelivered: { + shared_ptr message = static_pointer_cast(entry.second); + + // TODO: Remove workaround in a future linphone core version. + // `sendChatMessage` duplicates the message on resend. + shared_ptr message2 = message->clone(); + message2->setListener(m_message_handlers); + m_chat_room->sendChatMessage(message2); + + removeEntry(id); + insertMessageAtEnd(message2); + break; + } default: qWarning() << QStringLiteral("Unable to resend message: %1. Bad state.").arg(id);