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

Removed cFileTransferContent to use only Content objects in chat-message.cpp...

Removed cFileTransferContent to use only Content objects in chat-message.cpp for file transfer. Fix upload when not using file body handler to do
parent 120117f7
......@@ -81,7 +81,7 @@ public:
std::string getSalCustomHeaderValue(const std::string& name);
// -----------------------------------------------------------------------------
// Methods only used for C wrapper, to be removed some day...
// Deprecated methods only used for C wrapper, to be removed some day...
// -----------------------------------------------------------------------------
const ContentType &getContentType();
......@@ -91,7 +91,7 @@ public:
void setText(const std::string &text);
LinphoneContent *getFileTransferInformation() const;
void setFileTransferInformation(LinphoneContent *content);
void setFileTransferInformation(const LinphoneContent *content);
// -----------------------------------------------------------------------------
// Need to be public to be called from static C callbacks
......@@ -138,6 +138,7 @@ private:
bool isReadOnly = false;
std::list<Content > contents;
Content internalContent;
Content *currentFileTransferContent;
std::unordered_map<std::string, std::string> customHeaders;
mutable LinphoneErrorInfo * errorInfo = nullptr;
belle_http_request_t *httpRequest = nullptr;
......@@ -150,8 +151,6 @@ private:
// Cache for returned values, used for compatibility with previous C API
ContentType cContentType;
std::string cText;
// Used for compatibility with previous C API
LinphoneContent *cFileTransferInformation = nullptr;
// -----------------------------------------------------------------------------
......
This diff is collapsed.
......@@ -459,7 +459,7 @@ shared_ptr<ChatMessage> ChatRoom::createFileTransferMessage (const LinphoneConte
shared_ptr<ChatMessage> chatMessage = createMessage();
chatMessage->getPrivate()->setDirection(ChatMessage::Direction::Outgoing);
chatMessage->getPrivate()->setFileTransferInformation(linphone_content_copy(initialContent));
chatMessage->getPrivate()->setFileTransferInformation(initialContent);
return chatMessage;
}
......
......@@ -21,6 +21,7 @@
#include "object/clonable-object-p.h"
#include "content.h"
#include "linphone/core.h"
// =============================================================================
......@@ -153,4 +154,14 @@ bool Content::isValid() const {
return d->contentType.isValid() || d->body.empty();
}
LinphoneContent * Content::toLinphoneContent() const {
LinphoneContent* content;
content = linphone_core_create_content(NULL);
linphone_content_set_type(content, getContentType().getType().c_str());
linphone_content_set_subtype(content, getContentType().getSubType().c_str());
linphone_content_set_size(content, getSize());
linphone_content_set_name(content, getContentDisposition().c_str());
return content;
}
LINPHONE_END_NAMESPACE
......@@ -24,6 +24,7 @@
#include "object/app-data-container.h"
#include "object/clonable-object.h"
#include "linphone/content.h"
// =============================================================================
......@@ -63,6 +64,8 @@ public:
bool isEmpty () const;
LinphoneContent * toLinphoneContent() const;
static const Content Empty;
private:
......
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