diff --git a/coreapi/private_functions.h b/coreapi/private_functions.h index f88c46ee0..d95a060aa 100644 --- a/coreapi/private_functions.h +++ b/coreapi/private_functions.h @@ -351,36 +351,12 @@ void linphone_upnp_destroy(LinphoneCore *lc); int _linphone_sqlite3_open(const char *db_file, sqlite3 **db); #endif -void linphone_chat_message_set_time(LinphoneChatMessage* msg, time_t time); -void linphone_chat_message_set_incoming(LinphoneChatMessage *msg); -void linphone_chat_message_set_outgoing(LinphoneChatMessage *msg); LinphoneChatMessageStateChangedCb linphone_chat_message_get_message_state_changed_cb(LinphoneChatMessage* msg); void linphone_chat_message_set_message_state_changed_cb(LinphoneChatMessage* msg, LinphoneChatMessageStateChangedCb cb); void linphone_chat_message_set_message_state_changed_cb_user_data(LinphoneChatMessage* msg, void *user_data); void * linphone_chat_message_get_message_state_changed_cb_user_data(LinphoneChatMessage* msg); -void linphone_chat_message_set_state(LinphoneChatMessage *msg, LinphoneChatMessageState state); -void linphone_chat_message_set_message_id(LinphoneChatMessage *msg, char *id); -void linphone_chat_message_set_storage_id(LinphoneChatMessage *msg, unsigned int id); -SalCustomHeader * linphone_chat_message_get_sal_custom_headers(const LinphoneChatMessage *msg); -void linphone_chat_message_set_sal_custom_headers(LinphoneChatMessage *msg, SalCustomHeader *header); -belle_http_request_t * linphone_chat_message_get_http_request(const LinphoneChatMessage *msg); -void linphone_chat_message_set_http_request(LinphoneChatMessage *msg, belle_http_request_t *request); -void linphone_chat_message_set_file_transfer_information(LinphoneChatMessage *msg, LinphoneContent *content); -LinphoneChatMessageDir linphone_chat_message_get_direction(const LinphoneChatMessage *msg); -LinphonePrivate::SalOp * linphone_chat_message_get_sal_op(const LinphoneChatMessage *msg); -void linphone_chat_message_set_sal_op(LinphoneChatMessage *msg, LinphonePrivate::SalOp *op); -void linphone_chat_message_destroy(LinphoneChatMessage* msg); void linphone_chat_message_update_state(LinphoneChatMessage *msg, LinphoneChatMessageState new_state); -void linphone_chat_message_set_is_secured(LinphoneChatMessage *msg, bool_t secured); -void linphone_chat_message_send_delivery_notification(LinphoneChatMessage *cm, LinphoneReason reason); -void linphone_chat_message_send_display_notification(LinphoneChatMessage *cm); -void _linphone_chat_message_cancel_file_transfer(LinphoneChatMessage *msg, bool_t unref); -int linphone_chat_room_upload_file(LinphoneChatMessage *msg); LinphoneChatRoom *_linphone_core_create_chat_room_from_call(LinphoneCall *call); -void linphone_chat_room_remove_transient_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg); -void linphone_chat_message_deactivate(LinphoneChatMessage *msg); -void linphone_chat_message_release(LinphoneChatMessage *msg); -void linphone_chat_message_fetch_content_from_database(sqlite3 *db, LinphoneChatMessage *message, int content_id); void linphone_core_play_named_tone(LinphoneCore *lc, LinphoneToneID id); bool_t linphone_core_tone_indications_enabled(LinphoneCore*lc); diff --git a/src/c-wrapper/api/c-chat-message.cpp b/src/c-wrapper/api/c-chat-message.cpp index 96c95914e..93f5b82bd 100644 --- a/src/c-wrapper/api/c-chat-message.cpp +++ b/src/c-wrapper/api/c-chat-message.cpp @@ -110,50 +110,22 @@ time_t linphone_chat_message_get_time(const LinphoneChatMessage *msg) { return L_GET_CPP_PTR_FROM_C_OBJECT(msg)->getTime(); } -void linphone_chat_message_set_time(LinphoneChatMessage *msg, time_t time) { - L_GET_PRIVATE_FROM_C_OBJECT(msg)->setTime(time); -} - bool_t linphone_chat_message_is_secured(LinphoneChatMessage *msg) { return L_GET_CPP_PTR_FROM_C_OBJECT(msg)->isSecured(); } -void linphone_chat_message_set_is_secured(LinphoneChatMessage *msg, bool_t secured) { - L_GET_CPP_PTR_FROM_C_OBJECT(msg)->setIsSecured(!!secured); -} - bool_t linphone_chat_message_is_outgoing(LinphoneChatMessage *msg) { return L_GET_CPP_PTR_FROM_C_OBJECT(msg)->getDirection() == LinphonePrivate::ChatMessage::Direction::Outgoing; } -LinphoneChatMessageDir linphone_chat_message_get_direction(const LinphoneChatMessage *msg) { - return ((LinphoneChatMessageDir)L_GET_CPP_PTR_FROM_C_OBJECT(msg)->getDirection()); -} - -void linphone_chat_message_set_incoming(LinphoneChatMessage *msg) { - L_GET_PRIVATE_FROM_C_OBJECT(msg)->setDirection(LinphonePrivate::ChatMessage::Direction::Incoming); -} - -void linphone_chat_message_set_outgoing(LinphoneChatMessage *msg) { - L_GET_PRIVATE_FROM_C_OBJECT(msg)->setDirection(LinphonePrivate::ChatMessage::Direction::Outgoing); -} - LinphoneChatMessageState linphone_chat_message_get_state(const LinphoneChatMessage *msg) { return ((LinphoneChatMessageState)L_GET_CPP_PTR_FROM_C_OBJECT(msg)->getState()); } -void linphone_chat_message_set_state(LinphoneChatMessage *msg, LinphoneChatMessageState state) { - L_GET_PRIVATE_FROM_C_OBJECT(msg)->setState((LinphonePrivate::ChatMessage::State)state); -} - const char* linphone_chat_message_get_message_id(const LinphoneChatMessage *msg) { return L_GET_CPP_PTR_FROM_C_OBJECT(msg)->getImdnMessageId().c_str(); } -void linphone_chat_message_set_message_id(LinphoneChatMessage *msg, char *id) { - L_GET_PRIVATE_FROM_C_OBJECT(msg)->setImdnMessageId(L_C_TO_STRING(id)); -} - bool_t linphone_chat_message_is_read(LinphoneChatMessage *msg) { return L_GET_CPP_PTR_FROM_C_OBJECT(msg)->isRead(); } @@ -188,30 +160,6 @@ void linphone_chat_message_set_file_transfer_filepath(LinphoneChatMessage *msg, L_GET_PRIVATE_FROM_C_OBJECT(msg)->setFileTransferFilepath(L_C_TO_STRING(filepath)); } -belle_http_request_t * linphone_chat_message_get_http_request(LinphoneChatMessage *msg) { - return L_GET_PRIVATE_FROM_C_OBJECT(msg)->getHttpRequest(); -} - -void linphone_chat_message_set_http_request(LinphoneChatMessage *msg, belle_http_request_t *request) { - L_GET_PRIVATE_FROM_C_OBJECT(msg)->setHttpRequest(request); -} - -LinphonePrivate::SalOp * linphone_chat_message_get_sal_op(const LinphoneChatMessage *msg) { - return L_GET_PRIVATE_FROM_C_OBJECT(msg)->getSalOp(); -} - -void linphone_chat_message_set_sal_op(LinphoneChatMessage *msg, LinphonePrivate::SalOp *op) { - L_GET_PRIVATE_FROM_C_OBJECT(msg)->setSalOp(op); -} - -SalCustomHeader * linphone_chat_message_get_sal_custom_headers(const LinphoneChatMessage *msg) { - return L_GET_PRIVATE_FROM_C_OBJECT(msg)->getSalCustomHeaders(); -} - -void linphone_chat_message_set_sal_custom_headers(LinphoneChatMessage *msg, SalCustomHeader *header) { - L_GET_PRIVATE_FROM_C_OBJECT(msg)->setSalCustomHeaders(header); -} - void linphone_chat_message_add_custom_header(LinphoneChatMessage *msg, const char *header_name, const char *header_value) { L_GET_PRIVATE_FROM_C_OBJECT(msg)->addSalCustomHeader(L_C_TO_STRING(header_name), L_C_TO_STRING(header_value)); @@ -257,18 +205,6 @@ void linphone_chat_message_update_state(LinphoneChatMessage *msg, LinphoneChatMe L_GET_CPP_PTR_FROM_C_OBJECT(msg)->updateState((LinphonePrivate::ChatMessage::State) new_state); } -void linphone_chat_message_deactivate(LinphoneChatMessage *msg){ - L_GET_CPP_PTR_FROM_C_OBJECT(msg)->cancelFileTransfer(); -} - -void linphone_chat_message_send_delivery_notification(LinphoneChatMessage *msg, LinphoneReason reason) { - L_GET_CPP_PTR_FROM_C_OBJECT(msg)->sendDeliveryNotification(reason); -} - -void linphone_chat_message_send_display_notification(LinphoneChatMessage *msg) { - L_GET_CPP_PTR_FROM_C_OBJECT(msg)->sendDisplayNotification(); -} - LinphoneStatus linphone_chat_message_put_char(LinphoneChatMessage *msg, uint32_t character) { return ((LinphoneStatus)L_GET_CPP_PTR_FROM_C_OBJECT(msg)->putCharacter(character)); } @@ -342,10 +278,6 @@ LinphoneContent *linphone_chat_message_get_file_transfer_information(LinphoneCha return L_GET_PRIVATE_FROM_C_OBJECT(msg)->getFileTransferInformation(); } -void linphone_chat_message_set_file_transfer_information(LinphoneChatMessage *msg, LinphoneContent *content) { - L_GET_PRIVATE_FROM_C_OBJECT(msg)->setFileTransferInformation(content); -} - // ============================================================================= // Nothing to do, they call other C API methods // ============================================================================= @@ -400,8 +332,3 @@ void linphone_chat_message_start_file_download(LinphoneChatMessage *msg, msg->message_state_changed_user_data = ud; linphone_chat_message_download_file(msg); } - -void linphone_chat_message_release(LinphoneChatMessage *msg) { - linphone_chat_message_deactivate(msg); - linphone_chat_message_unref(msg); -} diff --git a/src/c-wrapper/api/c-chat-room.cpp b/src/c-wrapper/api/c-chat-room.cpp index dba1ac8e3..3099f1c03 100644 --- a/src/c-wrapper/api/c-chat-room.cpp +++ b/src/c-wrapper/api/c-chat-room.cpp @@ -132,10 +132,13 @@ LinphoneChatMessage *linphone_chat_room_create_message_2 ( bool_t is_incoming ) { LinphoneChatMessage *msg = linphone_chat_room_create_message(cr, message); + linphone_chat_message_set_external_body_url(msg, external_body_url ? ms_strdup(external_body_url) : NULL); - linphone_chat_message_set_time(msg, time); - linphone_chat_message_set_is_secured(msg, FALSE); - linphone_chat_message_set_state(msg, state); + + LinphonePrivate::ChatMessagePrivate *dMsg = L_GET_PRIVATE_FROM_C_OBJECT(msg); + dMsg->setTime(time); + dMsg->setState(static_cast(state)); + return msg; } diff --git a/src/chat/modifier/file-transfer-chat-message-modifier.cpp b/src/chat/modifier/file-transfer-chat-message-modifier.cpp index 935bba9a2..3489bc0d2 100644 --- a/src/chat/modifier/file-transfer-chat-message-modifier.cpp +++ b/src/chat/modifier/file-transfer-chat-message-modifier.cpp @@ -416,7 +416,7 @@ void FileTransferChatMessageModifier::processAuthRequestedUpload (const belle_si int FileTransferChatMessageModifier::uploadFile () { if (httpRequest) { - lError() << "linphone_chat_room_upload_file(): there is already an upload in progress."; + lError() << "Unable to upload file: there is already an upload in progress."; return -1; }