Commit 71149521 authored by Ghislain MARY's avatar Ghislain MARY

Revert "Revert "Merge branch 'dev_content_cpp' into dev_refactor_cpp""

This reverts commit 2686dca6.
parent bc753643
......@@ -64,7 +64,6 @@ set(LINPHONE_SOURCE_FILES_C
carddav.c
chat.c
contactprovider.c
content.c
dial_plan.c
dict.c
ec-calibrator.c
......
......@@ -39,7 +39,6 @@ liblinphone_la_SOURCES=\
chat_file_transfer.c \
conference.cc conference_private.h \
contactprovider.c contact_providers_priv.h \
content.c \
dial_plan.c \
dict.c \
ec-calibrator.c \
......
......@@ -348,6 +348,29 @@ void sal_body_handler_set_subtype(SalBodyHandler *body_handler, const char *subt
belle_sip_header_content_type_set_subtype(content_type, subtype);
}
const belle_sip_list_t * sal_body_handler_get_content_type_parameters_names(const SalBodyHandler *body_handler) {
belle_sip_header_content_type_t *content_type = BELLE_SIP_HEADER_CONTENT_TYPE(sal_body_handler_find_header(body_handler, "Content-Type"));
if (content_type != NULL) {
return belle_sip_parameters_get_parameter_names(BELLE_SIP_PARAMETERS(content_type));
}
return NULL;
}
const char * sal_body_handler_get_content_type_parameter(const SalBodyHandler *body_handler, const char *name) {
belle_sip_header_content_type_t *content_type = BELLE_SIP_HEADER_CONTENT_TYPE(sal_body_handler_find_header(body_handler, "Content-Type"));
if (content_type != NULL) {
return belle_sip_parameters_get_parameter(BELLE_SIP_PARAMETERS(content_type), name);
}
return NULL;
}
void sal_body_handler_set_content_type_parameter(SalBodyHandler *body_handler, const char *paramName, const char *paramValue) {
belle_sip_header_content_type_t *content_type = BELLE_SIP_HEADER_CONTENT_TYPE(sal_body_handler_find_header(body_handler, "Content-Type"));
if (content_type != NULL) {
belle_sip_parameters_set_parameter(BELLE_SIP_PARAMETERS(content_type), paramName, paramValue);
}
}
const char * sal_body_handler_get_encoding(const SalBodyHandler *body_handler) {
belle_sip_header_t *content_encoding = sal_body_handler_find_header(body_handler, "Content-Encoding");
if (content_encoding != NULL) {
......@@ -396,6 +419,11 @@ SalBodyHandler * sal_body_handler_get_part(const SalBodyHandler *body_handler, i
return (SalBodyHandler *)belle_sip_list_nth_data(l, idx);
}
const belle_sip_list_t * sal_body_handler_get_parts(const SalBodyHandler *body_handler) {
if (!sal_body_handler_is_multipart(body_handler)) return NULL;
return belle_sip_multipart_body_handler_get_parts(BELLE_SIP_MULTIPART_BODY_HANDLER(body_handler));
}
SalBodyHandler * sal_body_handler_find_part_by_header(const SalBodyHandler *body_handler, const char *header_name, const char *header_value) {
const belle_sip_list_t *l = belle_sip_multipart_body_handler_get_parts(BELLE_SIP_MULTIPART_BODY_HANDLER(body_handler));
for (; l != NULL; l = l->next) {
......@@ -418,3 +446,7 @@ const char * sal_body_handler_get_header(const SalBodyHandler *body_handler, con
}
return NULL;
}
const belle_sip_list_t* sal_body_handler_get_headers(const SalBodyHandler *body_handler) {
return belle_sip_body_handler_get_headers(BELLE_SIP_BODY_HANDLER(body_handler));
}
......@@ -17,14 +17,15 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "c-wrapper/internal/c-sal.h"
#include "sal/call-op.h"
#include "sal/message-op.h"
#include "sal/refer-op.h"
#include "linphone/api/c-content.h"
#include "linphone/core.h"
#include "linphone/utils/utils.h"
#include "private.h"
#include "mediastreamer2/mediastream.h"
#include "linphone/lpconfig.h"
......
/*
linphone
Copyright (C) 2010-2014 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 "linphone/core.h"
#include "c-wrapper/c-wrapper.h"
// TODO: From coreapi. Remove me later.
#include "private.h"
static void linphone_content_set_sal_body_handler(LinphoneContent *content, SalBodyHandler *body_handler) {
if (content->body_handler != NULL) {
sal_body_handler_unref(content->body_handler);
content->body_handler = NULL;
}
content->body_handler = sal_body_handler_ref(body_handler);
}
static LinphoneContent * linphone_content_new_with_body_handler(SalBodyHandler *body_handler) {
LinphoneContent *content = belle_sip_object_new(LinphoneContent);
belle_sip_object_ref(content);
content->owned_fields = TRUE;
content->cryptoContext = NULL; /* this field is managed externally by encryption/decryption functions so be careful to initialise it to NULL */
if (body_handler == NULL) {
linphone_content_set_sal_body_handler(content, sal_body_handler_new());
} else {
linphone_content_set_sal_body_handler(content, body_handler);
}
return content;
}
static void linphone_content_destroy(LinphoneContent *content) {
if (content->owned_fields == TRUE) {
if (content->body_handler) sal_body_handler_unref(content->body_handler);
if (content->name) belle_sip_free(content->name);
if (content->key) belle_sip_free(content->key);
/* note : crypto context is allocated/destroyed by the encryption function */
}
}
static void linphone_content_clone(LinphoneContent *obj, const LinphoneContent *ref) {
obj->owned_fields = TRUE;
linphone_content_set_sal_body_handler(obj, sal_body_handler_new());
if ((linphone_content_get_type(ref) != NULL) || (linphone_content_get_subtype(ref) != NULL)) {
linphone_content_set_type(obj, linphone_content_get_type(ref));
linphone_content_set_subtype(obj, linphone_content_get_subtype(ref));
}
if (linphone_content_get_encoding(ref) != NULL) {
linphone_content_set_encoding(obj, linphone_content_get_encoding(ref));
}
linphone_content_set_name(obj, linphone_content_get_name(ref));
linphone_content_set_key(obj, linphone_content_get_key(ref), linphone_content_get_key_size(ref));
if (linphone_content_get_buffer(ref) != NULL) {
linphone_content_set_buffer(obj, linphone_content_get_buffer(ref), linphone_content_get_size(ref));
} else {
linphone_content_set_size(obj, linphone_content_get_size(ref));
}
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneContent);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneContent, belle_sip_object_t,
(belle_sip_object_destroy_t)linphone_content_destroy,
(belle_sip_object_clone_t)linphone_content_clone,
NULL, // marshal
TRUE
);
LinphoneContent * linphone_core_create_content(LinphoneCore *lc) {
return linphone_content_new();
}
LinphoneContent * linphone_content_ref(LinphoneContent *content) {
belle_sip_object_ref(content);
return content;
}
void linphone_content_unref(LinphoneContent *content) {
belle_sip_object_unref(content);
}
void *linphone_content_get_user_data(const LinphoneContent *content) {
return content->user_data;
}
void linphone_content_set_user_data(LinphoneContent *content, void *ud) {
content->user_data = ud;
}
const char * linphone_content_get_type(const LinphoneContent *content) {
return sal_body_handler_get_type(content->body_handler);
}
void linphone_content_set_type(LinphoneContent *content, const char *type) {
sal_body_handler_set_type(content->body_handler, type);
}
const char * linphone_content_get_subtype(const LinphoneContent *content) {
return sal_body_handler_get_subtype(content->body_handler);
}
void linphone_content_set_subtype(LinphoneContent *content, const char *subtype) {
sal_body_handler_set_subtype(content->body_handler, subtype);
}
uint8_t * linphone_content_get_buffer(const LinphoneContent *content) {
return (uint8_t *)sal_body_handler_get_data(content->body_handler);
}
void linphone_content_set_buffer(LinphoneContent *content, const uint8_t *buffer, size_t size) {
void *data;
sal_body_handler_set_size(content->body_handler, size);
data = belle_sip_malloc(size + 1);
memcpy(data, buffer, size);
((char *)data)[size] = '\0';
sal_body_handler_set_data(content->body_handler, data);
}
const char * linphone_content_get_string_buffer(const LinphoneContent *content) {
return (const char *)linphone_content_get_buffer(content);
}
void linphone_content_set_string_buffer(LinphoneContent *content, const char *buffer) {
sal_body_handler_set_size(content->body_handler, strlen(buffer));
sal_body_handler_set_data(content->body_handler, belle_sip_strdup(buffer));
}
size_t linphone_content_get_size(const LinphoneContent *content) {
return sal_body_handler_get_size(content->body_handler);
}
void linphone_content_set_size(LinphoneContent *content, size_t size) {
sal_body_handler_set_size(content->body_handler, size);
}
const char * linphone_content_get_encoding(const LinphoneContent *content) {
return sal_body_handler_get_encoding(content->body_handler);
}
void linphone_content_set_encoding(LinphoneContent *content, const char *encoding) {
sal_body_handler_set_encoding(content->body_handler, encoding);
}
const char * linphone_content_get_name(const LinphoneContent *content) {
return content->name;
}
void linphone_content_set_name(LinphoneContent *content, const char *name) {
if (content->name != NULL) {
belle_sip_free(content->name);
content->name = NULL;
}
if (name != NULL) {
content->name = belle_sip_strdup(name);
}
}
size_t linphone_content_get_key_size(const LinphoneContent *content) {
return content->keyLength;
}
const char * linphone_content_get_key(const LinphoneContent *content) {
return content->key;
}
void linphone_content_set_key(LinphoneContent *content, const char *key, const size_t keyLength) {
if (content->key != NULL) {
belle_sip_free(content->key);
content->key = NULL;
}
if (key != NULL) {
content->key = reinterpret_cast<char *>(belle_sip_malloc(keyLength + 1));
memcpy(content->key, key, keyLength);
content->key[keyLength] = '\0';
content->keyLength = keyLength;
}
}
/* crypto context is managed(allocated/freed) by the encryption function, so provide the address of field in the private structure */
void ** linphone_content_get_cryptoContext_address(LinphoneContent *content) {
return &(content->cryptoContext);
}
bool_t linphone_content_is_multipart(const LinphoneContent *content) {
return sal_body_handler_is_multipart(content->body_handler);
}
LinphoneContent * linphone_content_get_part(const LinphoneContent *content, int idx) {
SalBodyHandler *part_body_handler;
if (!linphone_content_is_multipart(content)) return NULL;
part_body_handler = sal_body_handler_get_part(content->body_handler, idx);
return linphone_content_from_sal_body_handler(part_body_handler);
}
LinphoneContent * linphone_content_find_part_by_header(const LinphoneContent *content, const char *header_name, const char *header_value) {
SalBodyHandler *part_body_handler;
if (!linphone_content_is_multipart(content)) return NULL;
part_body_handler = sal_body_handler_find_part_by_header(content->body_handler, header_name, header_value);
return linphone_content_from_sal_body_handler(part_body_handler);
}
const char * linphone_content_get_custom_header(const LinphoneContent *content, const char *header_name) {
return sal_body_handler_get_header(content->body_handler, header_name);
}
LinphoneContent * linphone_content_new(void) {
return linphone_content_new_with_body_handler(NULL);
}
LinphoneContent * linphone_content_copy(const LinphoneContent *ref) {
return (LinphoneContent *)belle_sip_object_ref(belle_sip_object_clone(BELLE_SIP_OBJECT(ref)));
}
LinphoneContent * linphone_content_from_sal_body_handler(SalBodyHandler *body_handler) {
if (body_handler) {
return linphone_content_new_with_body_handler(body_handler);
}
return NULL;
}
SalBodyHandler * sal_body_handler_from_content(const LinphoneContent *content) {
if (content == NULL) return NULL;
return content->body_handler;
}
......@@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <bctoolbox/crypto.h>
#include "linphone/api/c-content.h"
#include "linphone/core.h"
#include "c-wrapper/c-wrapper.h"
......@@ -961,7 +962,7 @@ void linphone_friend_list_notify_presence_received(LinphoneFriendList *list, Lin
const char *subtype = linphone_content_get_subtype(body);
if ((strcmp(type, "multipart") != 0) || (strcmp(subtype, "related") != 0)) {
ms_warning("multipart presence notified but it is not 'multipart/related'");
ms_warning("multipart presence notified but it is not 'multipart/related', instead is '%s/%s'", type, subtype);
return;
}
......
......@@ -23,6 +23,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "linphone/api/c-content.h"
#include "linphone/core.h"
#include "linphone/lpconfig.h"
......
......@@ -17,6 +17,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "linphone/api/c-content.h"
#include "lime.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
......@@ -419,6 +421,8 @@ int lime_encryptFile(void **cryptoContext, unsigned char *key, size_t length, ch
int lime_decryptFile(void **cryptoContext, unsigned char *key, size_t length, char *plain, char *cipher) {
bctbx_aes_gcm_context_t *gcmContext;
if (key == NULL) return -1;
if (*cryptoContext == NULL) { /* first call to the function, allocate a crypto context and initialise it */
/* key contains 192bits of key || 64 bits of Initialisation Vector, no additional data */
gcmContext = bctbx_aes_gcm_context_new(key, 24, NULL, 0, key+24, 8, BCTBX_GCM_DECRYPT);
......@@ -787,8 +791,8 @@ int lime_im_encryption_engine_process_incoming_message_cb(LinphoneImEncryptionEn
LinphoneCore *lc = linphone_im_encryption_engine_get_core(engine);
int errcode = -1;
/* check if we have a xml/cipher message to be decrypted */
if (linphone_chat_message_get_content_type(msg) &&
(strcmp("xml/cipher", linphone_chat_message_get_content_type(msg)) == 0 ||
if (linphone_chat_message_get_content_type(msg) &&
(strcmp("xml/cipher", linphone_chat_message_get_content_type(msg)) == 0 ||
strcmp("application/cipher.vnd.gsma.rcs-ft-http+xml", linphone_chat_message_get_content_type(msg)) == 0)) {
errcode = 0;
int retval;
......@@ -893,6 +897,7 @@ int lime_im_encryption_engine_process_downloading_file_cb(LinphoneImEncryptionEn
LinphoneContent *content = linphone_chat_message_get_file_transfer_information(msg);
if (!content)
return -1;
if (!linphone_content_get_key(content)) {
linphone_content_unref(content);
return -1;
......
......@@ -18,10 +18,12 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "linphone/api/c-content.h"
#include "linphone/core.h"
#include "linphone/sipsetup.h"
#include "linphone/lpconfig.h"
#include "linphone/logging.h"
#include "linphone/sipsetup.h"
#include "private.h"
#include "logging-private.h"
#include "quality_reporting.h"
......
......@@ -449,17 +449,6 @@ struct _EchoTester {
unsigned int rate;
};
struct _LinphoneContent {
belle_sip_object_t base;
void *user_data;
SalBodyHandler *body_handler;
char *name; /**< used by RCS File transfer messages to store the original filename of the file to be downloaded from server */
char *key; /**< used by RCS File transfer messages to store the key to encrypt file if needed */
size_t keyLength; /**< Length of key in bytes */
void *cryptoContext; /**< crypto context used to encrypt file for RCS file transfer */
bool_t owned_fields;
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneContent);
struct _LinphoneBuffer {
......
......@@ -25,6 +25,7 @@ Copyright (C) 2000 Simon MORLAT (simon.morlat@linphone.org)
#include "linphone/core.h"
#include "linphone/lpconfig.h"
#include "linphone/sipsetup.h"
#include "mediastreamer2/mediastream.h"
#include "enum.h"
......
......@@ -21,7 +21,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "config.h"
#endif
#include "linphone/api/c-content.h"
#include "linphone/core.h"
#include "private.h"
#include "c-wrapper/internal/c-sal.h"
#include "sal/sal.h"
......
......@@ -33,7 +33,6 @@ set(ROOT_HEADER_FILES
chat.h
conference.h
contactprovider.h
content.h
core_utils.h
core.h
defs.h
......@@ -85,6 +84,7 @@ set(C_API_HEADER_FILES
c-chat-message.h
c-chat-room-cbs.h
c-chat-room.h
c-content.h
c-dial-plan.h
c-event-log.h
c-magic-search.h
......
......@@ -14,7 +14,6 @@ linphone_include_HEADERS=\
chat.h \
conference.h \
contactprovider.h \
content.h \
core.h \
core_utils.h \
defs.h \
......
......@@ -23,14 +23,15 @@
#include "linphone/utils/general.h"
#include "linphone/api/c-address.h"
#include "linphone/api/c-call.h"
#include "linphone/api/c-call-cbs.h"
#include "linphone/api/c-call-stats.h"
#include "linphone/api/c-call.h"
#include "linphone/api/c-callbacks.h"
#include "linphone/api/c-chat-message.h"
#include "linphone/api/c-chat-message-cbs.h"
#include "linphone/api/c-chat-room.h"
#include "linphone/api/c-chat-message.h"
#include "linphone/api/c-chat-room-cbs.h"
#include "linphone/api/c-chat-room.h"
#include "linphone/api/c-content.h"
#include "linphone/api/c-dial-plan.h"
#include "linphone/api/c-event-log.h"
#include "linphone/api/c-participant.h"
......
......@@ -90,7 +90,7 @@ LINPHONE_PUBLIC LinphoneChatMessage* linphone_chat_room_create_message_2(Linphon
* @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.
* @return a new #LinphoneChatMessage
*/
LINPHONE_PUBLIC LinphoneChatMessage* linphone_chat_room_create_file_transfer_message(LinphoneChatRoom *cr, const LinphoneContent* initial_content);
LINPHONE_PUBLIC LinphoneChatMessage* linphone_chat_room_create_file_transfer_message(LinphoneChatRoom *cr, LinphoneContent* initial_content);
/**
* get peer address \link linphone_core_get_chat_room() associated to \endlink this #LinphoneChatRoom
......
/*
content.h
Copyright (C) 2010-2014 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 LINPHONE_CONTENT_H_
#define LINPHONE_CONTENT_H_
#include "linphone/types.h"
* c-content.h
* Copyright (C) 2010-2018 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 _L_C_CONTENT_H_
#define _L_C_CONTENT_H_
#include "linphone/api/c-types.h"
// =============================================================================
#ifdef __cplusplus
extern "C" {
#endif
extern "C" {
#endif // ifdef __cplusplus
/**
* @addtogroup misc
......@@ -89,6 +88,14 @@ LINPHONE_PUBLIC const char * linphone_content_get_subtype(const LinphoneContent
*/
LINPHONE_PUBLIC void linphone_content_set_subtype(LinphoneContent *content, const char *subtype);
/**
* Adds a parameter to the ContentType header.
* @param[in] content LinphoneContent object.
* @param[in] name the name of the parameter to add.
* @param[in] value the value of the parameter to add.
*/
LINPHONE_PUBLIC void linphone_content_add_content_type_parameter(LinphoneContent *content, const char *name, const char *value);
/**
* Get the content data buffer, usually a string.
* @param[in] content #LinphoneContent object.
......@@ -218,9 +225,8 @@ LINPHONE_PUBLIC void linphone_content_set_key(LinphoneContent *content, const ch
* @}
*/
#ifdef __cplusplus
}
#endif
}
#endif // ifdef __cplusplus
#endif /* LINPHONE_CONTENT_H_ */
#endif // ifndef _L_C_CONTENT_H_
\ No newline at end of file
......@@ -144,6 +144,12 @@ typedef struct _LinphoneEventLog LinphoneEventLog;
// Misc.
// -----------------------------------------------------------------------------
/**
* The LinphoneContent object holds data that can be embedded in a signaling message.
* @ingroup misc
**/
typedef struct _LinphoneContent LinphoneContent;
/**
* Represents a dial plan
* @ingroup misc
......
......@@ -42,7 +42,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "linphone/call_stats.h"
#include "linphone/chat.h"
#include "linphone/conference.h"
#include "linphone/content.h"
#include "linphone/dictionary.h"
#include "linphone/error_info.h"
#include "linphone/event.h"
......
......@@ -367,12 +367,6 @@ typedef unsigned int LinphoneContactSearchID;
*/
LINPHONE_DEPRECATED typedef LinphoneContactSearchID ContactSearchID;
/**
* The #LinphoneContent object holds data that can be embedded in a signaling message.
* @ingroup misc
**/
typedef struct _LinphoneContent LinphoneContent;
/**
* Linphone core main object created by function linphone_core_new() .
* @ingroup initializing
......
......@@ -101,6 +101,9 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
content/content.h
content/file-content.h
content/file-transfer-content.h
content/header/header.h
content/header/header-p.h
content/header/header-param.h
core/core-accessor.h
core/core-listener.h
core/core-p.h
......@@ -175,6 +178,7 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
c-wrapper/api/c-chat-room-cbs.cpp
c-wrapper/api/c-chat-room.cpp
c-wrapper/api/c-core.cpp
c-wrapper/api/c-content.cpp
c-wrapper/api/c-dial-plan.cpp
c-wrapper/api/c-event-log.cpp
c-wrapper/api/c-magic-search.cpp
......@@ -226,6 +230,8 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
content/content.cpp
content/file-content.cpp
content/file-transfer-content.cpp
content/header/header.cpp
content/header/header-param.cpp
core/core-accessor.cpp
core/core-call.cpp
core/core-chat-room.cpp
......
......@@ -18,6 +18,7 @@
*/
#include "linphone/api/c-chat-message.h"
#include "linphone/api/c-content.h"
#include "linphone/utils/utils.h"
#include "linphone/wrapper_utils.h"
......@@ -229,7 +230,7 @@ void linphone_chat_message_add_text_content(LinphoneChatMessage *msg, const char
LinphonePrivate::ContentType contentType = LinphonePrivate::ContentType::PlainText;
content->setContentType(contentType);
content->setBody(L_C_TO_STRING(c_content));
L_GET_CPP_PTR_FROM_C_OBJECT(msg)->addContent(*content);
L_GET_CPP_PTR_FROM_C_OBJECT(msg)->addContent(content);
}
bool_t linphone_chat_message_has_text_content(const LinphoneChatMessage *msg) {
......@@ -304,7 +305,9 @@ int linphone_chat_message_set_text(LinphoneChatMessage *msg, const char* text) {
}
LinphoneContent *linphone_chat_message_get_file_transfer_information(LinphoneChatMessage *msg) {
return L_GET_PRIVATE_FROM_C_OBJECT(msg)->getFileTransferInformation();
const LinphonePrivate::Content *content = L_GET_PRIVATE_FROM_C_OBJECT(msg)->getFileTransferInformation();
if (content) return L_GET_C_BACK_PTR(content);
return NULL;
}
// =============================================================================
......
......@@ -355,8 +355,8 @@ const bctbx_list_t *linphone_chat_room_get_composing_addresses (LinphoneChatRoom
return cr->composingAddresses;
}
LinphoneChatMessage *linphone_chat_room_create_file_transfer_message(LinphoneChatRoom *cr, const LinphoneContent *initial_content) {
shared_ptr<LinphonePrivate::ChatMessage> cppPtr = L_GET_CPP_PTR_FROM_C_OBJECT(cr)->createFileTransferMessage(initial_content);
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;
......
This diff is collapsed.
......@@ -37,6 +37,7 @@
F(ChatMessage, ChatMessage) \
F(AbstractChatRoom, ChatRoom) \
F(Core, Core) \
F(Content, Content) \
F(DialPlan, DialPlan) \
F(EventLog, EventLog) \
F(MagicSearch, MagicSearch) \
......@@ -86,7 +87,6 @@ BELLE_SIP_TYPE_ID(LinphoneConferenceParams),
BELLE_SIP_TYPE_ID(LinphoneConfig),
BELLE_SIP_TYPE_ID(LinphoneContactProvider),
BELLE_SIP_TYPE_ID(LinphoneContactSearch),
BELLE_SIP_TYPE_ID(LinphoneContent),
BELLE_SIP_TYPE_ID(LinphoneCoreCbs),
BELLE_SIP_TYPE_ID(LinphoneErrorInfo),
BELLE_SIP_TYPE_ID(LinphoneEvent),
......
......@@ -636,6 +636,9 @@ const char * sal_body_handler_get_type(const SalBodyHandler *body_handler);
void sal_body_handler_set_type(SalBodyHandler *body_handler, const char *type);
const char * sal_body_handler_get_subtype(const SalBodyHandler *body_handler);
void sal_body_handler_set_subtype(SalBodyHandler *body_handler, const char *subtype);
const belle_sip_list_t * sal_body_handler_get_content_type_parameters_names(const SalBodyHandler *body_handler);
const char * sal_body_handler_get_content_type_parameter(const SalBodyHandler *body_handler, const char *name);
void sal_body_handler_set_content_type_parameter(SalBodyHandler *body_handler, const char *paramName, const char *paramValue);
const char * sal_body_handler_get_encoding(const SalBodyHandler *body_handler);
void sal_body_handler_set_encoding(SalBodyHandler *body_handler, const char *encoding);
void * sal_body_handler_get_data(const SalBodyHandler *body_handler);
......@@ -644,8 +647,10 @@ size_t sal_body_handler_get_size(const SalBodyHandler *body_handler);
void sal_body_handler_set_size(SalBodyHandler *body_handler, size_t size);
bool_t sal_body_handler_is_multipart(const SalBodyHandler *body_handler);
SalBodyHandler * sal_body_handler_get_part(const SalBodyHandler *body_handler, int idx);
const belle_sip_list_t * sal_body_handler_get_parts(const SalBodyHandler *body_handler);