mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 06:09:39 +00:00
Use macro instead of checking if string is empty manually...
This commit is contained in:
parent
5605c66085
commit
9750a40c34
1 changed files with 9 additions and 19 deletions
|
|
@ -90,13 +90,13 @@ LinphoneChatMessageCbs *linphone_chat_message_get_callbacks(const LinphoneChatMe
|
|||
// =============================================================================
|
||||
|
||||
LinphoneChatRoom *linphone_chat_message_get_chat_room(const LinphoneChatMessage *msg) {
|
||||
return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(msg)->getChatRoom());
|
||||
shared_ptr<const LinphonePrivate::ChatMessage> message = L_GET_CPP_PTR_FROM_C_OBJECT(msg);
|
||||
shared_ptr<LinphonePrivate::ChatRoom> room = message->getChatRoom();
|
||||
return L_GET_C_BACK_PTR(room);
|
||||
}
|
||||
|
||||
const char *linphone_chat_message_get_external_body_url(const LinphoneChatMessage *msg) {
|
||||
const string& external_body_url = L_GET_CPP_PTR_FROM_C_OBJECT(msg)->getExternalBodyUrl();
|
||||
if (external_body_url.empty()) return NULL;
|
||||
return external_body_url.c_str();
|
||||
return L_STRING_TO_C(L_GET_CPP_PTR_FROM_C_OBJECT(msg)->getExternalBodyUrl());
|
||||
}
|
||||
|
||||
void linphone_chat_message_set_external_body_url(LinphoneChatMessage *msg, const char *url) {
|
||||
|
|
@ -164,9 +164,7 @@ bool_t linphone_chat_message_is_read(LinphoneChatMessage *msg) {
|
|||
}
|
||||
|
||||
const char *linphone_chat_message_get_appdata(const LinphoneChatMessage *msg) {
|
||||
const string& appData = L_GET_CPP_PTR_FROM_C_OBJECT(msg)->getAppdata();
|
||||
if (appData.empty()) return NULL;
|
||||
return appData.c_str();
|
||||
return L_STRING_TO_C(L_GET_CPP_PTR_FROM_C_OBJECT(msg)->getAppdata());
|
||||
}
|
||||
|
||||
void linphone_chat_message_set_appdata(LinphoneChatMessage *msg, const char *data) {
|
||||
|
|
@ -196,9 +194,7 @@ const LinphoneAddress *linphone_chat_message_get_to_address(LinphoneChatMessage
|
|||
}
|
||||
|
||||
const char *linphone_chat_message_get_file_transfer_filepath(LinphoneChatMessage *msg) {
|
||||
const string& path = L_GET_CPP_PTR_FROM_C_OBJECT(msg)->getFileTransferFilepath();
|
||||
if (path.empty()) return NULL;
|
||||
return path.c_str();
|
||||
return L_STRING_TO_C(L_GET_CPP_PTR_FROM_C_OBJECT(msg)->getFileTransferFilepath());
|
||||
}
|
||||
|
||||
void linphone_chat_message_set_file_transfer_filepath(LinphoneChatMessage *msg, const char *filepath) {
|
||||
|
|
@ -247,9 +243,7 @@ void linphone_chat_message_remove_custom_header(LinphoneChatMessage *msg, const
|
|||
}
|
||||
|
||||
const char *linphone_chat_message_get_custom_header(LinphoneChatMessage *msg, const char *header_name) {
|
||||
const string& header = L_GET_PRIVATE_FROM_C_OBJECT(msg)->getSalCustomHeaderValue(header_name);
|
||||
if (header.empty()) return NULL;
|
||||
return header.c_str();
|
||||
return L_STRING_TO_C(L_GET_PRIVATE_FROM_C_OBJECT(msg)->getSalCustomHeaderValue(header_name));
|
||||
}
|
||||
|
||||
const LinphoneErrorInfo *linphone_chat_message_get_error_info(const LinphoneChatMessage *msg) {
|
||||
|
|
@ -329,9 +323,7 @@ void * linphone_chat_message_get_message_state_changed_cb_user_data(LinphoneChat
|
|||
// =============================================================================
|
||||
|
||||
const char * linphone_chat_message_get_content_type(const LinphoneChatMessage *msg) {
|
||||
const string& contentType = L_GET_PRIVATE_FROM_C_OBJECT(msg)->getContentType();
|
||||
if (contentType.empty()) return NULL;
|
||||
return contentType.c_str();
|
||||
return L_STRING_TO_C(L_GET_PRIVATE_FROM_C_OBJECT(msg)->getContentType());
|
||||
}
|
||||
|
||||
void linphone_chat_message_set_content_type(LinphoneChatMessage *msg, const char *content_type) {
|
||||
|
|
@ -339,9 +331,7 @@ void linphone_chat_message_set_content_type(LinphoneChatMessage *msg, const char
|
|||
}
|
||||
|
||||
const char *linphone_chat_message_get_text(const LinphoneChatMessage *msg) {
|
||||
const string& text = L_GET_PRIVATE_FROM_C_OBJECT(msg)->getText();
|
||||
if (text.empty()) return NULL;
|
||||
return text.c_str();
|
||||
return L_STRING_TO_C(L_GET_PRIVATE_FROM_C_OBJECT(msg)->getText());
|
||||
}
|
||||
|
||||
int linphone_chat_message_set_text(LinphoneChatMessage *msg, const char* text) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue