Commit c48f0f70 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Fixed fileTransferContent values not being set from content's body when fetched from db

parent 8f1ee5a0
......@@ -86,6 +86,8 @@ public:
void removeSalCustomHeader(const std::string& name);
std::string getSalCustomHeaderValue(const std::string& name);
void loadFileTransferUrlFromBodyToContent();
// -----------------------------------------------------------------------------
// Deprecated methods only used for C wrapper, to be removed some day...
// -----------------------------------------------------------------------------
......
......@@ -305,6 +305,12 @@ bool ChatMessagePrivate::downloadFile () {
return false;
}
void ChatMessagePrivate::loadFileTransferUrlFromBodyToContent() {
L_Q();
int errorCode = 0;
fileTransferChatMessageModifier.decode(q->getSharedFromThis(), errorCode);
}
// -----------------------------------------------------------------------------
void ChatMessagePrivate::sendImdn (Imdn::Type imdnType, LinphoneReason reason) {
......@@ -375,7 +381,7 @@ LinphoneReason ChatMessagePrivate::receive () {
lInfo() << "File download step already done, skipping";
} else {
// This will check if internal content is FileTransfer and make the appropriate changes
fileTransferChatMessageModifier.decode(q->getSharedFromThis(), errorCode);
loadFileTransferUrlFromBodyToContent();
currentRecvStep |= ChatMessagePrivate::Step::FileUpload;
}
......
......@@ -440,6 +440,8 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
if (!chatRoom)
return nullptr;
bool hasFileTransferContent = false;
// 1 - Fetch chat message.
shared_ptr<ChatMessage> chatMessage = getChatMessageFromCache(eventId);
if (chatMessage)
......@@ -528,6 +530,12 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
}
}
// 3 - Load external body url from body into FileTransferContent if needed
if (hasFileTransferContent) {
ChatMessagePrivate *dChatMessage = chatMessage->getPrivate();
dChatMessage->loadFileTransferUrlFromBodyToContent();
}
cache(chatMessage, eventId);
end:
......
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