mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 04:28:10 +00:00
Created a FileTransferChatMessageModifier, next step is to move into it file transfer related code from ChatMessage
This commit is contained in:
parent
f5fa5101fc
commit
fc2fe482ec
5 changed files with 103 additions and 0 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
46
src/chat/modifier/file-transfer-chat-message-modifier.cpp
Normal file
46
src/chat/modifier/file-transfer-chat-message-modifier.cpp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* 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
|
||||
42
src/chat/modifier/file-transfer-chat-message-modifier.h
Normal file
42
src/chat/modifier/file-transfer-chat-message-modifier.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* 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_
|
||||
Loading…
Add table
Reference in a new issue