mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-25 23:28:09 +00:00
Fixed issue when downloading a file from a chat message loaded from database (and thus locked)
This commit is contained in:
parent
30380ff39e
commit
12f0e6c1ed
3 changed files with 16 additions and 5 deletions
|
|
@ -138,6 +138,9 @@ public:
|
|||
|
||||
LinphoneContent *getFileTransferInformation () const;
|
||||
void setFileTransferInformation (const LinphoneContent *content);
|
||||
|
||||
void addContent (Content &content);
|
||||
void removeContent (const Content &content);
|
||||
|
||||
bool downloadFile ();
|
||||
|
||||
|
|
|
|||
|
|
@ -371,6 +371,14 @@ bool ChatMessagePrivate::downloadFile () {
|
|||
return false;
|
||||
}
|
||||
|
||||
void ChatMessagePrivate::addContent (Content &content) {
|
||||
getContents().push_back(&content);
|
||||
}
|
||||
|
||||
void ChatMessagePrivate::removeContent (const Content &content) {
|
||||
getContents().remove(&const_cast<Content &>(content));
|
||||
}
|
||||
|
||||
void ChatMessagePrivate::loadFileTransferUrlFromBodyToContent() {
|
||||
L_Q();
|
||||
int errorCode = 0;
|
||||
|
|
@ -718,7 +726,7 @@ void ChatMessagePrivate::send () {
|
|||
if (content->getContentType() == ContentType::FileTransfer) {
|
||||
FileTransferContent *fileTransferContent = (FileTransferContent *)content;
|
||||
it = contents.erase(it);
|
||||
q->addContent(*fileTransferContent->getFileContent());
|
||||
addContent(*fileTransferContent->getFileContent());
|
||||
delete fileTransferContent;
|
||||
} else {
|
||||
it++;
|
||||
|
|
@ -962,13 +970,13 @@ const list<Content *> &ChatMessage::getContents () const {
|
|||
void ChatMessage::addContent (Content &content) {
|
||||
L_D();
|
||||
if (!d->isReadOnly)
|
||||
d->getContents().push_back(&content);
|
||||
d->addContent(content);
|
||||
}
|
||||
|
||||
void ChatMessage::removeContent (const Content &content) {
|
||||
L_D();
|
||||
if (!d->isReadOnly)
|
||||
d->getContents().remove(&const_cast<Content &>(content));
|
||||
d->removeContent(content);
|
||||
}
|
||||
|
||||
const Content &ChatMessage::getInternalContent () const {
|
||||
|
|
|
|||
|
|
@ -750,12 +750,12 @@ void FileTransferChatMessageModifier::onRecvEnd (belle_sip_user_body_handler_t *
|
|||
if (retval <= 0 && message->getState() != ChatMessage::State::FileTransferError) {
|
||||
// Remove the FileTransferContent from the message and store the FileContent
|
||||
FileContent *fileContent = currentFileContentToTransfer;
|
||||
message->addContent(*fileContent);
|
||||
message->getPrivate()->addContent(*fileContent);
|
||||
for (Content *content : message->getContents()) {
|
||||
if (content->getContentType() == ContentType::FileTransfer) {
|
||||
FileTransferContent *fileTransferContent = (FileTransferContent*)content;
|
||||
if (fileTransferContent->getFileContent() == fileContent) {
|
||||
message->removeContent(*content);
|
||||
message->getPrivate()->removeContent(*content);
|
||||
delete fileTransferContent;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue