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

Added C API for multi file transfer

parent 47f4ca4f
......@@ -165,6 +165,7 @@ LINPHONE_PUBLIC LinphoneChatRoom *linphone_chat_message_get_chat_room (const Lin
* Get the path to the file to read from or write to during the file transfer.
* @param[in] msg #LinphoneChatMessage object
* @return The path to the file to use for the file transfer.
* @deprecated use linphone_content_get_file_path() instead.
*/
LINPHONE_PUBLIC const char *linphone_chat_message_get_file_transfer_filepath (LinphoneChatMessage *msg);
......@@ -225,9 +226,9 @@ LINPHONE_PUBLIC void linphone_chat_message_set_external_body_url (LinphoneChatMe
LINPHONE_PUBLIC LinphoneContent *linphone_chat_message_get_file_transfer_information (LinphoneChatMessage *msg);
/**
* Return whether or not a chat message is a file tranfer.
* Return whether or not a chat message is a file transfer.
* @param[in] msg #LinphoneChatMessage object
* @return Whether or not the message is a file tranfer
* @return Whether or not the message is a file transfer
*/
LINPHONE_PUBLIC bool_t linphone_chat_message_is_file_transfer (LinphoneChatMessage *msg);
......@@ -256,9 +257,17 @@ LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_chat_message_start_file_downlo
/**
* Start the download of the file referenced in a #LinphoneChatMessage from remote server.
* @param[in] msg #LinphoneChatMessage object.
* @deprecated Use linphone_chat_message_download_content() instead
*/
LINPHONE_PUBLIC bool_t linphone_chat_message_download_file (LinphoneChatMessage *msg);
/**
* Start the download of the #LinphoneContent referenced in the #LinphoneChatMessage from remote server.
* @param[in] msg #LinphoneChatMessage object.
* @param[in] c_content #LinphoneContent object to download.
*/
LINPHONE_PUBLIC bool_t linphone_chat_message_download_content(LinphoneChatMessage *msg, LinphoneContent *c_content);
/**
* Cancel an ongoing file transfer attached to this message.(upload or download)
* @param[in] msg #LinphoneChatMessage object.
......@@ -333,6 +342,7 @@ LINPHONE_PUBLIC const LinphoneErrorInfo *linphone_chat_message_get_error_info (c
* Set the path to the file to read from or write to during the file transfer.
* @param[in] msg #LinphoneChatMessage object.
* @param[in] filepath The path to the file to use for the file transfer.
* @deprecated use linphone_content_set_file_path() instead.
*/
LINPHONE_PUBLIC void linphone_chat_message_set_file_transfer_filepath (LinphoneChatMessage *msg, const char *filepath);
......@@ -353,11 +363,32 @@ LINPHONE_PUBLIC LinphoneStatus linphone_chat_message_put_char (LinphoneChatMessa
LINPHONE_PUBLIC LinphoneChatMessageCbs *linphone_chat_message_get_callbacks (const LinphoneChatMessage *msg);
/**
* Adds a content to the ChatMessage
* Adds a file content to the ChatMessage.
* @param[in] msg #LinphoneChatMessage object.
* @param[in] c_content #LinphoneContent object to add.
*/
LINPHONE_PUBLIC void linphone_chat_message_add_file_content (LinphoneChatMessage *msg, LinphoneContent *c_content);
/**
* Adds a text content to the ChatMessage.
* @param[in] msg #LinphoneChatMessage object.
* @param[in] text The text to add to the message.
*/
LINPHONE_PUBLIC void linphone_chat_message_add_text_content (LinphoneChatMessage *msg, const char *text);
/**
* Removes a content from the ChatMessage.
* @param[in] msg #LinphoneChatMessage object.
* @param[in] content the #LinphoneContent object to remove.
*/
LINPHONE_PUBLIC void linphone_chat_message_remove_content (LinphoneChatMessage *msg, LinphoneContent *content);
/**
* Returns the list of contents in the message.
* @param[in] msg #LinphoneChatMessage object.
* @param[in] c_content #LinphoneContent object
* @return \bctbx_list{LinphoneContent} the list of #LinphoneContent.
*/
LINPHONE_PUBLIC void linphone_chat_message_add_text_content (LinphoneChatMessage *msg, const char *c_content);
LINPHONE_PUBLIC bctbx_list_t* linphone_chat_message_get_contents(const LinphoneChatMessage *msg);
/**
* Returns true if the chat message has a text content
......
......@@ -61,7 +61,14 @@ LINPHONE_PUBLIC void *linphone_chat_room_get_user_data(const LinphoneChatRoom *c
LINPHONE_PUBLIC void linphone_chat_room_set_user_data(LinphoneChatRoom *cr, void *ud);
/**
* Create a message attached to a dedicated chat room;
* Creates an empty message attached to a dedicated chat room.
* @param cr the chat room.
* @return a new #LinphoneChatMessage
*/
LINPHONE_PUBLIC LinphoneChatMessage *linphone_chat_room_create_empty_message (LinphoneChatRoom *cr);
/**
* Creates a message attached to a dedicated chat room.
* @param cr the chat room.
* @param message text message, NULL if absent.
* @return a new #LinphoneChatMessage
......@@ -69,7 +76,7 @@ LINPHONE_PUBLIC void linphone_chat_room_set_user_data(LinphoneChatRoom *cr, void
LINPHONE_PUBLIC LinphoneChatMessage* linphone_chat_room_create_message(LinphoneChatRoom *cr,const char* message);
/**
* Create a message attached to a dedicated chat room;
* Creates a message attached to a dedicated chat room.
* @param cr the chat room.
* @param message text message, NULL if absent.
* @param external_body_url the URL given in external body or NULL.
......@@ -84,7 +91,7 @@ LINPHONE_PUBLIC LinphoneChatMessage* linphone_chat_room_create_message(LinphoneC
LINPHONE_PUBLIC LinphoneChatMessage* linphone_chat_room_create_message_2(LinphoneChatRoom *cr, const char* message, const char* external_body_url, LinphoneChatMessageState state, time_t time, bool_t is_read, bool_t is_incoming);
/**
* Create a message attached to a dedicated chat room with a particular content.
* Creates a message attached to a dedicated chat room with a particular content.
* Use #linphone_chat_room_send_message to initiate the transfer
* @param cr the chat room.
* @param initial_content #LinphoneContent initial content. #LinphoneCoreVTable.file_transfer_send is invoked later to notify file transfer progress and collect next chunk of the message if LinphoneContent.data is NULL.
......
......@@ -236,6 +236,41 @@ LINPHONE_PUBLIC size_t linphone_content_get_key_size (const LinphoneContent *con
*/
LINPHONE_PUBLIC void linphone_content_set_key (LinphoneContent *content, const char *key, const size_t key_length);
/**
* Get the file transfer filepath set for this content (replace linphone_chat_message_get_file_transfer_filepath).
* @param[in] content #LinphoneContent object.
* @return The file path set for this content if it has been set, NULL otherwise.
*/
LINPHONE_PUBLIC const char *linphone_content_get_file_path (const LinphoneContent *content);
/**
* Set the file transfer filepath for this content (replace linphone_chat_message_set_file_transfer_filepath).
* @param[in] content #LinphoneContent object.
* @param[in] file_path the file transfer filepath.
*/
LINPHONE_PUBLIC void linphone_content_set_file_path (LinphoneContent *content, const char *file_path);
/**
* Tells whether or not this content contains text.
* @param[in] content #LinphoneContent object.
* @return True if this content contains plain text, false otherwise.
*/
LINPHONE_PUBLIC bool_t linphone_content_is_text (const LinphoneContent *content);
/**
* Tells whether or not this content contains a file.
* @param[in] content #LinphoneContent object.
* @return True if this content contains a file, false otherwise.
*/
LINPHONE_PUBLIC bool_t linphone_content_is_file (const LinphoneContent *content);
/**
* Tells whether or not this content is a file transfer.
* @param[in] content #LinphoneContent object.
* @return True if this content is a file transfer, false otherwise.
*/
LINPHONE_PUBLIC bool_t linphone_content_is_file_transfer (const LinphoneContent *content);
/**
* @}
*/
......
......@@ -47,6 +47,10 @@ public:
Address (const Address &other);
~Address ();
Address* clone () const override {
return new Address(*this);
}
Address &operator= (const Address &other);
bool operator== (const Address &other) const;
......
......@@ -38,6 +38,10 @@ public:
IdentityAddress (const IdentityAddress &other);
~IdentityAddress () = default;
IdentityAddress* clone () const override {
return new IdentityAddress(*this);
}
IdentityAddress &operator= (const IdentityAddress &other);
bool operator== (const IdentityAddress &other) const;
......
......@@ -203,10 +203,6 @@ void linphone_chat_message_set_to_be_stored (LinphoneChatMessage *message, bool_
// Methods
// =============================================================================
bool_t linphone_chat_message_download_file (LinphoneChatMessage *msg) {
return !!L_GET_PRIVATE_FROM_C_OBJECT(msg)->downloadFile();
}
void linphone_chat_message_cancel_file_transfer (LinphoneChatMessage *msg) {
L_GET_CPP_PTR_FROM_C_OBJECT(msg)->cancelFileTransfer();
}
......@@ -227,14 +223,37 @@ LinphoneStatus linphone_chat_message_put_char (LinphoneChatMessage *msg, uint32_
return ((LinphoneStatus)L_GET_CPP_PTR_FROM_C_OBJECT(msg)->putCharacter(character));
}
void linphone_chat_message_add_text_content (LinphoneChatMessage *msg, const char *c_content) {
void linphone_chat_message_add_file_content (LinphoneChatMessage *msg, LinphoneContent *c_content) {
LinphonePrivate::FileContent *fileContent = new LinphonePrivate::FileContent();
LinphonePrivate::ContentType contentType;
contentType.setType(L_C_TO_STRING(linphone_content_get_type(c_content)));
contentType.setSubType(L_C_TO_STRING(linphone_content_get_subtype(c_content)));
fileContent->setContentType(contentType);
fileContent->setFileSize(linphone_content_get_size(c_content));
fileContent->setFileName(linphone_content_get_name(c_content));
fileContent->setFilePath(linphone_content_get_file_path(c_content));
if (linphone_content_get_size(c_content) > 0) {
fileContent->setBody(linphone_content_get_string_buffer(c_content));
}
L_GET_CPP_PTR_FROM_C_OBJECT(msg)->addContent(fileContent);
}
void linphone_chat_message_add_text_content (LinphoneChatMessage *msg, const char *text) {
LinphonePrivate::Content *content = new LinphonePrivate::Content();
LinphonePrivate::ContentType contentType = LinphonePrivate::ContentType::PlainText;
content->setContentType(contentType);
content->setBody(L_C_TO_STRING(c_content));
content->setBody(L_C_TO_STRING(text));
L_GET_CPP_PTR_FROM_C_OBJECT(msg)->addContent(content);
}
void linphone_chat_message_remove_content (LinphoneChatMessage *msg, LinphoneContent *content) {
L_GET_CPP_PTR_FROM_C_OBJECT(msg)->removeContent(L_GET_CPP_PTR_FROM_C_OBJECT(content));
}
bctbx_list_t* linphone_chat_message_get_contents(const LinphoneChatMessage *msg) {
return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(L_GET_CPP_PTR_FROM_C_OBJECT(msg)->getContents());
}
bool_t linphone_chat_message_has_text_content (const LinphoneChatMessage *msg) {
return L_GET_PRIVATE_FROM_C_OBJECT(msg)->hasTextContent();
}
......@@ -255,6 +274,15 @@ bctbx_list_t *linphone_chat_message_get_participants_by_imdn_state (const Linpho
return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(L_GET_CPP_PTR_FROM_C_OBJECT(msg)->getParticipantsByImdnState(LinphonePrivate::ChatMessage::State(state)));
}
bool_t linphone_chat_message_download_content (LinphoneChatMessage *msg, LinphoneContent *c_content) {
LinphonePrivate::Content *content = L_GET_CPP_PTR_FROM_C_OBJECT(c_content);
if (!content->isFileTransfer()) {
lError() << "LinphoneContent isn't an instance of FileTransferContent";
return false;
}
LinphonePrivate::FileTransferContent *fileTransferContent = static_cast<LinphonePrivate::FileTransferContent* >(content);
return !!L_GET_CPP_PTR_FROM_C_OBJECT(msg)->downloadFile(fileTransferContent);
}
// =============================================================================
// Old listener
......@@ -304,6 +332,10 @@ LinphoneContent *linphone_chat_message_get_file_transfer_information (LinphoneCh
return NULL;
}
bool_t linphone_chat_message_download_file (LinphoneChatMessage *msg) {
return !!L_GET_PRIVATE_FROM_C_OBJECT(msg)->downloadFile();
}
// =============================================================================
// Nothing to do, they call other C API methods
// =============================================================================
......
......@@ -113,6 +113,13 @@ const LinphoneAddress *linphone_chat_room_get_local_address (LinphoneChatRoom *c
return cr->localAddressCache;
}
LinphoneChatMessage *linphone_chat_room_create_empty_message (LinphoneChatRoom *cr) {
shared_ptr<LinphonePrivate::ChatMessage> cppPtr = L_GET_CPP_PTR_FROM_C_OBJECT(cr)->createChatMessage();
LinphoneChatMessage *object = L_INIT(ChatMessage);
L_SET_CPP_PTR_FROM_C_OBJECT(object, cppPtr);
return object;
}
LinphoneChatMessage *linphone_chat_room_create_message (LinphoneChatRoom *cr, const char *message) {
shared_ptr<LinphonePrivate::ChatMessage> cppPtr = L_GET_CPP_PTR_FROM_C_OBJECT(cr)->createChatMessage(L_C_TO_STRING(message));
LinphoneChatMessage *object = L_INIT(ChatMessage);
......@@ -120,6 +127,12 @@ LinphoneChatMessage *linphone_chat_room_create_message (LinphoneChatRoom *cr, co
return object;
}
LinphoneChatMessage *linphone_chat_room_create_file_transfer_message(LinphoneChatRoom *cr, LinphoneContent *initial_content) {
LinphoneChatMessage *msg = linphone_chat_room_create_empty_message(cr);
linphone_chat_message_add_file_content(msg, initial_content);
return msg;
}
LinphoneChatMessage *linphone_chat_room_create_message_2 (
LinphoneChatRoom *cr,
const char *message,
......@@ -354,13 +367,6 @@ const bctbx_list_t *linphone_chat_room_get_composing_addresses (LinphoneChatRoom
return cr->composingAddresses;
}
LinphoneChatMessage *linphone_chat_room_create_file_transfer_message(LinphoneChatRoom *cr, LinphoneContent *initial_content) {
shared_ptr<LinphonePrivate::ChatMessage> cppPtr = L_GET_CPP_PTR_FROM_C_OBJECT(cr)->createFileTransferMessage(L_GET_CPP_PTR_FROM_C_OBJECT(initial_content));
LinphoneChatMessage *object = L_INIT(ChatMessage);
L_SET_CPP_PTR_FROM_C_OBJECT(object, cppPtr);
return object;
}
void linphone_chat_room_set_conference_address (LinphoneChatRoom *cr, const LinphoneAddress *confAddr) {
char *addrStr = linphone_address_as_string(confAddr);
LinphonePrivate::ServerGroupChatRoomPrivate *sgcr = dynamic_cast<LinphonePrivate::ServerGroupChatRoomPrivate *>(L_GET_PRIVATE_FROM_C_OBJECT(cr));
......
......@@ -48,6 +48,7 @@ L_DECLARE_C_CLONABLE_OBJECT_IMPL_WITH_XTORS(Content,
string type;
string subtype;
string buffer;
string file_path;
} mutable cache;
)
......@@ -242,6 +243,39 @@ void linphone_content_set_key (LinphoneContent *content, const char *key, const
}
}
const char *linphone_content_get_file_path (const LinphoneContent *content) {
const LinphonePrivate::Content *c = L_GET_CPP_PTR_FROM_C_OBJECT(content);
if (c->isFile())
return static_cast<const LinphonePrivate::FileContent *>(c)->getFilePath().c_str();
if (c->isFileTransfer())
return static_cast<const LinphonePrivate::FileTransferContent *>(c)->getFilePath().c_str();
return content->cache.file_path.c_str();
}
void linphone_content_set_file_path (LinphoneContent *content, const char *file_path) {
LinphonePrivate::Content *c = L_GET_CPP_PTR_FROM_C_OBJECT(content);
if (c->isFile())
static_cast<LinphonePrivate::FileContent *>(c)->setFilePath(L_C_TO_STRING(file_path));
if (c->isFileTransfer())
static_cast<LinphonePrivate::FileTransferContent *>(c)->setFilePath(L_C_TO_STRING(file_path));
content->cache.file_path = L_C_TO_STRING(file_path);
}
bool_t linphone_content_is_text (const LinphoneContent *content) {
const LinphonePrivate::Content *c = L_GET_CPP_PTR_FROM_C_OBJECT(content);
return c->getContentType() == LinphonePrivate::ContentType::PlainText;
}
bool_t linphone_content_is_file (const LinphoneContent *content) {
const LinphonePrivate::Content *c = L_GET_CPP_PTR_FROM_C_OBJECT(content);
return c->isFile(); // TODO FIXME this doesn't work when Content is from linphone_chat_message_get_contents() list
}
bool_t linphone_content_is_file_transfer (const LinphoneContent *content) {
const LinphonePrivate::Content *c = L_GET_CPP_PTR_FROM_C_OBJECT(content);
return c->isFileTransfer(); // TODO FIXME this doesn't work when Content is from linphone_chat_message_get_contents() list
}
// =============================================================================
// Private functions.
// =============================================================================
......
......@@ -577,6 +577,20 @@ public:
return result;
}
template<
typename CppType,
typename = typename std::enable_if<IsDefinedClonableCppObject<CppType>::value, CppType>::type
>
static inline bctbx_list_t *getResolvedCListFromCppList (const std::list<CppType *> &cppList) {
bctbx_list_t *result = nullptr;
for (const auto &value : cppList) {
auto cValue = getCBackPtr(value->clone());
reinterpret_cast<WrappedClonableObject<CppType> *>(cValue)->owner = WrappedObjectOwner::External;
result = bctbx_list_append(result, cValue);
}
return result;
}
template<
typename CType,
typename CppType = typename CTypeMetaInfo<CType>::cppType,
......
......@@ -145,9 +145,7 @@ public:
bool hasFileTransferContent () const;
const Content* getFileTransferContent () const;
const Content* getFileTransferInformation () const;
void setFileTransferInformation (Content *content);
void addContent (Content *content);
void removeContent (Content *content);
......
......@@ -375,25 +375,6 @@ const Content *ChatMessagePrivate::getFileTransferInformation () const {
return nullptr;
}
void ChatMessagePrivate::setFileTransferInformation (Content *content) {
L_Q();
if (content->isFile()) {
q->addContent(content);
} else {
// This scenario is more likely to happen because the caller is using the C API
LinphoneContent *c_content = L_GET_C_BACK_PTR(content);
FileContent *fileContent = new FileContent();
fileContent->setContentType(content->getContentType());
fileContent->setFileSize(linphone_content_get_size(c_content)); // This information is only available from C Content if it was created from C API
fileContent->setFileName(linphone_content_get_name(c_content)); // This information is only available from C Content if it was created from C API
if (!content->isEmpty()) {
fileContent->setBody(content->getBody());
}
q->addContent(fileContent);
}
}
bool ChatMessagePrivate::downloadFile () {
L_Q();
......
......@@ -37,6 +37,7 @@ LINPHONE_BEGIN_NAMESPACE
class AbstractChatRoom;
class Content;
class FileContent;
class FileTransferContent;
class ChatMessagePrivate;
class Participant;
......
......@@ -89,7 +89,7 @@ public:
virtual std::shared_ptr<ChatMessage> createChatMessage () = 0;
virtual std::shared_ptr<ChatMessage> createChatMessage (const std::string &text) = 0;
virtual std::shared_ptr<ChatMessage> createFileTransferMessage (Content *initialContent) = 0;
virtual std::shared_ptr<ChatMessage> createFileTransferMessage (FileContent *content) = 0;
virtual std::shared_ptr<ChatMessage> findChatMessage (const std::string &messageId) const = 0;
virtual std::shared_ptr<ChatMessage> findChatMessage (
......
......@@ -34,6 +34,10 @@ public:
ChatRoomId (const IdentityAddress &peerAddress, const IdentityAddress &localAddress);
ChatRoomId (const ChatRoomId &other);
ChatRoomId* clone () const override {
return new ChatRoomId(*this);
}
ChatRoomId &operator= (const ChatRoomId &other);
bool operator== (const ChatRoomId &other) const;
......
......@@ -474,9 +474,9 @@ shared_ptr<ChatMessage> ChatRoom::createChatMessage (const string &text) {
return chatMessage;
}
shared_ptr<ChatMessage> ChatRoom::createFileTransferMessage (Content *initialContent) {
shared_ptr<ChatMessage> ChatRoom::createFileTransferMessage (FileContent *content) {
shared_ptr<ChatMessage> chatMessage = createChatMessage();
chatMessage->getPrivate()->setFileTransferInformation(initialContent);
chatMessage->addContent(content);
return chatMessage;
}
......
......@@ -70,7 +70,7 @@ public:
std::shared_ptr<ChatMessage> createChatMessage () override;
std::shared_ptr<ChatMessage> createChatMessage (const std::string &text) override;
std::shared_ptr<ChatMessage> createFileTransferMessage (Content *initialContent) override;
std::shared_ptr<ChatMessage> createFileTransferMessage (FileContent *content) override;
std::shared_ptr<ChatMessage> findChatMessage (const std::string &messageId) const override;
std::shared_ptr<ChatMessage> findChatMessage (
......
......@@ -173,9 +173,9 @@ shared_ptr<ChatMessage> ProxyChatRoom::createChatMessage (const string &text) {
return d->chatRoom->createChatMessage(text);
}
shared_ptr<ChatMessage> ProxyChatRoom::createFileTransferMessage (Content *initialContent) {
shared_ptr<ChatMessage> ProxyChatRoom::createFileTransferMessage (FileContent *content) {
L_D();
return d->chatRoom->createFileTransferMessage(initialContent);
return d->chatRoom->createFileTransferMessage(content);
}
// -----------------------------------------------------------------------------
......
......@@ -66,7 +66,7 @@ public:
std::shared_ptr<ChatMessage> createChatMessage () override;
std::shared_ptr<ChatMessage> createChatMessage (const std::string &text) override;
std::shared_ptr<ChatMessage> createFileTransferMessage (Content *initialContent) override;
std::shared_ptr<ChatMessage> createFileTransferMessage (FileContent *content) override;
std::shared_ptr<ChatMessage> findChatMessage (const std::string &messageId) const override;
std::shared_ptr<ChatMessage> findChatMessage (
......
......@@ -43,6 +43,10 @@ public:
CallSessionParams (const CallSessionParams &other);
virtual ~CallSessionParams ();
CallSessionParams* clone () const override {
return new CallSessionParams(*this);
}
CallSessionParams &operator= (const CallSessionParams &other);
virtual void initDefault (const std::shared_ptr<Core> &core);
......
......@@ -41,6 +41,10 @@ public:
MediaSessionParams (const MediaSessionParams &other);
virtual ~MediaSessionParams ();
MediaSessionParams* clone () const override {
return new MediaSessionParams(*this);
}
MediaSessionParams &operator= (const MediaSessionParams &other);
void initDefault (const std::shared_ptr<Core> &core) override;
......
......@@ -35,6 +35,10 @@ public:
ParticipantImdnState (const std::shared_ptr<Participant> &participant, ChatMessage::State state, time_t stateChangeTime);
ParticipantImdnState (const ParticipantImdnState &other);
ParticipantImdnState* clone () const override {
return new ParticipantImdnState(*this);
}
std::shared_ptr<Participant> getParticipant () const;
ChatMessage::State getState () const;
time_t getStateChangeTime () const;
......
......@@ -33,6 +33,10 @@ public:
explicit ContentDisposition (const std::string &contentDisposition = "");
ContentDisposition (const ContentDisposition &other);
ContentDisposition* clone () const override {
return new ContentDisposition(*this);
}
ContentDisposition &operator= (const ContentDisposition &other);
bool weakEqual (const ContentDisposition &other) const;
......
......@@ -44,6 +44,10 @@ public:
Content (Content &&other);
~Content ();
Content* clone () const override {
return new Content(*this);
}
Content &operator= (const Content &other);
Content &operator= (Content &&other);
......
......@@ -34,6 +34,10 @@ public:
FileContent (const FileContent &other);
FileContent (FileContent &&other);
FileContent* clone () const override {
return new FileContent(*this);
}
FileContent &operator= (const FileContent &other);
FileContent &operator= (FileContent &&other);
......
......@@ -37,6 +37,10 @@ public:
FileTransferContent (const FileTransferContent &other);
FileTransferContent (FileTransferContent &&other);
FileTransferContent* clone () const override {
return new FileTransferContent(*this);
}
FileTransferContent &operator= (const FileTransferContent &other);
FileTransferContent &operator= (FileTransferContent &&other);
......
......@@ -34,6 +34,10 @@ public:
HeaderParam (const std::string &name, const std::string &value);
HeaderParam (const HeaderParam &other);
HeaderParam* clone () const override {
return new HeaderParam(*this);
}
HeaderParam &operator= (const HeaderParam &other);
bool operator== (const HeaderParam &other) const;
......
......@@ -38,6 +38,10 @@ public:
Header (const std::string &name, const std::string &value, const std::list<HeaderParam> &params);
Header (const Header &other);
Header* clone () const override {
return new Header(*this);
}
Header &operator= (const Header &other);
bool operator== (const Header &other) const;
......
......@@ -32,6 +32,10 @@ public:
MainDbChatMessageKey (const std::shared_ptr<Core> &core, long long storageId);
~MainDbChatMessageKey ();
MainDbChatMessageKey* clone () const override {
return new MainDbChatMessageKey(*this);
}
private:
L_DECLARE_PRIVATE(MainDbKey);
};
......
......@@ -32,6 +32,10 @@ public:
MainDbEventKey (const std::shared_ptr<Core> &core, long long storageId);
~MainDbEventKey ();
MainDbEventKey* clone () const override {
return new MainDbEventKey(*this);
}
private:
L_DECLARE_PRIVATE(MainDbKey);
};
......
......@@ -41,6 +41,10 @@ public:
);
DialPlan (const DialPlan &other);
DialPlan* clone () const override {
return new DialPlan(*this);
}
DialPlan &operator= (const DialPlan &other);
const std::string &getCountry () const;
......
......@@ -47,6 +47,8 @@ class LINPHONE_PUBLIC ClonableObject : public PropertyContainer {
public:
virtual ~ClonableObject ();
virtual ClonableObject* clone () const = 0;
protected:
explicit ClonableObject (ClonableObjectPrivate &p);
......
......@@ -38,6 +38,10 @@ public:
SearchResult(const SearchResult &other);
~SearchResult();
SearchResult* clone () const override {
return new SearchResult(*this);
}
bool operator<(const SearchResult &other) const;
bool operator>(const SearchResult &other) const;
bool operator>=(const SearchResult &other) const;
......
......@@ -43,6 +43,10 @@ public:
TestObject (const TestObject &src) : ClonableObject(*new TestObjectPrivate(*src.getPrivate())) {}
TestObject* clone () const override {
return new TestObject(*this);
}
private:
L_DECLARE_PRIVATE(TestObject);
};
......
......@@ -179,9 +179,11 @@ static void _send_file_plus_text(LinphoneChatRoom* cr, const char *sendFilepath,
linphone_content_set_type(content,"video");
linphone_content_set_subtype(content,"mkv");
linphone_content_set_name(content,"sintel_trailer_opus_h264.mkv");
linphone_content_set_file_path(content, sendFilepath);
msg = linphone_chat_room_create_file_transfer_message(cr, content);
linphone_chat_message_set_file_transfer_filepath(msg, sendFilepath);
msg = linphone_chat_room_create_empty_message(cr);
linphone_chat_message_add_file_content(msg, content);
linphone_content_unref(content);
if (text)
linphone_chat_message_add_text_content(msg, text);
......@@ -191,7 +193,6 @@ static void _send_file_plus_text(LinphoneChatRoom* cr, const char *sendFilepath,
linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
linphone_chat_message_cbs_set_file_transfer_progress_indication(cbs, file_transfer_progress_indication);
linphone_chat_message_send(msg);
linphone_content_unref(content);
linphone_chat_message_unref(msg);
}
......@@ -208,8 +209,11 @@ static void _receive_file(bctbx_list_t *coresList, LinphoneCoreManager *lcm, sta
linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
linphone_chat_message_cbs_set_file_transfer_recv(cbs, file_transfer_received);
linphone_chat_message_cbs_set_file_transfer_progress_indication(cbs, file_transfer_progress_indication);
linphone_chat_message_set_file_transfer_filepath(msg, receive_filepath);
linphone_chat_message_download_file(msg);
LinphoneContent *fileTransferContent = linphone_chat_message_get_file_transfer_information(msg);
BC_ASSERT_TRUE(linphone_content_is_file_transfer(fileTransferContent));
linphone_content_set_file_path(fileTransferContent, receive_filepath);
linphone_chat_message_download_content(msg, fileTransferContent);
if (BC_ASSERT_TRUE(wait_for_list(coresList, &lcm->stat.number_of_LinphoneFileTransferDownloadSuccessful,receiverStats->number_of_LinphoneFileTransferDownloadSuccessful + 1, 20000))) {
compare_files(sendFilepath, receive_filepath);
......@@ -229,8 +233,11 @@ static void _receive_file_plus_text(bctbx_list_t *coresList, LinphoneCoreManager
linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
linphone_chat_message_cbs_set_file_transfer_recv(cbs, file_transfer_received);
linphone_chat_message_cbs_set_file_transfer_progress_indication(cbs, file_transfer_progress_indication);
linphone_chat_message_set_file_transfer_filepath(msg, receive_filepath);
linphone_chat_message_download_file(msg);
LinphoneContent *fileTransferContent = linphone_chat_message_get_file_transfer_information(msg);
BC_ASSERT_TRUE(linphone_content_is_file_transfer(fileTransferContent));
linphone_content_set_file_path(fileTransferContent, receive_filepath);
linphone_chat_message_download_content(msg, fileTransferContent);
if (BC_ASSERT_TRUE(wait_for_list(coresList, &lcm->stat.number_of_LinphoneFileTransferDownloadSuccessful,receiverStats->number_of_LinphoneFileTransferDownloadSuccessful + 1, 20000))) {
compare_files(sendFilepath, receive_filepath);
......
......@@ -36,6 +36,102 @@ using namespace std;