Commit 1207501d authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Started to restore external body url feature in chat message

parent a244da20
......@@ -108,7 +108,7 @@ const char *linphone_chat_message_get_external_body_url(const LinphoneChatMessag
}
void linphone_chat_message_set_external_body_url(LinphoneChatMessage *msg, const char *url) {
L_GET_PRIVATE_FROM_C_OBJECT(msg)->setExternalBodyUrl(L_C_TO_STRING(url));
}
time_t linphone_chat_message_get_time(const LinphoneChatMessage *msg) {
......
......@@ -105,6 +105,7 @@ public:
std::string getSalCustomHeaderValue (const std::string &name);
void loadFileTransferUrlFromBodyToContent ();
std::string createFakeFileTransferFromUrl(const std::string &url);
void setChatRoom (const std::shared_ptr<AbstractChatRoom> &chatRoom);
......@@ -127,6 +128,7 @@ public:
void setAppdata (const std::string &appData);
const std::string &getExternalBodyUrl () const;
void setExternalBodyUrl (const std::string &url);
bool hasTextContent () const;
const Content* getTextContent () const;
......
......@@ -263,6 +263,10 @@ const string &ChatMessagePrivate::getExternalBodyUrl () const {
return Utils::getEmptyConstRefObject<string>();
}
void ChatMessagePrivate::setExternalBodyUrl (const string &url) {
//TODO
}
const ContentType &ChatMessagePrivate::getContentType () {
loadContentsFromDatabase();
if (direction == ChatMessage::Direction::Incoming) {
......@@ -390,6 +394,10 @@ void ChatMessagePrivate::loadFileTransferUrlFromBodyToContent() {
fileTransferChatMessageModifier.decode(q->getSharedFromThis(), errorCode);
}
std::string ChatMessagePrivate::createFakeFileTransferFromUrl(const std::string &url) {
return fileTransferChatMessageModifier.createFakeFileTransferFromUrl(url);
}
void ChatMessagePrivate::setChatRoom (const shared_ptr<AbstractChatRoom> &cr) {
chatRoom = cr;
chatRoomId = cr->getChatRoomId();
......
......@@ -193,8 +193,13 @@ LinphoneReason ChatRoomPrivate::onSipMessageReceived (SalOp *op, const SalMessag
);
Content content;
content.setContentType(message->content_type);
content.setBodyFromUtf8(message->text ? message->text : "");
if (message->url && strcmp(message->content_type, ContentType::ExternalBody.asString().c_str()) == 0) {
content.setContentType(ContentType::FileTransfer);
content.setBody(msg->getPrivate()->createFakeFileTransferFromUrl(message->url));
} else {
content.setContentType(message->content_type);
content.setBodyFromUtf8(message->text ? message->text : "");
}
msg->setInternalContent(content);
msg->getPrivate()->setTime(message->time);
......
......@@ -968,4 +968,8 @@ void FileTransferChatMessageModifier::releaseHttpRequest () {
}
}
string FileTransferChatMessageModifier::createFakeFileTransferFromUrl(const string &url) {
return ""; //TODO
}
LINPHONE_END_NAMESPACE
......@@ -63,6 +63,7 @@ public:
int downloadFile(const std::shared_ptr<ChatMessage> &message, FileTransferContent *fileTransferContent);
void cancelFileTransfer();
bool isFileTransferInProgressAndValid();
std::string createFakeFileTransferFromUrl(const std::string &url);
private:
int uploadFile();
......
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