Commit 9864b93e authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Fixed issue with chat message not having same pointer during send process if file upload

parent 0ed7d41d
......@@ -700,6 +700,7 @@ void ChatMessagePrivate::send () {
int errorCode = 0;
currentSendStep |= ChatMessagePrivate::Step::Started;
q->getChatRoom()->getPrivate()->addTransientChatMessage(q->getSharedFromThis());
if (toBeStored && currentSendStep == (ChatMessagePrivate::Step::Started | ChatMessagePrivate::Step::None))
storeInDb();
......@@ -804,6 +805,7 @@ void ChatMessagePrivate::send () {
currentSendStep = ChatMessagePrivate::Step::None;
restoreFileTransferContentAsFileContent();
setState(ChatMessage::State::NotDelivered); // Do it after the restore to have the correct message in db
q->getChatRoom()->getPrivate()->removeTransientChatMessage(q->getSharedFromThis());
return;
} else if (result == ChatMessageModifier::Result::Suspended) {
return;
......@@ -851,6 +853,7 @@ void ChatMessagePrivate::send () {
}
restoreFileTransferContentAsFileContent();
q->getChatRoom()->getPrivate()->removeTransientChatMessage(q->getSharedFromThis());
// Remove internal content as it is not needed anymore and will confuse some old methods like getContentType()
internalContent.setBody("");
......
......@@ -241,6 +241,7 @@ void FileTransferChatMessageModifier::processResponseFromPostFile (const belle_h
FileTransferContent *fileTransferContent = new FileTransferContent();
fileTransferContent->setContentType(ContentType::FileTransfer);
fileTransferContent->setFileSize(currentFileContentToTransfer->getFileSize()); // Copy file size information
fileTransferContent->setFilePath(currentFileContentToTransfer->getFilePath()); // Copy file path information
message->getPrivate()->addContent(fileTransferContent);
// shall we encrypt the file
......
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