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

Created a FileTransferChatMessageModifier, next step is to move into it file...

Created a FileTransferChatMessageModifier, next step is to move into it file transfer related code from ChatMessage
parent f5fa5101
......@@ -54,6 +54,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
chat/modifier/chat-message-modifier.h
chat/modifier/cpim-chat-message-modifier.h
chat/modifier/encryption-chat-message-modifier.h
chat/modifier/file-transfer-chat-message-modifier.h
chat/modifier/multipart-chat-message-modifier.h
chat/notification/imdn.h
chat/notification/is-composing-listener.h
......@@ -170,6 +171,7 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
chat/cpim/parser/cpim-parser.cpp
chat/modifier/cpim-chat-message-modifier.cpp
chat/modifier/encryption-chat-message-modifier.cpp
chat/modifier/file-transfer-chat-message-modifier.cpp
chat/modifier/multipart-chat-message-modifier.cpp
chat/notification/imdn.cpp
chat/notification/is-composing.cpp
......
......@@ -39,6 +39,7 @@ class ChatMessagePrivate : public ObjectPrivate {
friend class CpimChatMessageModifier;
friend class EncryptionChatMessageModifier;
friend class MultipartChatMessageModifier;
friend class FileTransferChatMessageModifier;
public:
enum Step {
......
......@@ -30,6 +30,7 @@
#include "chat/chat-room/real-time-text-chat-room.h"
#include "chat/modifier/cpim-chat-message-modifier.h"
#include "chat/modifier/encryption-chat-message-modifier.h"
#include "chat/modifier/file-transfer-chat-message-modifier.h"
#include "chat/modifier/multipart-chat-message-modifier.h"
#include "content/file-content.h"
#include "content/content.h"
......@@ -1256,6 +1257,17 @@ void ChatMessagePrivate::send () {
if ((currentSendStep & ChatMessagePrivate::Step::FileUpload) == ChatMessagePrivate::Step::FileUpload) {
lInfo() << "File upload step already done, skipping";
} else {
// TODO
/*FileTransferChatMessageModifier ftcmm;
ChatMessageModifier::Result result = ftcmm.encode(q->getSharedFromThis(), errorCode);
if (result == ChatMessageModifier::Result::Error) {
return;
} else if (result == ChatMessageModifier::Result::Suspended) {
setState(ChatMessage::State::InProgress);
return;
}
currentSendStep |= ChatMessagePrivate::Step::FileUpload;*/
currentFileContentToTransfer = nullptr;
// For each FileContent, upload it and create a FileTransferContent
for (Content *content : contents) {
......
/*
* file-transfer-chat-message-modifier.cpp
* Copyright (C) 2010-2017 Belledonne Communications SARL
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "address/address.h"
#include "chat/chat-message/chat-message-p.h"
#include "content/content-type.h"
#include "content/content.h"
#include "logger/logger.h"
#include "file-transfer-chat-message-modifier.h"
// =============================================================================
using namespace std;
LINPHONE_BEGIN_NAMESPACE
ChatMessageModifier::Result FileTransferMessageModifier::encode (const shared_ptr<ChatMessage> &message, int &errorCode) {
chatMessage = message;
return ChatMessageModifier::Result::Done;
}
ChatMessageModifier::Result FileTransferMessageModifier::decode (const shared_ptr<ChatMessage> &message, int &errorCode) {
chatMessage = message;
return ChatMessageModifier::Result::Done;
}
LINPHONE_END_NAMESPACE
/*
* file-transfer-chat-message-modifier.h
* Copyright (C) 2010-2017 Belledonne Communications SARL
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _FILE_TRANSFER_CHAT_MESSAGE_MODIFIER_H_
#define _FILE_TRANSFER_CHAT_MESSAGE_MODIFIER_H_
#include "chat-message-modifier.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class FileTransferMessageModifier : public ChatMessageModifier {
public:
FileTransferMessageModifier () = default;
Result encode (const std::shared_ptr<ChatMessage> &message, int &errorCode) override;
Result decode (const std::shared_ptr<ChatMessage> &message, int &errorCode) override;
private:
std::shared_ptr<ChatMessage> chatMessage;
};
LINPHONE_END_NAMESPACE
#endif // ifndef _FILE_TRANSFER_CHAT_MESSAGE_MODIFIER_H_
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