summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjk7744.park <jk7744.park@samsung.com>2015-02-01 13:30:47 +0900
committerjk7744.park <jk7744.park@samsung.com>2015-02-01 13:30:47 +0900
commitd8f4740ea9b69d552b30018c7947412aaa9896b3 (patch)
tree5ca0d99f2ec0cf8653393622cb95c6451bcb3a2a
parentc692fa0bf408840f69f447aa870d23d5edb6fe24 (diff)
downloadmessages-tizen_2.3.tar.gz
messages-tizen_2.3.tar.bz2
messages-tizen_2.3.zip
-rw-r--r--CMakeLists.txt10
-rw-r--r--capi-messaging-messages.pc.in2
-rwxr-xr-xdoc/messages_doc.h123
-rw-r--r--include/messages.h1063
-rw-r--r--include/messages_error.h16
-rw-r--r--include/messages_private.h60
-rw-r--r--include/messages_types.h171
-rw-r--r--packaging/capi-messaging-messages.spec21
-rw-r--r--src/messages.c275
-rw-r--r--src/messages_cb.c711
-rw-r--r--src/messages_push.c22
-rw-r--r--test/messages_cb_channel_test.c37
-rw-r--r--test/messages_search_test.c6
-rw-r--r--test/messages_send_mms_test.c27
-rw-r--r--test/messages_send_sms_test.c2
15 files changed, 980 insertions, 1566 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3ef2e48..efe3332 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,7 +10,7 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(INC_DIR include)
INCLUDE_DIRECTORIES(${INC_DIR})
-SET(dependents "dlog glib-2.0 msg-service capi-base-common capi-appfw-application")
+SET(dependents "dlog glib-2.0 msg-service capi-base-common capi-appfw-application capi-system-info privacy-manager-client")
INCLUDE(FindPkgConfig)
pkg_check_modules(${fw_name} REQUIRED ${dependents})
@@ -18,7 +18,7 @@ FOREACH(flag ${${fw_name}_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
IF("${ARCH}" STREQUAL "arm")
@@ -28,7 +28,7 @@ ENDIF("${ARCH}" STREQUAL "arm")
ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
ADD_DEFINITIONS("-DTIZEN_DEBUG")
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
aux_source_directory(src SOURCES)
ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
@@ -42,7 +42,7 @@ SET_TARGET_PROPERTIES(${fw_name}
CLEAN_DIRECT_OUTPUT 1
)
-INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(TARGETS ${fw_name} DESTINATION lib)
INSTALL(
DIRECTORY ${INC_DIR}/ DESTINATION include/messaging
FILES_MATCHING
@@ -60,7 +60,7 @@ CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
@ONLY
)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig)
ADD_SUBDIRECTORY(test)
diff --git a/capi-messaging-messages.pc.in b/capi-messaging-messages.pc.in
index edeeaed..a771af9 100644
--- a/capi-messaging-messages.pc.in
+++ b/capi-messaging-messages.pc.in
@@ -2,7 +2,7 @@
prefix=@PREFIX@
exec_prefix=/usr
-libdir=@LIB_INSTALL_DIR@
+libdir=/usr/lib
includedir=/usr/include
Name: @PC_NAME@
diff --git a/doc/messages_doc.h b/doc/messages_doc.h
new file mode 100755
index 0000000..241894d
--- /dev/null
+++ b/doc/messages_doc.h
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __TIZEN_MESSAGES_DOC_H__
+#define __TIZEN_MESSAGES_DOC_H__
+
+/**
+ * @defgroup CAPI_MESSAGING_MESSAGES_MODULE Messages
+ * @brief The @ref CAPI_MESSAGING_MESSAGES_MODULE API provides functions to create, set properties and send a SMS/MMS message.
+ * @ingroup CAPI_MESSAGING_FRAMEWORK
+ *
+ * @addtogroup CAPI_MESSAGING_MESSAGES_MODULE
+ *
+ * @section CAPI_MESSAGING_MESSAGES_MODULE_HEADER Required Header
+ * \#include <messages.h>
+ *
+ * @section CAPI_MESSAGING_MESSAGES_MODULE_OVERVIEW Overview
+ *
+ * The Messages API provides the following functionalities:
+ *
+ * - Creating a message
+ * - Setting the text of the message
+ * - Setting the message recipient(s)
+ * - Sending a message
+ * - Searching for messages
+ * - Registering/Unregistering a callback function to check whether a message is sent successfully or not
+ * - Registering/Unregistering a callback function to receive notifications when an incoming message is received
+ *
+ * @section CAPI_MESSAGING_MESSAGES_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ * - http://tizen.org/feature/network.telephony\n
+ * - http://tizen.org/feature/network.telephony.mms\n
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ *
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ *
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ *
+ * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * <BR>
+ */
+
+/**
+ * @defgroup CAPI_MESSAGING_MESSAGES_MMS_MODULE MMS
+ * @brief The MMS API provides functions to manage attachments and subject of the MMS message.
+ * @ingroup CAPI_MESSAGING_MESSAGES_MODULE
+ *
+ * @addtogroup CAPI_MESSAGING_MESSAGES_MMS_MODULE
+ *
+ * @section CAPI_MESSAGING_MESSAGES_MMS_MODULE_HEADER Required Header
+ * \#include <messages.h>
+ *
+ * @section CAPI_MESSAGING_MESSAGES_MMS_MODULE_OVERVIEW Overview
+ *
+ * The MMS API provides the following functionalities:
+ *
+ * - Setting/Getting the subject
+ * - Attaching the media files(image, video, audio)
+ * - Retrieving the attachments
+ * - Deleting all attachments
+ *
+ * @section CAPI_MESSAGING_MESSAGES_MMS_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ * - http://tizen.org/feature/network.telephony\n
+ * - http://tizen.org/feature/network.telephony.mms\n
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ *
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ *
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ *
+ * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ *
+ */
+
+/**
+ * @defgroup CAPI_MESSAGING_MESSAGES_PUSH_MODULE WAP Push
+ * @brief The MMS API provides functions to add/remove incoming callback for WAP Push messages and register current application to push server.
+ * @ingroup CAPI_MESSAGING_MESSAGES_MODULE
+ *
+ * @addtogroup CAPI_MESSAGING_MESSAGES_PUSH_MODULE
+ *
+ * @section CAPI_MESSAGING_MESSAGES_PUSH_MODULE_HEADER Required Header
+ * \#include <messages.h>
+ *
+ * @section CAPI_MESSAGING_MESSAGES_PUSH_MODULE_OVERVIEW Overview
+ *
+ * The WAP PUSH API provides the following functionalities:
+ *
+ * - Adding/Removing incoming callback for WAP Push messages
+ * - Managing the registration
+ *
+ * @section CAPI_MESSAGING_MESSAGES_PUSH_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ * - http://tizen.org/feature/network.telephony\n
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ *
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ *
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ *
+ * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ *
+ */
+
+#endif /* __TIZEN_MESSAGES_DOC_H__ */
diff --git a/include/messages.h b/include/messages.h
index 0404c37..e3e32b9 100644
--- a/include/messages.h
+++ b/include/messages.h
@@ -11,7 +11,7 @@
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
- * limitations under the License.
+ * limitations under the License.
*/
#ifndef __TIZEN_MESSAGING_H__
@@ -40,17 +40,25 @@ extern "C"
/**
- * @brief Opens a handle for messaging service.
+ * @brief Opens a handle for the messaging service.
*
- * @remark @a service must be released with messages_close_service() by you.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/message.read
+ *
+ * @remarks You must release @a service using messages_close_service().
*
* @param[out] service The message service handle
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_SERVER_NOT_READY Server is not read
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_SERVER_NOT_READY Server is not read
* @retval #MESSAGES_ERROR_COMMUNICATION_WITH_SERVER_FAILED Communication with server failed
+ * @retval #MESSAGES_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @see messages_close_service()
*/
@@ -58,14 +66,22 @@ int messages_open_service(messages_service_h *service);
/**
- * @brief Closes a handle for messaging service.
+ * @brief Closes a handle for the messaging service.
+ *
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/message.read
*
* @param[in] service The message service handle
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #MESSAGES_ERROR_COMMUNICATION_WITH_SERVER_FAILED Communication with server failed
+ * @retval #MESSAGES_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @see messages_open_service()
*/
@@ -75,16 +91,21 @@ int messages_close_service(messages_service_h service);
/**
* @brief Creates a message handle.
*
- * @remark @a msg must be released with messages_destroy_message() by you.
+ * @since_tizen 2.3
+ *
+ * @remarks You must release @a msg using messages_destroy_message().
+ *
+ * @param[in] type The message type (#MESSAGES_TYPE_SMS or #MESSAGES_TYPE_MMS) \n
+ * If @a type is #MESSAGES_TYPE_UNKNOWN, #MESSAGES_ERROR_INVALID_PARAMETER occurs.
+ * @param[out] msg The message handle that is newly created if successful
*
- * @param[in] type A message type (MESSAGES_TYPE_SMS or MESSAGES_TYPE_MMS) \n
- * If @a type is #MESSAGES_TYPE_UNKNOWN, #MESSAGES_ERROR_INVALID_PARAMETER occurs.
- * @param[out] msg A message handle to be newly created if successful
+ * @return @c 0 on success,
+ * otherwise a negative error value
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_NONE Successful
* @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @see messages_destroy_message()
*/
@@ -92,54 +113,117 @@ int messages_create_message(messages_message_type_e type, messages_message_h *ms
/**
- * @brief Destroys a message handle and release all its resources.
+ * @brief Destroys a message handle and releases all its resources.
*
- * @param[in] msg A message handle to destroy
+ * @since_tizen 2.3
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in] msg The message handle to destroy
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @see messages_create_message()
*/
int messages_destroy_message(messages_message_h msg);
/**
- * @brief Gets the message id of the message.
+ * @brief Gets the message ID of the message.
*
- * @param[in] msg The message handle
- * @param[out] msg_id The message id
+ * @since_tizen 2.3
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_OPERATION_FAILED Messaging operation failed
+ * @param[in] msg The message handle
+ * @param[out] msg_id The message ID
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_OPERATION_FAILED Messaging operation failed
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @see messages_search_message_by_id()
*/
int messages_get_message_id(messages_message_h msg, int *msg_id);
+
+/**
+ * @brief Sets the SIM ID of the sending message.
+ *
+ * @since_tizen 2.3
+ *
+ * @param[in] msg The message handle
+ * @param[in] sim_id The SIM id to send message
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_OPERATION_FAILED Messaging operation failed
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see messages_get_sim_id()
+ */
+int messages_set_sim_id(messages_message_h msg, int sim_id);
+
+
+/**
+ * @brief Gets the SIM ID of the message.
+ *
+ * @since_tizen 2.3
+ *
+ * @param[in] msg The message handle
+ * @param[out] sim_id The SIM id of message
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_OPERATION_FAILED Messaging operation failed
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see messages_set_sim_id()
+ */
+int messages_get_sim_id(messages_message_h msg, int *sim_id);
+
+
/**
* @brief Gets the message box type of the message.
*
- * @param[in] msg The message handle
- * @param[out] mbox The message box type
+ * @since_tizen 2.3
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in] msg The message handle
+ * @param[out] mbox The message box type
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*/
int messages_get_mbox_type(messages_message_h msg, messages_message_box_e *mbox);
/**
* @brief Gets the destination port of the message.
*
- * @param[in] msg The message handle
- * @param[out] port The destination port of the message
+ * @since_tizen 2.3
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in] msg The message handle
+ * @param[out] port The destination port of the message
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @see messages_add_sms_listening_port()
*/
@@ -148,12 +232,17 @@ int messages_get_message_port(messages_message_h msg, int *port);
/**
* @brief Gets the type of the message.
*
- * @param[in] msg The message handle
+ * @since_tizen 2.3
+ *
+ * @param[in] msg The message handle
* @param[out] type The message type
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*/
int messages_get_message_type(messages_message_h msg, messages_message_type_e *type);
@@ -162,14 +251,19 @@ int messages_get_message_type(messages_message_h msg, messages_message_type_e *t
* @brief Adds an recipient's address(phone number) to the message.
* @details The maximum number of recipients per a message is 10.
*
- * @param[in] msg The message handle
- * @param[in] address The recipient's address to receive a message \n
- * The maximum length of @a address is 254.
- * @param[in] type The recipient's type of the @a address
+ * @since_tizen 2.3
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in] msg The message handle
+ * @param[in] address The recipient's address to receive a message \n
+ * The maximum length of @a address is @c 254.
+ * @param[in] type The recipient's type of the @a address
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @see messages_get_address()
* @see messages_remove_all_addresses()
@@ -180,12 +274,17 @@ int messages_add_address(messages_message_h msg, const char *address, messages_r
/**
* @brief Gets the total number of recipients in the message.
*
- * @param[in] msg The message handle
- * @param[out] count The total number of recipients
+ * @since_tizen 2.3
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in] msg The message handle
+ * @param[out] count The total number of recipients
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @see messages_add_address()
* @see messages_remove_all_addresses()
@@ -196,17 +295,22 @@ int messages_get_address_count(messages_message_h msg, int *count);
/**
* @brief Gets a recipient's address with specified index.
*
- * @remarks @a address must be released with @c free() by you.
+ * @since_tizen 2.3
*
- * @param[in] msg The message handle
- * @param[in] index The zero-based index of address to receive a message.
- * @param[out] address The recipient's address with specified index
- * @param[out] type The recipient's type of the @a address.
+ * @remarks You must release @a address using free().
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in] msg The message handle
+ * @param[in] index The zero-based index of an address to receive a message.
+ * @param[out] address The recipient's address with specified index
+ * @param[out] type The recipient's type of the @a address
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @see messages_add_address()
* @see messages_remove_all_addresses()
@@ -217,11 +321,16 @@ int messages_get_address(messages_message_h msg, int index, char **address, mess
/**
* @brief Removes all recipients in the message.
*
+ * @since_tizen 2.3
+ *
* @param[in] msg The message handle
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @see messages_add_address()
* @see messages_get_address()
@@ -232,14 +341,19 @@ int messages_remove_all_addresses(messages_message_h msg);
/**
* @brief Sets the text of the message.
*
- * @param[in] msg The message handle
+ * @since_tizen 2.3
+ *
+ * @param[in] msg The message handle
* @param[in] text The text of the message \n
- * The maximum length of @a text is 1530.
+ * The maximum length of @a text is @c 1530.
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @see messages_get_text()
*/
@@ -249,15 +363,20 @@ int messages_set_text(messages_message_h msg, const char *text);
/**
* @brief Gets the text of the message.
*
- * @remarks @a text must be released with @c free() by you.
+ * @since_tizen 2.3
*
- * @param[in] msg The message handle
- * @param[out] text The text of the message
+ * @remarks You must release @a text using free().
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
+ * @param[in] msg The message handle
+ * @param[out] text The text of the message
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @see messages_set_text()
*/
@@ -267,52 +386,72 @@ int messages_get_text(messages_message_h msg, char **text);
/**
* @brief Gets the time of the message.
*
- * @param[in] msg The message handle
- * @param[out] time The time of the message
+ * @since_tizen 2.3
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @param[in] msg The message handle
+ * @param[out] time The time of the message
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*/
int messages_get_time(messages_message_h msg, time_t *time);
/**
* @brief Sends the message to all recipients.
*
- * @remarks In order to check whether sending a message succeeds,
- * you should register messages_sent_cb() using messages_set_message_sent_cb().
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/message.write
*
- * @param[in] service The message service handle
- * @param[in] msg The message handle
- * @param[in] save_to_sentbox Set to true to save the message in the sentbox, else false
- * @param[in] callback The callback function
- * @param[in] user_data The user data to be passed to the callback function
+ * @param[in] service The message service handle
+ * @param[in] msg The message handle
+ * @param[in] save_to_sentbox Set to @c true to save the message in the sentbox,
+ * otherwise set to @c false to not save the message in the sentbox
+ * @param[in] callback The callback function
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_NONE Successful
* @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_SENDING_FAILED Sending a message failed
- * @retval #MESSAGES_ERROR_OPERATION_FAILED Messaging operation failed
+ * @retval #MESSAGES_ERROR_SENDING_FAILED Sending a message failed
+ * @retval #MESSAGES_ERROR_OPERATION_FAILED Messaging operation failed
+ * @retval #MESSAGES_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @see messages_sent_cb()
*/
int messages_send_message(messages_service_h service, messages_message_h msg, bool save_to_sentbox, messages_sent_cb callback, void *user_data);
/**
- * @brief Gets the message count in the specific message box
+ * @brief Gets the message count in the specific message box.
+ * @since_tizen 2.3
*
- * @param[in] service The message service handle
- * @param[in] mbox The message box type
- * @param[in] type The message type \n
- * If @a type is #MESSAGES_TYPE_UNKNOWN, all sms and mms messages are counted.
- * @param[out] count The number of messages
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/message.read
+ *
+ * @param[in] service The message service handle
+ * @param[in] mbox The message box type
+ * @param[in] type The message type \n
+ * If @a type is #MESSAGES_TYPE_UNKNOWN, all SMS and MMS messages are counted.
+ * @param[out] count The number of messages
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
* @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_OPERATION_FAILED Messaging operation failed
+ * @retval #MESSAGES_ERROR_OPERATION_FAILED Messaging operation failed
+ * @retval #MESSAGES_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
+ *
*/
-int messages_get_message_count(messages_service_h service,
+int messages_get_message_count(messages_service_h service,
messages_message_box_e mbox, messages_message_type_e type,
int *count);
@@ -321,27 +460,36 @@ int messages_get_message_count(messages_service_h service,
/**
* @brief Searches for messages.
*
- * @details @a message_array must be released with messages_free_message_array() by you.
- *
- * @param[in] service The message service handle
- * @param[in] mbox The message box type
- * @param[in] type The message type \n
- * If @a type is #MESSAGES_TYPE_UNKNOWN, all sms and mms messages are searched.
- * @param[in] keyword The keyword search in text and subject
- * @param[in] address The recipient address
- * @param[in] offset The start position (base 0)
- * @param[in] limit The maximum amount of messages to get (In case of 0, this method passes to the callback all searched messages.)
- * @param[out] message_array The array of the message handle
- * @param[out] length The number of messages of the message_array
- * @param[out] total The count of the messages that have been retrieved as a result without applying @a limit and @a offset. \n
- * The value can be used to calculate the total number of page views for the searched messages.\n
- * For example, if the count of message search is 50 and the limit is 20, then using this value, you can notice the total page is 3.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MESSAGES_ERROR_OPERATION_FAILED Messaging operation failed
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/message.read
+ *
+ * @remarks You must release @a message_array using messages_free_message_array().
+ *
+ * @param[in] service The message service handle
+ * @param[in] mbox The message box type
+ * @param[in] type The message type \n
+ * If @a type is #MESSAGES_TYPE_UNKNOWN, all SMS and MMS messages are searched.
+ * @param[in] keyword The keyword search in the text and subject
+ * @param[in] address The recipient address
+ * @param[in] offset The start position (base @c 0)
+ * @param[in] limit The maximum amount of messages to get \n
+ * In case of @c 0, this method passes to the callback all searched messages.
+ * @param[out] message_array The array of the message handle
+ * @param[out] length The number of messages of the @a message_array
+ * @param[out] total The count of the messages that have been retrieved as a result without applying @a limit and @a offset\ n
+ * The value can be used to calculate the total number of page views for the searched messages\ n
+ * For example, if the count of message search is @c 50 and the limit is @c 20, then using this value, you can notice the total page is @c 3.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MESSAGES_ERROR_OPERATION_FAILED Messaging operation failed
+ * @retval #MESSAGES_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @see messages_free_message_array()
*/
@@ -351,20 +499,28 @@ int messages_search_message(messages_service_h service,
const char *keyword, const char *address,
int offset, int limit,
messages_message_h **message_array, int *length, int *total);
-
+
/**
- * @brief Searches a message with the given message id.
+ * @brief Searches a message with the given message ID.
*
- * @remark @a msg must be released with messages_destroy_message() by you.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/message.read
*
- * @param[in] service The message service handle
- * @param[in] msg_id The message id
- * @param[out] msg A message handle to be newly created if successful
+ * @remarks You must release @a msg using messages_destroy_message().
+ *
+ * @param[in] service The message service handle
+ * @param[in] msg_id The message ID
+ * @param[out] msg The message handle that is newly created if successful
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
* @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MESSAGES_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @see messages_get_message_id()
*/
@@ -372,13 +528,18 @@ int messages_search_message_by_id(messages_service_h service, int msg_id, messag
/**
- * @brief Frees message array.
+ * @brief Frees the message array.
+ *
+ * @since_tizen 2.3
*
* @param[in] message_array The array of the message handle
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
* @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @see messages_search_message()
*/
@@ -388,24 +549,34 @@ int messages_free_message_array(messages_message_h *message_array);
/**
* @brief Retrieves the searched messages by invoking the given callback function iteratively.
*
- * @param[in] service The message service handle
- * @param[in] mbox The message box type
- * @param[in] type The message type \n
- * If @a type is #MESSAGES_TYPE_UNKNOWN, all sms and mms messages are searched.
- * @param[in] keyword The keyword search in text and subject
- * @param[in] address The recipient address
- * @param[in] offset The start position (base 0)
- * @param[in] limit The maximum amount of messages to get (In case of 0, this method passes to the callback all searched messages.)
- * @param[in] callback The callback function to get a message
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/message.read
+ *
+ * @param[in] service The message service handle
+ * @param[in] mbox The message box type
+ * @param[in] type The message type \n
+ * If @a type is #MESSAGES_TYPE_UNKNOWN, all SMS and MMS messages are searched.
+ * @param[in] keyword The keyword search in the text and subject
+ * @param[in] address The recipient address
+ * @param[in] offset The start position (base 0)
+ * @param[in] limit The maximum amount of messages to get \n
+ * In case of @c 0, this method passes to the callback all searched messages.
+ * @param[in] callback The callback function to get a message
* @param[in] user_data The user data to be passed to the callback function
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
* @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MESSAGES_ERROR_OPERATION_FAILED Messaging operation failed
+ * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MESSAGES_ERROR_OPERATION_FAILED Messaging operation failed
+ * @retval #MESSAGES_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @post It invokes messages_search_cb().
+ *
* @see messages_search_cb()
*/
int messages_foreach_message(messages_service_h service,
@@ -418,14 +589,22 @@ int messages_foreach_message(messages_service_h service,
/**
* @brief Registers a callback to be invoked when an incoming message is received.
*
- * @param[in] service The message service handle
- * @param[in] callback The callback function
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/message.read
+ *
+ * @param[in] service The message service handle
+ * @param[in] callback The callback function
* @param[in] user_data The user data to be passed to the callback function
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
* @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_OPERATION_FAILED Messaging operation failed
+ * @retval #MESSAGES_ERROR_OPERATION_FAILED Messaging operation failed
+ * @retval #MESSAGES_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @post It will invoke messages_incoming_cb().
*
@@ -438,11 +617,19 @@ int messages_set_message_incoming_cb(messages_service_h service, messages_incomi
/**
* @brief Unregisters the callback function.
*
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/message.write
+ *
* @param[in] service The message service handle
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
* @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @see messages_set_message_incoming_cb()
* @see messages_incoming_cb()
@@ -452,12 +639,20 @@ int messages_unset_message_incoming_cb(messages_service_h service);
/**
* @brief Adds an additional listening port for the incoming SMS messages.
*
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/message.read
+ *
* @param[in] service The message service handle
- * @param[in] port The listening port for the SMS messages
+ * @param[in] port The listening port for the SMS messages
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
* @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @see messages_set_message_incoming_cb()
* @see messages_get_message_port()
@@ -471,13 +666,18 @@ int messages_add_sms_listening_port(messages_service_h service, int port);
/**
* @brief Sets the subject of the message.
*
- * @param[in] msg The message handle
+ * @since_tizen 2.3
+ *
+ * @param[in] msg The message handle
* @param[in] subject The subject of the message \n
- * The maximum length of @a subject is 120.
+ * The maximum length of @a subject is @c 120.
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
* @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @pre @a msg is created as a #MESSAGES_TYPE_MMS.
*
@@ -489,15 +689,20 @@ int messages_mms_set_subject(messages_message_h msg, const char *subject);
/**
* @brief Gets the subject of the message.
*
- * @remarks @a subject must be released with @c free() by you.
+ * @since_tizen 2.3
*
- * @param[in] msg The message handle
+ * @remarks You must release @a subject using free().
+ *
+ * @param[in] msg The message handle
* @param[out] subject The subject of the message
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
* @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @pre @a msg is created as a #MESSAGES_TYPE_MMS.
*
@@ -509,21 +714,26 @@ int messages_mms_get_subject(messages_message_h msg, char **subject);
/**
* @brief Adds the attachment to the MMS message.
*
- * @param[in] msg The message handle
+ * @since_tizen 2.3
+ *
+ * @param[in] msg The message handle
* @param[in] type The attachment type
* @param[in] path The file path to attach \n
- * The maximum length of @a path is 1024.
+ * The maximum length of @a path is @c 1024.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_NONE Successful
* @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @pre @a msg is created as a #MESSAGES_TYPE_MMS.
*
* @see messages_mms_get_attachment()
* @see messages_mms_get_attachment_count()
- * @see messages_mms_remove_all_attachments()
+ * @see messages_mms_remove_all_attachments()
*/
int messages_mms_add_attachment(messages_message_h msg, messages_media_type_e type, const char *path);
@@ -531,23 +741,28 @@ int messages_mms_add_attachment(messages_message_h msg, messages_media_type_e ty
/**
* @brief Gets the file path of the attachment with the specified index.
*
- * @remark @a path must be released with @c free() by you.
+ * @since_tizen 2.3
*
- * @param[in] msg The message handle
- * @param[in] index The zero-based index of attachment
- * @param[out] type The attachment type
- * @param[out] path The file path to attach
+ * @remarks You must release @a path using free().
+ *
+ * @param[in] msg The message handle
+ * @param[in] index The zero-based index of the attachment
+ * @param[out] type The attachment type
+ * @param[out] path The file path to attach
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_NONE Successful
* @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @pre @a msg is created as a #MESSAGES_TYPE_MMS.
*
* @see messages_mms_add_attachment()
* @see messages_mms_get_attachment_count()
- * @see messages_mms_remove_all_attachments()
+ * @see messages_mms_remove_all_attachments()
*/
int messages_mms_get_attachment(messages_message_h msg, int index, messages_media_type_e *type, char **path);
@@ -555,18 +770,23 @@ int messages_mms_get_attachment(messages_message_h msg, int index, messages_medi
/**
* @brief Gets the attachment with the specified index.
*
- * @param[in] msg The message handle
+ * @since_tizen 2.3
+ *
+ * @param[in] msg The message handle
* @param[out] count The total number of attachments
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
* @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @pre @a msg is created as a #MESSAGES_TYPE_MMS.
*
* @see messages_mms_add_attachment()
* @see messages_mms_get_attachment()
- * @see messages_mms_remove_all_attachments()
+ * @see messages_mms_remove_all_attachments()
*/
int messages_mms_get_attachment_count(messages_message_h msg, int *count);
@@ -574,17 +794,22 @@ int messages_mms_get_attachment_count(messages_message_h msg, int *count);
/**
* @brief Removes all attachments to the MMS message.
*
+ * @since_tizen 2.3
+ *
* @param[in] msg The message handle
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
* @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
* @pre @a msg is created as a #MESSAGES_TYPE_MMS.
*
* @see messages_mms_add_attachment()
* @see messages_mms_get_attachment()
- * @see messages_mms_get_attachment_count()
+ * @see messages_mms_get_attachment_count()
*/
int messages_mms_remove_all_attachments(messages_message_h msg);
/**
@@ -599,28 +824,41 @@ int messages_mms_remove_all_attachments(messages_message_h msg);
/**
* @brief Registers a callback to be invoked when an WAP Push message is received.
*
- * @param[in] service The message service handle
- * @param[in] app_id The "X-WAP-Application-ID" to indicate a destination WAP Push application id.
- * @param[in] callback The callback function
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/message.read
+ *
+ * @param[in] service The message service handle
+ * @param[in] app_id The "X-WAP-Application-ID" to indicate a destination WAP Push application ID
+ * @param[in] callback The callback function
* @param[in] user_data The user data to be passed to the callback function
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
* @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*/
-int messages_push_add_incoming_cb(messages_service_h service, const char *app_id,
+int messages_push_add_incoming_cb(messages_service_h service, const char *app_id,
messages_push_incoming_cb callback, void *user_data);
/**
* @brief Unregisters the WAP push incoming callback function.
*
+ * @since_tizen 2.3
+ *
* @param[in] service The message service handle
- * @param[in] app_id The "X-WAP-Application-ID" to indicate a destination WAP Push application id
+ * @param[in] app_id The "X-WAP-Application-ID" to indicate a destination WAP Push application ID
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #MESSAGES_ERROR_NONE Successful
* @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*/
int messages_push_remove_incoming_cb(messages_service_h service, const char *app_id);
@@ -628,416 +866,83 @@ int messages_push_remove_incoming_cb(messages_service_h service, const char *app
/**
* @brief Registers an application to the mapping table of the WAP Push service.
*
- * @param[in] service The message service handle
- * @param[in] content_type The MIME content type of the content
- * @param[in] app_id The "X-WAP-Application-ID" to indicate a destination WAP Push application id
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int messages_push_register(messages_service_h service, const char *content_type, const char *app_id);
-
-
-/**
- * @brief Deregisters an application from the mapping table of the WAP Push service.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/message.write
*
- * @param[in] service The message service handle
+ * @param[in] service The message service handle
* @param[in] content_type The MIME content type of the content
- * @param[in] app_id The "X-WAP-Application-ID" to indicate a destination WAP Push application id
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int messages_push_deregister(messages_service_h service, const char *content_type, const char *app_id);
-
-
-/**
- * @brief Re-registers an application to the mapping table of the WAP Push service.
- *
- * @param[in] service The message service handle
- * @param[in] content_type An element of the composite key for searching registered entry.\n
- * The MIME content type of the content.
- * @param[in] app_id The The composite key for searching mapping information.\n
- * "X-WAP-Application-ID" to indicate a destination WAP Push application id.
- * @param[in] dst_content_type The MIME content type of the content.
- * @param[in] dst_app_id The "X-WAP-Application-ID" to indicate a destination WAP Push application id.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int messages_push_reregister(messages_service_h service, const char *content_type, const char *app_id,
- const char *dst_content_type, const char *dst_app_id);
-
-/**
- * @}
- */
-
-
-/**
- * @addtogroup CAPI_MESSAGING_MESSAGES_CB_MODULE
- * @{
- */
-
-/**
- * @brief Gets the message id of the CB message.
+ * @param[in] app_id The "X-WAP-Application-ID" to indicate a destination WAP Push application ID
*
- * @param[in] msg The CB message handle
- * @param[out] msg_id The message id of the CB message
+ * @return @c 0 on success,
+ * otherwise a negative error value
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_NONE Successful
* @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MESSAGES_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*/
-int messages_cb_get_message_id(messages_cb_message_h msg, int *msg_id);
-
-/**
- * @brief Gets the serial number of the CB message.
- *
- * @param[in] msg The CB message handle
- * @param[out] serial The serial number of the CB message (16-bit integer)
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int messages_cb_get_serial_number(messages_cb_message_h msg, int *serial);
-
-/**
- * @brief Gets the DCS(Data Coding Scheme) value of the CB message.
- *
- * @param[in] msg The CB message handle
- * @param[out] dcs The DCS value of the CB message (8-bit integer)
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int messages_cb_get_dcs(messages_cb_message_h msg, int *dcs);
-
-/**
- * @brief Gets the message type of the CB message.
- *
- * @param[in] msg The CB message handle
- * @param[out] type The message type of the CB message
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int messages_cb_get_message_type(messages_cb_message_h msg, messages_message_type_e *type);
-
-
-/**
- * @brief Gets the language type of the CB message.
- *
- * @remarks @a type must be released with @c free() by you.
- *
- * @param[in] msg The CB message handle
- * @param[out] text The language type of the CB message
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
- */
-int messages_cb_get_language_type(messages_cb_message_h msg, char **type);
-
-/**
- * @brief Gets the text contents of the CB message.
- *
- * @remarks @a text must be released with @c free() by you.
- *
- * @param[in] msg The CB message handle
- * @param[out] text The the text of the CB message
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_OPERATION_FAILED if the type of @a msg is MESSAGES_CB_TYPE_ETWS_PRIMARY
- * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
- */
-int messages_cb_get_text(messages_cb_message_h msg, char **text);
-
-
-/**
- * @brief Gets the received time of the CB message.
- *
- * @param[in] msg The CB message handle
- * @param[out] time The recieved time of the CB message
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int messages_cb_get_time(messages_cb_message_h msg, time_t *time);
-
-
-/**
- * @brief Registers a callback to be invoked when an CB message is received.
- *
- * @param[in] service The message service handle
- * @param[in] save Set to true to save the message, else false.
- * @param[in] callback The callback function
- * @param[in] user_data The user data to be passed to the callback function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int messages_cb_set_incoming_cb(messages_service_h service, bool save,
- messages_cb_incoming_cb callback, void *user_data);
-
-
-/**
- * @brief Unregisters the callback function for cb incoming message.
- *
- * @param[in] service The message service handle
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int messages_cb_unset_incoming_cb(messages_service_h service);
-
-/**
- * @brief Registers a callback to be invoked when an ETWS primary notification message is received.
- *
- * @param[in] service The message service handle
- * @param[in] callback The callback function
- * @param[in] user_data The user data to be passed to the callback function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int messages_cb_set_etws_primary_noti_cb(messages_service_h service,
- messages_cb_etws_primary_noti_cb callback, void *user_data);
-
-/**
- * @brief Unregisters the callback function for ETWS primary notification message is received.
- *
- * @param[in] service The message service handle
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int messages_cb_unset_etws_primary_noti_cb(messages_service_h service);
-
-
-/**
- * @brief Loads the settings for CB messaging.
- *
- * @remark The @a settings will be free automatically when the @a service is destroyed.
- *
- * @param[in] service The message service handle
- * @param[out] settings The settings handle
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
- */
-int messages_cb_load_settings(messages_service_h service, messages_cb_settings_h *settings);
-
-/**
- * @brief Saves the settings for CB messaging.
- *
- * @param[in] service The message service handle
- * @param[in] settings The settings handle
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int messages_cb_save_settings(messages_service_h service, messages_cb_settings_h settings);
-
-/**
- * @brief Enables or disables the CB messaging.
- *
- * @param[in] settings The settings handle
- * @param[in] enabled If true, the CB messaging is enabled. otherwise the CB messaging is disabled.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int messages_cb_settings_set_enabled(messages_cb_settings_h settings, bool enabled);
-
-/**
- * @brief Determines whether the CB messaging is enabled.
- *
- * @param[in] settings The settings handle
- * @param[out] enabled true if the CB messaging is enabled, false otherwise.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int messages_cb_settings_is_enabled(messages_cb_settings_h settings, bool *enabled);
-
-/**
- * @brief Adds a channel to the CB messaging settings.
- *
- * @param[in] settings The settings handle
- * @param[in] channel The channel handle to add
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_OUT_OF_RANGE Maximum cb channels exceeded
- */
-int messages_cb_settings_add_channel(messages_cb_settings_h settings, messages_cb_channel_h channel);
-
-/**
- * @brief Removes a channel from the CB messaging settings.
- *
- * @param[in] settings The settings handle
- * @param[in] channel The channel handle to remove
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int messages_cb_settings_remove_channel(messages_cb_settings_h settings, messages_cb_channel_h channel);
+int messages_push_register(messages_service_h service, const char *content_type, const char *app_id);
-/**
- * @brief Gets a channel from the CB messaging settings.
- *
- * @param[in] settings The settings handle
- * @param[in] index The zero-based index of channel to receive
- * @param[out] channel The channel with specified index
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_OPERATION_FAILED Messaging operation failed
- */
-int messages_cb_settings_get_channel(messages_cb_settings_h settings, int index, messages_cb_channel_h *channel);
/**
- * @brief Gets the total number of channels in the settings.
+ * @brief De-registers an application from the mapping table of the WAP Push service.
*
- * @param[in] settings The settings handle
- * @param[out] count The total number of channels
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/message.write
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int messages_cb_settings_get_channel_count(messages_cb_settings_h settings, int *count);
-
-/**
- * @brief Creates a channel handle.
- *
- * @remark @a channel must be released with messages_cb_destroy_channel() by you.
+ * @param[in] service The message service handle
+ * @param[in] content_type The MIME content type of the content
+ * @param[in] app_id The "X-WAP-Application-ID" to indicate a destination WAP Push application ID
*
- * @param[out] channel A message handle to be newly created if successful
+ * @return @c 0 on success,
+ * otherwise a negative error value
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_NONE Successful
* @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MESSAGES_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*/
-int messages_cb_create_channel(messages_cb_channel_h *channel);
+int messages_push_deregister(messages_service_h service, const char *content_type, const char *app_id);
-/**
- * @brief Destroys a channel handle and release all its resource.
- *
- * @param[in] channel A channel handle to destroy
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int messages_cb_destroy_channel(messages_cb_channel_h channel);
/**
- * @brief Sets the range of channel id values for the CB messaging.
+ * @brief Re-registers an application to the mapping table of the WAP Push service.
*
- * @param[in] channel The channel handle
- * @param[in] from_id The start of the range of channel id values.
- * @param[in] to_id The end of the range of channel id values.
+ * @since_tizen 2.3
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/message.write
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int messages_cb_channel_set_id(messages_cb_channel_h channel, int from_id, int to_id);
-
-/**
- * @brief Gets the range of channel id values for the CB messaging.
+ * @param[in] service The message service handle
+ * @param[in] content_type An element of the composite key for searching registered entry \n
+ * The MIME content type of the content.
+ * @param[in] app_id The composite key for searching mapping information \n
+ * The "X-WAP-Application-ID" to indicate a destination WAP Push application ID.
+ * @param[in] dst_content_type The MIME content type of the content
+ * @param[in] dst_app_id The "X-WAP-Application-ID" to indicate a destination WAP Push application ID
*
- * @param[in] channel The channel handle
- * @param[out] from_id The start of the range of channel id values.
- * @param[out] to_id The end of the range of channel id values.
+ * @return @c 0 on success,
+ * otherwise a negative error value
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
+ * @retval #MESSAGES_ERROR_NONE Successful
* @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int messages_cb_channel_get_id(messages_cb_channel_h channel, int *from_id, int *to_id);
-
-/**
- * @brief Sets the name of the channel.
- *
- * @param[in] channel The channel handle
- * @param[in] name The name of the channel
+ * @retval #MESSAGES_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @retval #MESSAGES_ERROR_NOT_SUPPORTED Not supported
*
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MESSAGES_ERROR_OUT_OF_RANGE Maximum length of name exceeded
- */
-int messages_cb_channel_set_name(messages_cb_channel_h channel, const char *name);
-
-/**
- * @brief Gets the name of the channel.
- *
- * @param[in] channel The channel handle
- * @param[out] name The name of the channel
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
*/
-int messages_cb_channel_get_name(messages_cb_channel_h channel, char **name);
+int messages_push_reregister(messages_service_h service, const char *content_type, const char *app_id,
+ const char *dst_content_type, const char *dst_app_id);
/**
- * @brief Activates or deactivates a specific channel.
- *
- * @param[in] channel The channel handle
- * @param[in] activated If true, the channel is activated. otherwise, the channel is deactivated.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
+ * @}
*/
-int messages_cb_channel_set_activated(messages_cb_channel_h channel, bool activated);
/**
- * @brief Determines whether the channel is activated.
- *
- * @param[in] channel The channel handle
- * @param[out] activated true If the channel is activated, false otherwise.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #MESSAGES_ERROR_NONE Successful
- * @retval #MESSAGES_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int messages_cb_channel_is_activated(messages_cb_channel_h channel, bool *activated);
-
-
-
-/**
* @}
*/
-
#ifdef __cplusplus
}
#endif
diff --git a/include/messages_error.h b/include/messages_error.h
index 41b6217..b156936 100644
--- a/include/messages_error.h
+++ b/include/messages_error.h
@@ -38,13 +38,15 @@ typedef enum {
MESSAGES_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
MESSAGES_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
MESSAGES_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- MESSAGES_ERROR_SERVER_NOT_READY = TIZEN_ERROR_MESSAGING_CLASS|0x501, /**< Server is not read */
- MESSAGES_ERROR_COMMUNICATION_WITH_SERVER_FAILED = TIZEN_ERROR_MESSAGING_CLASS|0x502, /**< Communication with server failed */
- MESSAGES_ERROR_OUT_OF_RANGE = TIZEN_ERROR_MESSAGING_CLASS|0x503, /**< Index out of range */
- MESSAGES_ERROR_SENDING_FAILED = TIZEN_ERROR_MESSAGING_CLASS|0x504, /**< Sending a message failed */
- MESSAGES_ERROR_OPERATION_FAILED = TIZEN_ERROR_MESSAGING_CLASS|0x505, /**< Messaging operation failed */
- MESSAGES_ERROR_NO_SIM_CARD = TIZEN_ERROR_MESSAGING_CLASS|0x506, /**< No SIM Card */
- MESSAGES_ERROR_NO_DATA = TIZEN_ERROR_MESSAGING_CLASS|0x507, /**< No data available */
+ MESSAGES_ERROR_SERVER_NOT_READY = TIZEN_ERROR_MESSAGING_SERVICE|0x501, /**< Server is not read */
+ MESSAGES_ERROR_COMMUNICATION_WITH_SERVER_FAILED = TIZEN_ERROR_MESSAGING_SERVICE|0x502, /**< Communication with server failed */
+ MESSAGES_ERROR_OUT_OF_RANGE = TIZEN_ERROR_MESSAGING_SERVICE|0x503, /**< Index out of range */
+ MESSAGES_ERROR_SENDING_FAILED = TIZEN_ERROR_MESSAGING_SERVICE|0x504, /**< Sending a message failed */
+ MESSAGES_ERROR_OPERATION_FAILED = TIZEN_ERROR_MESSAGING_SERVICE|0x505, /**< Messaging operation failed */
+ MESSAGES_ERROR_NO_SIM_CARD = TIZEN_ERROR_MESSAGING_SERVICE|0x506, /**< No SIM Card */
+ MESSAGES_ERROR_NO_DATA = TIZEN_ERROR_MESSAGING_SERVICE|0x507, /**< No data available */
+ MESSAGES_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+ MESSAGES_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
} messages_error_e;
/**
diff --git a/include/messages_private.h b/include/messages_private.h
index f557646..53ac983 100644
--- a/include/messages_private.h
+++ b/include/messages_private.h
@@ -11,7 +11,7 @@
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
- * limitations under the License.
+ * limitations under the License.
*/
#ifndef __TIZEN_MESSAGING_PRIVATE_H__
@@ -22,6 +22,8 @@ extern "C"
{
#endif
+#include <system_info.h>
+
typedef struct _messages_service_s {
msg_handle_t service_h;
void* incoming_cb;
@@ -29,17 +31,6 @@ typedef struct _messages_service_s {
bool incoming_cb_enabled;
GSList* sent_cb_list;
GSList* push_incoming_cb_list;
-
- bool cbs_enabled_cb;
-
- void* cbs_incoming_cb;
- void* cbs_incoming_cb_user_data;
- bool cbs_incoming_cb_save;
-
- void* etws_incoming_cb;
- void* etws_incoming_cb_user_data;
-
- messages_cb_settings_h cbs_settings_h;
} messages_service_s;
typedef struct _messages_message_s {
@@ -65,29 +56,11 @@ typedef struct _messages_push_incoming_callback_s {
void* user_data;
} messages_push_incoming_callback_s;
+#define MESSAGES_PRIVILEGE_READ "http://tizen.org/privilege/message.read"
+#define MESSAGES_PRIVILEGE_WRITE "http://tizen.org/privilege/message.write"
-
-// CBS
-
-#define MESSAGES_ETWS_WARNING_INFO_LEN 50
-
-typedef struct _messages_cb_message_s {
- msg_struct_t cb_msg_h;
-} messages_cb_message_s;
-
-typedef struct _messages_cb_settings_s {
- msg_struct_t _struct;
- GSList* channel_list;
-} messages_cb_settings_s;
-
-typedef struct _messages_cb_channel_s {
- int from_id;
- int to_id;
- char name[CB_CHANNEL_NAME_MAX + 1];
- bool activated;
-} messages_cb_channel_s;
-
-
+#define MESSAGES_TELEPHONY_FEATURE "http://tizen.org/feature/network.telephony"
+#define MESSAGES_TELEPHONY_MMS_FEATURE "http://tizen.org/feature/network.telephony.mms"
#define ERROR_CONVERT(err) _messages_error_converter(err, __FUNCTION__, __LINE__);
#define CHECK_NULL(p) \
@@ -96,18 +69,29 @@ typedef struct _messages_cb_channel_s {
__FUNCTION__, MESSAGES_ERROR_INVALID_PARAMETER, #p); \
return MESSAGES_ERROR_INVALID_PARAMETER; \
}
-
+
#define IS_SMS(x) ((x & MESSAGES_TYPE_SMS) == MESSAGES_TYPE_SMS)
#define IS_MMS(x) ((x & MESSAGES_TYPE_MMS) == MESSAGES_TYPE_MMS)
-
+#define CHECK_MESSAGES_SUPPORTED(feature_name) \
+ do { \
+ bool is_supported = false; \
+ if (!system_info_get_platform_bool(feature_name, &is_supported)) { \
+ if (is_supported == false) { \
+ LOGE("[%s] feature is disabled", feature_name); \
+ return MESSAGES_ERROR_NOT_SUPPORTED; \
+ } \
+ } else { \
+ LOGE("Error - Feature getting from System Info"); \
+ return MESSAGES_ERROR_OPERATION_FAILED; \
+ } \
+ } while(0)
+
int _messages_convert_mbox_to_fw(messages_message_box_e mbox);
int _messages_convert_msgtype_to_fw(messages_message_type_e type);
int _messages_convert_recipient_to_fw(messages_recipient_type_e type);
int _messages_error_converter(int err, const char *func, int line);
-int _messages_cb_clear_settings(messages_cb_settings_s *settings);
-
#ifdef __cplusplus
}
#endif
diff --git a/include/messages_types.h b/include/messages_types.h
index 7b1d44c..1bfcb0b 100644
--- a/include/messages_types.h
+++ b/include/messages_types.h
@@ -11,7 +11,7 @@
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
- * limitations under the License.
+ * limitations under the License.
*/
#ifndef __TIZEN_MESSAGING_TYPES_H__
@@ -41,69 +41,76 @@ typedef struct messages_service_s *messages_service_h;
typedef struct messages_message_s *messages_message_h;
/**
- * @brief The message box type.
+ * @brief Enumeration for the message box type.
*/
typedef enum {
- MESSAGES_MBOX_ALL = 0, /**< All message box type */
- MESSAGES_MBOX_INBOX = 1, /**< Inbox type */
- MESSAGES_MBOX_OUTBOX = 2, /**< Outbox type*/
- MESSAGES_MBOX_SENTBOX = 3, /**< Sentbox type */
- MESSAGES_MBOX_DRAFT = 4, /**< Draft type */
+ MESSAGES_MBOX_ALL = 0, /**< All message box type */
+ MESSAGES_MBOX_INBOX = 1, /**< Inbox type */
+ MESSAGES_MBOX_OUTBOX = 2, /**< Outbox type*/
+ MESSAGES_MBOX_SENTBOX = 3, /**< Sentbox type */
+ MESSAGES_MBOX_DRAFT = 4, /**< Draft type */
} messages_message_box_e;
/**
- * @brief The message type.
+ * @brief Enumeration for the message type.
*/
typedef enum {
- MESSAGES_TYPE_UNKNOWN = 0, /**< Unknown type */
- MESSAGES_TYPE_SMS = 1, /**< SMS type */
- MESSAGES_TYPE_MMS = 2, /**< MMS type */
- MESSAGES_TYPE_SMS_CB = MESSAGES_TYPE_SMS | 1 << 4, /**< CB(Cell Broadcast) Type */
- MESSAGES_TYPE_SMS_PUSH = MESSAGES_TYPE_SMS | 10 << 4, /**< WAP Push Type */
- MESSAGES_TYPE_SMS_ETWS_PRIMARY = MESSAGES_TYPE_SMS | 21 << 4, /**< ETWS(Earthquake and Tsunami Warning System) Primary Type */
- MESSAGES_TYPE_SMS_ETWS_SECONDARY = MESSAGES_TYPE_SMS | 22 << 4, /**< ETWS(Earthquake and Tsunami Warning System) Secondary Type */
+ MESSAGES_TYPE_UNKNOWN = 0, /**< Unknown type */
+ MESSAGES_TYPE_SMS = 1, /**< SMS type */
+ MESSAGES_TYPE_MMS = 2, /**< MMS type */
+ MESSAGES_TYPE_SMS_CB = MESSAGES_TYPE_SMS | 1 << 4, /**< CB(Cell Broadcast) Type */
+ MESSAGES_TYPE_SMS_PUSH = MESSAGES_TYPE_SMS | 10 << 4, /**< WAP Push Type */
+ MESSAGES_TYPE_SMS_ETWS_PRIMARY = MESSAGES_TYPE_SMS | 21 << 4, /**< ETWS(Earthquake and Tsunami Warning System) Primary Type */
+ MESSAGES_TYPE_SMS_ETWS_SECONDARY = MESSAGES_TYPE_SMS | 22 << 4, /**< ETWS(Earthquake and Tsunami Warning System) Secondary Type */
} messages_message_type_e;
/**
- * @brief The attachment type for MMS messaging.
+ * @brief Enumeration for the attachment type for MMS messaging.
*/
typedef enum {
- MESSAGES_MEDIA_UNKNOWN = 0, /**< Unknown */
- MESSAGES_MEDIA_IMAGE = 1, /**< The image */
- MESSAGES_MEDIA_AUDIO = 2, /**< The audio */
- MESSAGES_MEDIA_VIDEO = 3, /**< The video */
+ MESSAGES_MEDIA_UNKNOWN = 0, /**< Unknown */
+ MESSAGES_MEDIA_IMAGE = 1, /**< The image */
+ MESSAGES_MEDIA_AUDIO = 2, /**< The audio */
+ MESSAGES_MEDIA_VIDEO = 3, /**< The video */
} messages_media_type_e;
/**
- * @brief The recipient type of a message.
+ * @brief Enumeration for the recipient type of a message.
*/
typedef enum {
MESSAGES_RECIPIENT_UNKNOWN = 0, /**< Unknown */
- MESSAGES_RECIPIENT_TO = 1, /**< The 'To' recipient */
- MESSAGES_RECIPIENT_CC = 2, /**< The 'Cc' (carbon copy) recipient */
- MESSAGES_RECIPIENT_BCC = 3, /**< The 'Bcc' (blind carbon copy) recipient */
+ MESSAGES_RECIPIENT_TO = 1, /**< The 'To' recipient */
+ MESSAGES_RECIPIENT_CC = 2, /**< The 'Cc' (carbon copy) recipient */
+ MESSAGES_RECIPIENT_BCC = 3, /**< The 'Bcc' (blind carbon copy) recipient */
} messages_recipient_type_e;
/**
- * @brief The result of sending a message.
+ * @brief Enumeration for the result of sending a message.
*/
typedef enum {
- MESSAGES_SENDING_FAILED = -1, /**< Message sending is failed */
- MESSAGES_SENDING_SUCCEEDED = 0, /**< Message sending is succeeded */
+ MESSAGES_SENDING_FAILED = -1, /**< Message sending failed */
+ MESSAGES_SENDING_SUCCEEDED = 0, /**< Message sending succeeded */
} messages_sending_result_e;
/**
- * @brief Called when the process of sending a message to all recipients finishes.
+ * @brief Enumeration for the SIM index of a message.
+ */
+typedef enum {
+ MESSAGES_SIM_INDEX_UNKNOWN = 0, /**< Unknown SIM Index*/
+ MESSAGES_SIM_INDEX_1 = 1, /**< SIM Index 1 */
+ MESSAGES_SIM_INDEX_2 = 2, /**< SIM Index 2 */
+} messages_sim_index_e;
+
+/**
+ * @brief Called when the process of sending a message to all recipients finishes.
*
- * @param[in] result The result of message sending.
- * @param[in] user_data The user data passed from the callback registration function
+ * @param[in] result The result of message sending
+ * @param[in] user_data The user data passed from the callback registration function
*
- * @pre messages_send_message() will invoke this callback if you register this callback using messages_set_message_sent_cb().
+ * @pre messages_send_message() will invoke this callback function.
*
- * @see messages_set_message_sent_cb()
- * @see messages_unset_message_sent_cb()
* @see messages_send_message()
*/
typedef void (* messages_sent_cb)(messages_sending_result_e result, void *user_data);
@@ -112,8 +119,8 @@ typedef void (* messages_sent_cb)(messages_sending_result_e result, void *user_d
/**
* @brief Called when an incoming message is received.
*
- * @param[in] incoming_msg An incoming message
- * @param[in] user_data The user data passed from the callback registration function
+ * @param[in] incoming_msg The incoming message
+ * @param[in] user_data The user data passed from the callback registration function
*
* @pre You register this callback using messages_set_message_incoming_cb() for getting an incoming message.
*
@@ -126,18 +133,20 @@ typedef void (* messages_incoming_cb)(messages_message_h incoming_msg, void *use
/**
* @brief Called when a message is retrieved from a search request.
*
- * @remark You should not call messages_destroy_message() with @a msg.
+ * @remarks You should not call messages_destroy_message() with @a msg.
*
- * @param[in] msg The message handle (It can be NULL if nothing is found)
- * @param[in] user_data The user data passed from the foreach function
- * @param[in] index The index of a message from the messages that have been retrieved as a search result
- * @param[in] result_count The count of the messages that have been retrieved as a result applying @a limit and @a offset.\n
- * If the search has a @a limit, then this value is always equal or less than the limit.
- * @param[in] total_count The count of the messages that have been retrieved as a result without applying @a limit and @a offset. \n
- * The value can be used to calculate the total number of page views for the searched meessages.\n
- * For example, if the count of message search is 50 and the limit is 20, then using this value, you can notice the total page is 3.
+ * @param[in] msg The message handle \n
+ * It can be @c NULL if nothing is found.
+ * @param[in] user_data The user data passed from the foreach function
+ * @param[in] index The index of a message from the messages that have been retrieved as a search result
+ * @param[in] result_count The count of the messages that have been retrieved as a result applying @a limit and @a offset \n
+ * If the search has a @a limit, then this value is always equal or less than the limit.
+ * @param[in] total_count The count of the messages that have been retrieved as a result without applying @a limit and @a offset \n
+ * The value can be used to calculate the total number of page views for the searched messages. \n
+ * For example, if the count of message search is @c 50 and the limit is @c 20, then using this value, you can notice the total page is @c 3.
*
- * @return @c true to continue with the next iteration of the loop or return @c false to break out of the loop.
+ * @return @c true to continue with the next iteration of the loop,
+ * otherwise return @c false to break out of the loop
*
* @pre messages_foreach_message() will invoke this callback function.
*
@@ -150,14 +159,15 @@ typedef bool (* messages_search_cb)(messages_message_h msg, int index, int resul
* @addtogroup CAPI_MESSAGING_MESSAGES_PUSH_MODULE
* @{
*/
-
+
/**
* @brief Called when an incoming push message is received.
*
- * @param[in] header The header of the push message
- * @param[in] body The body of the push message. (It's not a null-terminated string)
+ * @param[in] header The header of the push message
+ * @param[in] body The body of the push message \n
+ * It is not a null-terminated string.
* @param[in] body_length The length of @a body
- * @param[in] user_data The user data to be passed to the callback function
+ * @param[in] user_data The user data to be passed to the callback function
*
* @pre You register this callback using messages_push_set_incoming_cb() for getting an incoming message.
*
@@ -172,69 +182,6 @@ typedef void (* messages_push_incoming_cb)(const char *header, const char *body,
/**
- * @addtogroup CAPI_MESSAGING_MESSAGES_CB_MODULE
- * @{
- */
-
-/**
- * @brief The CB Message handle.
- */
-typedef struct messages_cb_message_s *messages_cb_message_h;
-
-/**
- * @brief The CB Settings handle.
- */
-typedef struct messages_cb_settings_s *messages_cb_settings_h;
-
- /**
- * @brief The CB Channel handle.
- */
-typedef struct messages_cb_channel_s *messages_cb_channel_h;
-
-/**
- * @brief Called when an incoming cb message is received.
- *
- * @param[in] msg The incoming CB message handle. \n
- This handle will be destroyed when exiting this callback function automatically.
- * @param[in] user_data The user data to be passed to the callback function
- *
- * @pre You register this callback using messages_cb_set_incoming_cb() for getting an incoming message.
- *
- * @see messages_cb_set_incoming_cb()
- * @see messages_cb_unset_incoming_cb()
- */
-typedef void (* messages_cb_incoming_cb)(messages_cb_message_h msg, void *user_data);
-
-
-/**
- * @brief Called when an incoming ETWS primary notification message is received.
- *
- * @details The ETWS primary notification message doesn't have text contents, but two parameters about ETWS are provided more. \n
- *
- * @remark The @a etws_security_info is 50 bytes binary data.
- *
- * @param[in] msg The incoming CB message handle. \n
- This handle will be destroyed when exiting this callback function automatically.
- * @param[in] etws_warning_type The ETWS warning type
- * @param[in] etws_security_info The ETWS security info (50 bytes binary data)
- * @param[in] user_data The user data to be passed to the callback function
- *
- * @pre You register this callback using messages_cb_set_incoming_cb() for getting an incoming message.
- *
- * @see messages_cb_set_etws_primary_noti_cb()
- * @see messages_cb_unset_etws_primary_noti_cb()
- */
-typedef void (* messages_cb_etws_primary_noti_cb)(messages_cb_message_h msg,
- int etws_warning_type, const char *etws_security_info, void *user_data);
-
-
-/**
- * @}
- */
-
-
-
-/**
* @}
*/
diff --git a/packaging/capi-messaging-messages.spec b/packaging/capi-messaging-messages.spec
index 03be959..f13c158 100644
--- a/packaging/capi-messaging-messages.spec
+++ b/packaging/capi-messaging-messages.spec
@@ -1,15 +1,17 @@
Name: capi-messaging-messages
Summary: A SMS/MMS library in Tizen Native API
-Version: 0.1.25
+Version: 0.1.28
Release: 1
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
-BuildRequires: cmake
-BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(msg-service)
-BuildRequires: pkgconfig(capi-base-common)
-BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: cmake
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(msg-service)
+BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: pkgconfig(privacy-manager-client)
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
@@ -34,12 +36,13 @@ Requires: pkgconfig(capi-base-common)
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
rm -fr cmake_build_tmp; mkdir cmake_build_tmp
cd cmake_build_tmp
-%cmake .. -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
make %{?jobs:-j%jobs}
%install
+rm -rf %{buildroot}
mkdir -p %{buildroot}/usr/share/license
cp LICENSE %{buildroot}/usr/share/license/%{name}
@@ -60,3 +63,5 @@ cd cmake_build_tmp
%{_includedir}/messaging/*.h
%{_libdir}/pkgconfig/*.pc
%{_libdir}/libcapi-messaging-messages.so
+
+
diff --git a/src/messages.c b/src/messages.c
index 061f528..0222522 100644
--- a/src/messages.c
+++ b/src/messages.c
@@ -32,6 +32,8 @@
#include <messages_types.h>
#include <messages_private.h>
+#include <privacy_checker_client.h>
+
#ifdef LOG_TAG
#undef LOG_TAG
#endif
@@ -47,11 +49,12 @@ int _messages_load_mms_data(messages_message_s *msg, msg_handle_t handle);
int _messages_save_textfile(const char *text, char **filepath);
int _messages_load_textfile(const char *filepath, char **text);
void _messages_sent_mediator_cb(msg_handle_t handle, msg_struct_t pStatus, void *user_param);
-
-
+int _messages_check_feature(char *feature_name);
int messages_open_service(messages_service_h *svc)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
messages_service_s *_svc;
@@ -69,11 +72,6 @@ int messages_open_service(messages_service_h *svc)
_svc->incoming_cb = NULL;
_svc->incoming_cb_enabled = false;
_svc->push_incoming_cb_list = NULL;
- _svc->cbs_enabled_cb = false;
- _svc->cbs_incoming_cb = NULL;
- _svc->cbs_incoming_cb_save = false;
- _svc->etws_incoming_cb = NULL;
- _svc->cbs_settings_h = NULL;
ret = msg_open_msg_handle(&_svc->service_h);
if (MSG_SUCCESS != ret) {
@@ -104,10 +102,11 @@ void _free_push_incoming_cb(messages_push_incoming_callback_s *cb)
int messages_close_service(messages_service_h svc)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
messages_service_s *_svc = (messages_service_s *)svc;
- messages_cb_settings_s *_settings;
CHECK_NULL(_svc);
ret = msg_close_msg_handle(&_svc->service_h);
@@ -124,13 +123,6 @@ int messages_close_service(messages_service_h svc)
_svc->push_incoming_cb_list = NULL;
}
- if (_svc->cbs_settings_h) {
- _settings = (messages_cb_settings_s *)_svc->cbs_settings_h;
- _messages_cb_clear_settings(_settings);
- free(_settings);
- _svc->cbs_settings_h = NULL;
- }
-
free(svc);
return ERROR_CONVERT(ret);
@@ -138,6 +130,8 @@ int messages_close_service(messages_service_h svc)
int messages_create_message(messages_message_type_e type, messages_message_h *msg)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
messages_message_s *_msg = NULL;
@@ -175,6 +169,13 @@ int messages_create_message(messages_message_type_e type, messages_message_h *ms
}
else if (MESSAGES_TYPE_MMS == type)
{
+ ret = _messages_check_feature(MESSAGES_TELEPHONY_MMS_FEATURE);
+ if (MESSAGES_ERROR_NONE != ret) {
+ msg_release_struct(&_msg->msg_h);
+ free(_msg);
+ return ret;
+ }
+
ret = ERROR_CONVERT(msg_set_int_value(_msg->msg_h, MSG_MESSAGE_TYPE_INT, MSG_TYPE_MMS));
if (MESSAGES_ERROR_NONE != ret)
{
@@ -199,6 +200,8 @@ int messages_create_message(messages_message_type_e type, messages_message_h *ms
int messages_destroy_message(messages_message_h msg)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
messages_message_s *_msg = (messages_message_s*)msg;
@@ -221,6 +224,8 @@ int messages_destroy_message(messages_message_h msg)
int messages_get_message_type(messages_message_h msg, messages_message_type_e *type)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int msgType;
int ret;
@@ -268,10 +273,11 @@ int messages_get_message_type(messages_message_h msg, messages_message_type_e *t
int messages_add_address(messages_message_h msg, const char *address, messages_recipient_type_e type)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
messages_message_type_e msgType;
- msg_struct_list_s *addr_list = NULL;
msg_struct_t addr_info;
messages_message_s *_msg = (messages_message_s*)msg;
@@ -282,13 +288,11 @@ int messages_add_address(messages_message_h msg, const char *address, messages_r
messages_get_message_type(msg, &msgType);
- ret = msg_get_list_handle(_msg->msg_h, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list);
+ ret = msg_list_add_item(_msg->msg_h, MSG_MESSAGE_ADDR_LIST_HND, &addr_info);
if (MSG_SUCCESS != ret) {
return ERROR_CONVERT(ret);
}
- addr_info = addr_list->msg_struct_info[addr_list->nCount];
-
if (IS_SMS(msgType))
{
msg_set_int_value(addr_info, MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, MSG_RECIPIENTS_TYPE_TO);
@@ -317,15 +321,15 @@ int messages_add_address(messages_message_h msg, const char *address, messages_r
return ERROR_CONVERT(ret);
}
- addr_list->nCount++;
-
return MESSAGES_ERROR_NONE;
}
int messages_get_address_count(messages_message_h msg, int *count)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
- msg_struct_list_s *addr_list = NULL;
+ msg_list_handle_t addr_list = NULL;
messages_message_s *_msg = (messages_message_s*)msg;
@@ -333,23 +337,26 @@ int messages_get_address_count(messages_message_h msg, int *count)
CHECK_NULL(_msg->msg_h);
CHECK_NULL(count);
- ret = msg_get_list_handle(_msg->msg_h, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list);
+ ret = msg_get_list_handle(_msg->msg_h, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list);
if (MSG_SUCCESS != ret) {
return ERROR_CONVERT(ret);
}
- *count = addr_list->nCount;
+ *count = msg_list_length(addr_list);
return MESSAGES_ERROR_NONE;
}
int messages_get_address(messages_message_h msg, int index, char **address, messages_recipient_type_e *type)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
char _address[MAX_ADDRESS_VAL_LEN] = {0, };
int _type;
+ int count;
- msg_struct_list_s *addr_list = NULL;
+ msg_list_handle_t addr_list = NULL;
msg_struct_t addr_info;
messages_message_s *_msg = (messages_message_s*)msg;
@@ -358,19 +365,20 @@ int messages_get_address(messages_message_h msg, int index, char **address, mess
CHECK_NULL(_msg->msg_h);
CHECK_NULL(address);
- ret = msg_get_list_handle(_msg->msg_h, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list);
+ ret = msg_get_list_handle(_msg->msg_h, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list);
if (MSG_SUCCESS != ret) {
return ERROR_CONVERT(ret);
}
- if (index > addr_list->nCount)
+ count = msg_list_length(addr_list);
+ if (index > count)
{
LOGE("[%s] INVALID_PARAMETER(0x%08x) : index(%d) > addr_list->nCount(%d) "
- , __FUNCTION__, MESSAGES_ERROR_INVALID_PARAMETER, index, addr_list->nCount);
+ , __FUNCTION__, MESSAGES_ERROR_INVALID_PARAMETER, index, count);
return MESSAGES_ERROR_INVALID_PARAMETER;
}
- addr_info = addr_list->msg_struct_info[index];
+ addr_info = (msg_struct_t)msg_list_nth_data(addr_list, index);
ret = msg_get_str_value(addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, _address, MAX_ADDRESS_VAL_LEN);
if (MSG_SUCCESS != ret)
@@ -419,19 +427,15 @@ int messages_get_address(messages_message_h msg, int index, char **address, mess
int messages_remove_all_addresses(messages_message_h msg)
{
- int ret;
- msg_struct_list_s *addr_list = NULL;
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+ int ret;
messages_message_s *_msg = (messages_message_s*)msg;
CHECK_NULL(_msg);
CHECK_NULL(_msg->msg_h);
- ret = msg_get_list_handle(_msg->msg_h, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list);
- if (MSG_SUCCESS == ret)
- {
- addr_list->nCount = 0;
- }
+ ret = msg_list_clear(_msg->msg_h, MSG_MESSAGE_ADDR_LIST_HND);
return ERROR_CONVERT(ret);
}
@@ -444,6 +448,14 @@ void _dump_message(messages_message_h msg)
int messages_send_message(messages_service_h svc, messages_message_h msg, bool save_to_sentbox,
messages_sent_cb callback, void *user_data)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
+ /* Privacy check */
+ int privacy_ret = privacy_checker_check_by_privilege(MESSAGES_PRIVILEGE_WRITE);
+ if (privacy_ret == PRIV_MGR_ERROR_USER_NOT_CONSENTED) {
+ return MESSAGES_ERROR_PERMISSION_DENIED;
+ }
+
int ret;
int reqId;
msg_struct_t req;
@@ -481,6 +493,12 @@ int messages_send_message(messages_service_h svc, messages_message_h msg, bool s
}
else if (IS_MMS(msgType))
{
+ ret = _messages_check_feature(MESSAGES_TELEPHONY_MMS_FEATURE);
+ if (MESSAGES_ERROR_NONE != ret) {
+ msg_release_struct(&sendOpt);
+ return ret;
+ }
+
ret = _messages_save_mms_data(_msg);
if (MESSAGES_ERROR_NONE == ret)
{
@@ -508,9 +526,9 @@ int messages_send_message(messages_service_h svc, messages_message_h msg, bool s
else
{
LOGE("[%s] INVALID_PARAMETER(0x%08x) : Invalid Message Type.",
- __FUNCTION__, TIZEN_ERROR_INVALID_PARAMETER);
+ __FUNCTION__, MESSAGES_ERROR_INVALID_PARAMETER);
msg_release_struct(&sendOpt);
- return TIZEN_ERROR_INVALID_PARAMETER;
+ return MESSAGES_ERROR_INVALID_PARAMETER;
}
msg_release_struct(&sendOpt);
@@ -534,6 +552,8 @@ int messages_get_message_count(messages_service_h service,
messages_message_box_e mbox, messages_message_type_e type,
int *count)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
msg_folder_id_t folderId;
msg_struct_t countInfo = NULL;
@@ -604,11 +624,13 @@ int messages_search_message(messages_service_h service,
int offset, int limit,
messages_message_h **message_array, int *length, int *total)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int i;
int ret;
msg_struct_list_s msg_list;
- msg_struct_t searchCon;
+ msg_struct_t listCond;
messages_message_type_e _msgType;
messages_service_s *_svc = (messages_service_s*)service;
@@ -620,26 +642,31 @@ int messages_search_message(messages_service_h service,
CHECK_NULL(message_array);
// Set Condition
- searchCon = msg_create_struct(MSG_STRUCT_SEARCH_CONDITION);
- msg_set_int_value(searchCon, MSG_SEARCH_CONDITION_FOLDERID_INT, _messages_convert_mbox_to_fw(mbox));
- msg_set_int_value(searchCon, MSG_SEARCH_CONDITION_MSGTYPE_INT, _messages_convert_msgtype_to_fw(type));
+ listCond = msg_create_struct(MSG_STRUCT_MSG_LIST_CONDITION);
+
+ msg_set_int_value(listCond, MSG_LIST_CONDITION_FOLDER_ID_INT, _messages_convert_mbox_to_fw(mbox));
+ msg_set_int_value(listCond, MSG_LIST_CONDITION_MSGTYPE_INT, _messages_convert_msgtype_to_fw(type));
+
if (NULL != keyword)
{
- msg_set_str_value(searchCon, MSG_SEARCH_CONDITION_SEARCH_VALUE_STR, strdup(keyword), strlen(keyword));
+ msg_set_str_value(listCond, MSG_LIST_CONDITION_TEXT_VALUE_STR, strdup(keyword), strlen(keyword));
}
if (NULL != address)
{
- msg_set_str_value(searchCon, MSG_SEARCH_CONDITION_ADDRESS_VALUE_STR, strdup(address), strlen(address));
+ msg_set_str_value(listCond, MSG_LIST_CONDITION_ADDRESS_VALUE_STR, strdup(address), strlen(address));
}
// Search
- ret = msg_search_message(_svc->service_h, searchCon, offset, limit, &msg_list);
+ msg_set_bool_value(listCond, MSG_LIST_CONDITION_AND_OPERATER_BOOL, true);
+ msg_set_int_value(listCond, MSG_LIST_CONDITION_OFFSET_INT, offset);
+ msg_set_int_value(listCond, MSG_LIST_CONDITION_LIMIT_INT, limit);
+ ret = msg_get_message_list2(_svc->service_h, listCond, &msg_list);
if (MSG_SUCCESS != ret)
{
- msg_release_struct(&searchCon);
+ msg_release_struct(&listCond);
return ERROR_CONVERT(ret);
}
- msg_release_struct(&searchCon);
+ msg_release_struct(&listCond);
// Result
_array = (messages_message_h*)calloc(msg_list.nCount + 1, sizeof(messages_message_h));
@@ -696,6 +723,8 @@ int messages_search_message(messages_service_h service,
int messages_free_message_array(messages_message_h *message_array)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
int i=0;
@@ -726,6 +755,14 @@ int messages_foreach_message(messages_service_h svc,
int offset, int limit,
messages_search_cb callback, void *user_data)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
+ /* Privacy check */
+ int privacy_ret = privacy_checker_check_by_privilege(MESSAGES_PRIVILEGE_READ);
+ if (privacy_ret == PRIV_MGR_ERROR_USER_NOT_CONSENTED) {
+ return MESSAGES_ERROR_PERMISSION_DENIED;
+ }
+
int i;
int ret;
bool ret_cb;
@@ -819,17 +856,25 @@ void _messages_incoming_mediator_cb(msg_handle_t handle, msg_struct_t msg, void
if (IS_MMS(msgType))
{
+ if (MESSAGES_ERROR_NONE != _messages_check_feature(MESSAGES_TELEPHONY_MMS_FEATURE)) {
+ free(_msg);
+ return;
+ }
+
_messages_load_mms_data(_msg, handle);
}
((messages_incoming_cb)_svc->incoming_cb)((messages_message_h)_msg, _svc->incoming_cb_user_data);
+ messages_mms_remove_all_attachments((messages_message_h)_msg);
free(_msg);
}
}
int messages_set_message_incoming_cb(messages_service_h svc, messages_incoming_cb callback, void *user_data)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
messages_service_s *_svc = (messages_service_s*)svc;
@@ -865,6 +910,8 @@ int messages_set_message_incoming_cb(messages_service_h svc, messages_incoming_c
int messages_add_sms_listening_port(messages_service_h service, int port)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
messages_service_s *_svc = (messages_service_s*)service;
CHECK_NULL(_svc);
@@ -888,6 +935,8 @@ int messages_add_sms_listening_port(messages_service_h service, int port)
int messages_unset_message_incoming_cb(messages_service_h svc)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
messages_service_s *_svc = (messages_service_s*)svc;
CHECK_NULL(_svc);
@@ -899,6 +948,8 @@ int messages_unset_message_incoming_cb(messages_service_h svc)
int messages_get_message_port(messages_message_h msg, int *port)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
int _port;
@@ -920,6 +971,8 @@ int messages_get_message_port(messages_message_h msg, int *port)
int messages_set_text(messages_message_h msg, const char *text)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
int len;
messages_message_type_e type;
@@ -947,6 +1000,8 @@ int messages_set_text(messages_message_h msg, const char *text)
}
else if (IS_MMS(type))
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_MMS_FEATURE);
+
if (NULL != _msg->text)
{
free(_msg->text);
@@ -974,6 +1029,8 @@ int messages_set_text(messages_message_h msg, const char *text)
int messages_get_text(messages_message_h msg, char **text)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
char _text[MAX_MSG_TEXT_LEN];
messages_message_type_e type;
@@ -1037,6 +1094,8 @@ int messages_get_text(messages_message_h msg, char **text)
int messages_get_time(messages_message_h msg, time_t *time)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
int _time;
@@ -1058,6 +1117,8 @@ int messages_get_time(messages_message_h msg, time_t *time)
int messages_get_message_id(messages_message_h msg, int *msg_id)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
int _id;
@@ -1077,8 +1138,55 @@ int messages_get_message_id(messages_message_h msg, int *msg_id)
return MESSAGES_ERROR_NONE;
}
+
+int messages_set_sim_id(messages_message_h msg, int sim_id)
+{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
+ int ret;
+
+ messages_message_s *_msg = (messages_message_s*)msg;
+ CHECK_NULL(_msg);
+ CHECK_NULL(_msg->msg_h);
+
+ ret = msg_set_int_value(_msg->msg_h, MSG_MESSAGE_SIM_INDEX_INT, sim_id);
+ if (MSG_SUCCESS != ret)
+ {
+ return ERROR_CONVERT(ret);
+ }
+
+ return MESSAGES_ERROR_NONE;
+}
+
+
+int messages_get_sim_id(messages_message_h msg, int *sim_id)
+{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
+ int ret;
+ int _id;
+
+ messages_message_s *_msg = (messages_message_s*)msg;
+ CHECK_NULL(_msg);
+ CHECK_NULL(_msg->msg_h);
+ CHECK_NULL(sim_id);
+
+ ret = msg_get_int_value(_msg->msg_h, MSG_MESSAGE_SIM_INDEX_INT, &_id);
+ if (MSG_SUCCESS != ret)
+ {
+ return ERROR_CONVERT(ret);
+ }
+
+ *sim_id = _id;
+
+ return MESSAGES_ERROR_NONE;
+}
+
+
int messages_search_message_by_id(messages_service_h service, int msg_id, messages_message_h *msg)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
msg_struct_t new_msg_h;
messages_message_type_e _msgType;
@@ -1119,6 +1227,13 @@ int messages_search_message_by_id(messages_service_h service, int msg_id, messag
messages_get_message_type((messages_message_h)_msg, &_msgType);
if (IS_MMS(_msgType))
{
+ ret = _messages_check_feature(MESSAGES_TELEPHONY_MMS_FEATURE);
+ if (MESSAGES_ERROR_NONE != ret) {
+ free(_msg);
+ msg_release_struct(&new_msg_h);
+ return ret;
+ }
+
ret = _messages_load_mms_data(_msg, _svc->service_h);
if (MESSAGES_ERROR_NONE != ret) {
free(_msg);
@@ -1134,6 +1249,8 @@ int messages_search_message_by_id(messages_service_h service, int msg_id, messag
int messages_get_mbox_type(messages_message_h msg, messages_message_box_e *mbox)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
int folder_id;
@@ -1174,6 +1291,8 @@ int messages_get_mbox_type(messages_message_h msg, messages_message_box_e *mbox)
int messages_mms_set_subject(messages_message_h msg, const char *subject)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_MMS_FEATURE);
+
int ret;
messages_message_type_e type;
@@ -1201,6 +1320,8 @@ int messages_mms_set_subject(messages_message_h msg, const char *subject)
int messages_mms_get_subject(messages_message_h msg, char **subject)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_MMS_FEATURE);
+
int ret;
char _subject[MAX_SUBJECT_LEN];
messages_message_type_e type;
@@ -1244,10 +1365,13 @@ int messages_mms_get_subject(messages_message_h msg, char **subject)
int messages_mms_add_attachment(messages_message_h msg, messages_media_type_e type, const char *path)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_MMS_FEATURE);
+
messages_message_type_e msg_type;
messages_message_s *_msg = (messages_message_s*)msg;
messages_attachment_s *attach;
+ int input_file_name_length;
CHECK_NULL(_msg);
CHECK_NULL(_msg->msg_h);
@@ -1262,6 +1386,15 @@ int messages_mms_add_attachment(messages_message_h msg, messages_media_type_e ty
return MESSAGES_ERROR_INVALID_PARAMETER;
}
+ //CID 350148: Putting a check so that input buffer does not exceed max_size which will cause seg fault.
+ //CID 358513: Also putting this check before calloc of var attach to prevent memory leak in case of error.
+ input_file_name_length = strlen(path);
+ if(input_file_name_length > MSG_FILEPATH_LEN_MAX) {
+ LOGE("[%s] INVALID_PARAMETER(0x%08x) : maximum length of file_name_path can be %d"
+ , __FUNCTION__, MESSAGES_ERROR_INVALID_PARAMETER, MSG_FILEPATH_LEN_MAX);
+ return MESSAGES_ERROR_INVALID_PARAMETER;
+ }
+
// New Attach
attach = (messages_attachment_s *)calloc(1, sizeof(messages_attachment_s));
if (NULL == attach)
@@ -1272,7 +1405,8 @@ int messages_mms_add_attachment(messages_message_h msg, messages_media_type_e ty
}
attach->media_type = type;
- strncpy(attach->filepath, path, strlen(path));
+
+ strncpy(attach->filepath, path, input_file_name_length);
// Append
_msg->attachment_list = g_slist_append(_msg->attachment_list, attach);
@@ -1282,6 +1416,8 @@ int messages_mms_add_attachment(messages_message_h msg, messages_media_type_e ty
int messages_mms_get_attachment_count(messages_message_h msg, int *count)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_MMS_FEATURE);
+
messages_message_type_e type;
messages_message_s *_msg = (messages_message_s*)msg;
@@ -1307,6 +1443,8 @@ int messages_mms_get_attachment_count(messages_message_h msg, int *count)
int messages_mms_get_attachment(messages_message_h msg, int index, messages_media_type_e *type, char **path)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_MMS_FEATURE);
+
messages_attachment_s *_attach;
messages_message_type_e msg_type;
@@ -1348,6 +1486,8 @@ int messages_mms_get_attachment(messages_message_h msg, int index, messages_medi
int messages_mms_remove_all_attachments(messages_message_h msg)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_MMS_FEATURE);
+
messages_message_s *_msg = (messages_message_s*)msg;
CHECK_NULL(_msg);
@@ -1430,7 +1570,7 @@ int _messages_save_mms_data(messages_message_s *msg)
if (NULL == image)
{
- msg_mms_add_item(mms_data, MSG_STRUCT_MMS_REGION, &region);
+ msg_list_add_item(mms_data, MSG_STRUCT_MMS_REGION, &region);
msg_set_str_value(region, MSG_MMS_REGION_ID_STR, (char *)"Text", 4);
msg_set_int_value(region, MSG_MMS_REGION_LENGTH_LEFT_INT, 0);
msg_set_int_value(region, MSG_MMS_REGION_LENGTH_TOP_INT, 0);
@@ -1440,7 +1580,7 @@ int _messages_save_mms_data(messages_message_s *msg)
}
else if (NULL == msg->text)
{
- msg_mms_add_item(mms_data, MSG_STRUCT_MMS_REGION, &region);
+ msg_list_add_item(mms_data, MSG_STRUCT_MMS_REGION, &region);
msg_set_str_value(region, MSG_MMS_REGION_ID_STR, (char *)"Image", 5);
msg_set_int_value(region, MSG_MMS_REGION_LENGTH_LEFT_INT, 0);
msg_set_int_value(region, MSG_MMS_REGION_LENGTH_TOP_INT, 0);
@@ -1450,7 +1590,7 @@ int _messages_save_mms_data(messages_message_s *msg)
}
else
{
- msg_mms_add_item(mms_data, MSG_STRUCT_MMS_REGION, &region);
+ msg_list_add_item(mms_data, MSG_STRUCT_MMS_REGION, &region);
msg_set_str_value(region, MSG_MMS_REGION_ID_STR, (char *)"Image", 5);
msg_set_int_value(region, MSG_MMS_REGION_LENGTH_LEFT_INT, 0);
msg_set_int_value(region, MSG_MMS_REGION_LENGTH_TOP_INT, 0);
@@ -1458,7 +1598,7 @@ int _messages_save_mms_data(messages_message_s *msg)
msg_set_int_value(region, MSG_MMS_REGION_LENGTH_HEIGHT_INT, 50);
msg_set_int_value(region, MSG_MMS_REGION_BGCOLOR_INT, 0xffffff);
- msg_mms_add_item(mms_data, MSG_STRUCT_MMS_REGION, &region);
+ msg_list_add_item(mms_data, MSG_STRUCT_MMS_REGION, &region);
msg_set_str_value(region, MSG_MMS_REGION_ID_STR, (char *)"Text", 4);
msg_set_int_value(region, MSG_MMS_REGION_LENGTH_LEFT_INT, 0);
msg_set_int_value(region, MSG_MMS_REGION_LENGTH_TOP_INT, 50);
@@ -1468,21 +1608,21 @@ int _messages_save_mms_data(messages_message_s *msg)
}
// Add Media
- msg_mms_add_item(mms_data, MSG_STRUCT_MMS_PAGE, &page);
+ msg_list_add_item(mms_data, MSG_STRUCT_MMS_PAGE, &page);
msg_set_int_value(page, MSG_MMS_PAGE_PAGE_DURATION_INT, 5440);
if (NULL != image)
{
if (MESSAGES_MEDIA_IMAGE == image->media_type)
{
- msg_mms_add_item(page, MSG_STRUCT_MMS_MEDIA, &media);
+ msg_list_add_item(page, MSG_STRUCT_MMS_MEDIA, &media);
msg_set_int_value(media, MSG_MMS_MEDIA_TYPE_INT, MMS_SMIL_MEDIA_IMG);
msg_set_str_value(media, MSG_MMS_MEDIA_REGION_ID_STR, (char *)"Image", 5);
msg_set_str_value(media, MSG_MMS_MEDIA_FILEPATH_STR, (char *)image->filepath, MSG_FILEPATH_LEN_MAX);
}
else if (MESSAGES_MEDIA_VIDEO == image->media_type)
{
- msg_mms_add_item(page, MSG_STRUCT_MMS_MEDIA, &media);
+ msg_list_add_item(page, MSG_STRUCT_MMS_MEDIA, &media);
msg_set_int_value(media, MSG_MMS_MEDIA_TYPE_INT, MMS_SMIL_MEDIA_VIDEO);
msg_set_str_value(media, MSG_MMS_MEDIA_REGION_ID_STR, (char *)"Image", 5);
msg_set_str_value(media, MSG_MMS_MEDIA_FILEPATH_STR, (char *)image->filepath, MSG_FILEPATH_LEN_MAX);
@@ -1491,7 +1631,7 @@ int _messages_save_mms_data(messages_message_s *msg)
if (NULL != audio)
{
- msg_mms_add_item(page, MSG_STRUCT_MMS_MEDIA, &media);
+ msg_list_add_item(page, MSG_STRUCT_MMS_MEDIA, &media);
msg_set_int_value(media, MSG_MMS_MEDIA_TYPE_INT, MMS_SMIL_MEDIA_AUDIO);
msg_set_str_value(media, MSG_MMS_MEDIA_REGION_ID_STR, (char *)"Audio", 5);
msg_set_str_value(media, MSG_MMS_MEDIA_FILEPATH_STR, (char *)audio->filepath, MSG_FILEPATH_LEN_MAX);
@@ -1502,7 +1642,7 @@ int _messages_save_mms_data(messages_message_s *msg)
ret = _messages_save_textfile(msg->text, &filepath);
if (MESSAGES_ERROR_NONE == ret)
{
- msg_mms_add_item(page, MSG_STRUCT_MMS_MEDIA, &media);
+ msg_list_add_item(page, MSG_STRUCT_MMS_MEDIA, &media);
msg_set_int_value(media, MSG_MMS_MEDIA_TYPE_INT, MMS_SMIL_MEDIA_TEXT);
msg_set_str_value(media, MSG_MMS_MEDIA_REGION_ID_STR, (char *)"Text", 4);
msg_set_str_value(media, MSG_MMS_MEDIA_FILEPATH_STR, (char *)filepath, MSG_FILEPATH_LEN_MAX);
@@ -1525,7 +1665,7 @@ int _messages_save_mms_data(messages_message_s *msg)
attach = g_slist_nth_data(msg->attachment_list, i);
if (image != attach && audio != attach)
{
- msg_mms_add_item(mms_data, MSG_STRUCT_MMS_ATTACH, &mms_attach);
+ msg_list_add_item(mms_data, MSG_STRUCT_MMS_ATTACH, &mms_attach);
msg_set_str_value(mms_attach, MSG_MMS_ATTACH_FILEPATH_STR, (char *)attach->filepath, MSG_FILEPATH_LEN_MAX);
}
}
@@ -1757,7 +1897,7 @@ int _messages_load_textfile(const char *filepath, char **text)
fclose(file);
return MESSAGES_ERROR_OPERATION_FAILED;
}
-
+
if (NULL == *text)
{
@@ -1933,6 +2073,9 @@ int _messages_error_converter(int err, const char *func, int line)
func, line, MESSAGES_ERROR_NO_DATA, err);
return MESSAGES_ERROR_NO_DATA;
+ case MSG_ERR_PERMISSION_DENIED:
+ return MESSAGES_ERROR_PERMISSION_DENIED;
+
case MSG_SUCCESS:
return MESSAGES_ERROR_NONE;
@@ -1943,3 +2086,17 @@ int _messages_error_converter(int err, const char *func, int line)
}
}
+
+int _messages_check_feature(char *feature_name) {
+ bool is_supported = false;
+ if (!system_info_get_platform_bool(feature_name, &is_supported)) {
+ if (!is_supported) {
+ LOGE("[%s] feature is disabled", feature_name);
+ return MESSAGES_ERROR_NOT_SUPPORTED;
+ }
+ } else {
+ LOGE("Error - Feature getting from System Info");
+ return MESSAGES_ERROR_OPERATION_FAILED;
+ }
+ return MESSAGES_ERROR_NONE;
+}
diff --git a/src/messages_cb.c b/src/messages_cb.c
deleted file mode 100644
index 4a57ce5..0000000
--- a/src/messages_cb.c
+++ /dev/null
@@ -1,711 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <memory.h>
-
-#include <glib.h>
-
-#include <dlog.h>
-#include <msg.h>
-#include <msg_transport.h>
-#include <msg_storage.h>
-
-#include <messages.h>
-#include <messages_types.h>
-#include <messages_private.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "CAPI_MESSAGING"
-
-
-
-void _messages_cb_incoming_mediator_cb(msg_handle_t handle, msg_struct_t msg, void *user_param)
-{
- int cbType;
- int etwsWarningType;
- char etwsWarningInfo[MESSAGES_ETWS_WARNING_INFO_LEN];
-
- messages_cb_message_s *_msg = NULL;
- messages_service_s *_svc = (messages_service_s*)user_param;
-
- if (NULL == _svc) {
- LOGW("[%s:%d] _svc is NULL.", __FUNCTION__, __LINE__);
- return;
- }
-
- if (NULL == msg) {
- LOGW("[%s:%d] msg is NULL.", __FUNCTION__, __LINE__);
- return;
- }
-
- if (_svc->etws_incoming_cb || _svc->cbs_incoming_cb)
- {
-
- _msg = (messages_cb_message_s *)calloc(1, sizeof(messages_message_s));
- if (NULL == _msg)
- {
- LOGE("[%s] OUT_OF_MEMORY(0x%08x) fail to create '_msg'."
- , __FUNCTION__, MESSAGES_ERROR_OUT_OF_MEMORY);
- return;
- }
-
- _msg->cb_msg_h = msg;
-
- msg_get_int_value(msg, MSG_CB_MSG_TYPE_INT, &cbType);
-
- if (MSG_TYPE_SMS_ETWS_PRIMARY == cbType)
- {
- if (_svc->etws_incoming_cb)
- {
- msg_get_int_value(msg, MSG_CB_MSG_ETWS_WARNING_TYPE_INT, &etwsWarningType);
- msg_get_str_value(msg, MSG_CB_MSG_ETWS_WARNING_SECU_INFO_STR, etwsWarningInfo, MESSAGES_ETWS_WARNING_INFO_LEN);
-
- ((messages_cb_etws_primary_noti_cb)_svc->etws_incoming_cb)((messages_cb_message_h)_msg, etwsWarningType, etwsWarningInfo, _svc->etws_incoming_cb_user_data);
- }
- }
- else {
- if (_svc->cbs_incoming_cb)
- {
- ((messages_cb_incoming_cb)_svc->cbs_incoming_cb)((messages_cb_message_h)_msg, _svc->cbs_incoming_cb_user_data);
- }
- }
-
- free(_msg);
- }
-}
-
-
-int messages_cb_get_message_id(messages_cb_message_h msg, int *msg_id)
-{
- int ret;
-
- messages_cb_message_s *_msg = (messages_cb_message_s *)msg;
-
- CHECK_NULL(_msg);
- CHECK_NULL(_msg->cb_msg_h);
- CHECK_NULL(msg_id);
-
- ret = msg_get_int_value(_msg->cb_msg_h, MSG_CB_MSG_MSG_ID_INT, msg_id);
-
- return ERROR_CONVERT(ret);
-}
-
-int messages_cb_get_serial_number(messages_cb_message_h msg, int *serial)
-{
- int ret;
-
- messages_cb_message_s *_msg = (messages_cb_message_s *)msg;
-
- CHECK_NULL(_msg);
- CHECK_NULL(_msg->cb_msg_h);
- CHECK_NULL(serial);
-
- ret = msg_get_int_value(_msg->cb_msg_h, MSG_CB_MSG_SERIAL_NUM_INT, serial);
-
- return ERROR_CONVERT(ret);
-}
-
-int messages_cb_get_dcs(messages_cb_message_h msg, int *dcs)
-{
- int ret;
-
- messages_cb_message_s *_msg = (messages_cb_message_s *)msg;
-
- CHECK_NULL(_msg);
- CHECK_NULL(_msg->cb_msg_h);
- CHECK_NULL(dcs);
-
- ret = msg_get_int_value(_msg->cb_msg_h, MSG_CB_MSG_DCS_INT, dcs);
-
- return ERROR_CONVERT(ret);
-}
-
-int messages_cb_get_message_type(messages_cb_message_h msg, messages_message_type_e *type)
-{
- int ret;
- int msgType;
-
- messages_cb_message_s *_msg = (messages_cb_message_s *)msg;
-
- CHECK_NULL(_msg);
- CHECK_NULL(_msg->cb_msg_h);
- CHECK_NULL(type);
-
- ret = msg_get_int_value(_msg->cb_msg_h, MSG_CB_MSG_TYPE_INT, &msgType);
- if (MSG_SUCCESS != ret)
- {
- return ERROR_CONVERT(ret);
- }
-
- switch (msgType)
- {
- case MSG_TYPE_SMS_ETWS_PRIMARY:
- *type = MESSAGES_TYPE_SMS_ETWS_PRIMARY;
- break;
- case MSG_TYPE_SMS_ETWS_SECONDARY:
- *type = MESSAGES_TYPE_SMS_ETWS_SECONDARY;
- break;
- default:
- *type = MESSAGES_TYPE_SMS_CB;
- break;
- }
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_get_language_type(messages_cb_message_h msg, char **type)
-{
- int ret;
- int len;
- char *_type;
-
- messages_cb_message_s *_msg = (messages_cb_message_s *)msg;
-
- CHECK_NULL(_msg);
- CHECK_NULL(_msg->cb_msg_h);
- CHECK_NULL(type);
-
- len = 15;
-
- _type = (char*)calloc(len + 1, sizeof(char)); // Maximum 15 bytes
- if (NULL == _type)
- {
- LOGE("[%s] OUT_OF_MEMORY(0x%08x) fail to create '_type'."
- , __FUNCTION__, MESSAGES_ERROR_OUT_OF_MEMORY);
- return MESSAGES_ERROR_OUT_OF_MEMORY;
- }
- ret = msg_get_str_value(_msg->cb_msg_h, MSG_CB_MSG_LANGUAGE_TYPE_STR, _type, len);
- if (MSG_SUCCESS != ret)
- {
- free(_type);
- return ERROR_CONVERT(ret);
- }
-
- *type = _type;
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_get_text(messages_cb_message_h msg, char **text)
-{
- int ret;
-
- int txtLen;
- int msgType;
- char *_text;
-
- messages_cb_message_s *_msg = (messages_cb_message_s *)msg;
-
- CHECK_NULL(_msg);
- CHECK_NULL(_msg->cb_msg_h);
- CHECK_NULL(text);
-
- ret = msg_get_int_value(_msg->cb_msg_h, MSG_CB_MSG_TYPE_INT, &msgType);
- if (MSG_SUCCESS != ret)
- {
- return ERROR_CONVERT(ret);
- }
-
- if (MSG_TYPE_SMS_ETWS_PRIMARY == msgType)
- {
- LOGE("[%s:%d] OPERATION_FAILED(0x%08x) : The type of msg is ETWS_PRIMARY. This msg doesn't have 'text'.",
- __FUNCTION__, __LINE__, MESSAGES_ERROR_OPERATION_FAILED);
- return MESSAGES_ERROR_OPERATION_FAILED;
- }
-
- ret = msg_get_int_value(_msg->cb_msg_h, MSG_CB_MSG_CB_TEXT_LEN_INT, &txtLen);
- if (MSG_SUCCESS != ret)
- {
- return ERROR_CONVERT(ret);
- }
-
- _text = (char *)calloc(txtLen + 1, sizeof(char));
- if (NULL == _text)
- {
- LOGE("[%s] OUT_OF_MEMORY(0x%08x) fail to create '_text'."
- , __FUNCTION__, MESSAGES_ERROR_OUT_OF_MEMORY);
- return MESSAGES_ERROR_OUT_OF_MEMORY;
- }
-
- ret = msg_get_str_value(_msg->cb_msg_h, MSG_CB_MSG_CB_TEXT_STR, _text, txtLen + 1);
- if (MSG_SUCCESS != ret)
- {
- free(_text);
- return ERROR_CONVERT(ret);
- }
-
- *text = _text;
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_get_time(messages_cb_message_h msg, time_t *time)
-{
- int ret;
- int _time;
-
- messages_cb_message_s *_msg = (messages_cb_message_s *)msg;
-
- CHECK_NULL(_msg);
- CHECK_NULL(_msg->cb_msg_h);
- CHECK_NULL(time);
-
- ret = msg_get_int_value(_msg->cb_msg_h, MSG_CB_MSG_RECV_TIME_INT, &_time);
- if (MSG_SUCCESS != ret)
- {
- return ERROR_CONVERT(ret);
- }
-
- *time = (time_t)_time;
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_set_incoming_cb(messages_service_h service, bool save,
- messages_cb_incoming_cb callback, void *user_data)
-{
- int ret;
-
- messages_service_s *_svc = (messages_service_s *)service;
-
- CHECK_NULL(_svc);
- CHECK_NULL(_svc->service_h);
- CHECK_NULL(callback);
-
- if (!_svc->cbs_enabled_cb)
- {
- ret = msg_reg_cb_message_callback(_svc->service_h, _messages_cb_incoming_mediator_cb, save, (void*)_svc);
- if (MSG_SUCCESS != ret)
- {
- return ERROR_CONVERT(ret);
- }
- _svc->cbs_enabled_cb = true;
- }
-
- _svc->cbs_incoming_cb = (void*)callback;
- _svc->cbs_incoming_cb_user_data = (void*)user_data;
- _svc->cbs_incoming_cb_save = save;
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_unset_incoming_cb(messages_service_h service)
-{
- messages_service_s *_svc = (messages_service_s *)service;
-
- CHECK_NULL(_svc);
-
- _svc->cbs_incoming_cb = NULL;
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_set_etws_primary_noti_cb(messages_service_h service,
- messages_cb_etws_primary_noti_cb callback, void *user_data)
-{
- int ret;
-
- messages_service_s *_svc = (messages_service_s *)service;
-
- CHECK_NULL(_svc);
- CHECK_NULL(_svc->service_h);
- CHECK_NULL(callback);
-
- if (!_svc->cbs_enabled_cb)
- {
- ret = msg_reg_cb_message_callback(_svc->service_h, _messages_cb_incoming_mediator_cb, _svc->cbs_incoming_cb_save, (void*)_svc);
- if (MSG_SUCCESS != ret)
- {
- return ERROR_CONVERT(ret);
- }
- _svc->cbs_enabled_cb = true;
- }
-
- _svc->etws_incoming_cb = (void*)callback;
- _svc->etws_incoming_cb_user_data = (void*)user_data;
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_unset_etws_primary_noti_cb(messages_service_h service)
-{
- messages_service_s *_svc = (messages_service_s *)service;
-
- CHECK_NULL(_svc);
-
- _svc->etws_incoming_cb = NULL;
-
- return MESSAGES_ERROR_NONE;
-}
-
-int _messages_cb_clear_settings(messages_cb_settings_s *settings)
-{
- CHECK_NULL(settings);
- CHECK_NULL(settings->_struct);
-
- msg_release_struct(&settings->_struct);
-
- if (settings->channel_list)
- {
- g_slist_foreach(settings->channel_list, (GFunc)g_free, NULL);
- g_slist_free(settings->channel_list);
- settings->channel_list = NULL;
- }
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_load_settings(messages_service_h service, messages_cb_settings_h *settings)
-{
- int i;
- int ret;
-
- messages_service_s *_svc = (messages_service_s *)service;
- messages_cb_settings_s * _settings;
-
- msg_struct_list_s *channels = NULL;
-
- messages_cb_channel_s *_ch;
-
- CHECK_NULL(_svc);
- CHECK_NULL(_svc->service_h);
- CHECK_NULL(settings);
-
- // Allocate Settings
- _settings = (messages_cb_settings_s *)calloc(1, sizeof(messages_cb_settings_s));
- if (NULL == _settings)
- {
- LOGE("[%s] OUT_OF_MEMORY(0x%08x) fail to create a '_settings'."
- , __FUNCTION__, MESSAGES_ERROR_OUT_OF_MEMORY);
- return MESSAGES_ERROR_OUT_OF_MEMORY;
- }
-
- // Load Settings
- _settings->_struct = msg_create_struct(MSG_STRUCT_SETTING_CB_OPT);
- ret = msg_get_cb_opt(_svc->service_h, _settings->_struct);
- if (MSG_SUCCESS != ret)
- {
- msg_release_struct(&_settings->_struct);
- free(_settings);
- return ERROR_CONVERT(ret);
- }
-
- // Load Channel List
- msg_get_list_handle(_settings->_struct, MSG_CB_CHANNEL_LIST_STRUCT, (void **)&channels);
- for (i=0; i < channels->nCount; i++)
- {
- _ch = (messages_cb_channel_s *)calloc(1, sizeof(messages_cb_channel_s));
- if (NULL == _ch)
- {
- LOGE("[%s] OUT_OF_MEMORY(0x%08x) fail to create '_ch'."
- , __FUNCTION__, MESSAGES_ERROR_OUT_OF_MEMORY);
- _messages_cb_clear_settings(_settings);
- free(_settings);
- return MESSAGES_ERROR_OUT_OF_MEMORY;
- }
-
- msg_get_bool_value(channels->msg_struct_info[i], MSG_CB_CHANNEL_ACTIVATE_BOOL, &_ch->activated);
- msg_get_int_value(channels->msg_struct_info[i], MSG_CB_CHANNEL_ID_FROM_INT, &_ch->from_id);
- msg_get_int_value(channels->msg_struct_info[i], MSG_CB_CHANNEL_ID_TO_INT, &_ch->to_id);
- msg_get_str_value(channels->msg_struct_info[i], MSG_CB_CHANNEL_NAME_STR, _ch->name, CB_CHANNEL_NAME_MAX);
-
- _settings->channel_list = g_slist_append(_settings->channel_list, (messages_cb_channel_h)_ch);
- }
-
- if (NULL != _svc->cbs_settings_h)
- {
- _messages_cb_clear_settings((messages_cb_settings_s*)_svc->cbs_settings_h);
- free(_svc->cbs_settings_h);
- }
- _svc->cbs_settings_h = (messages_cb_settings_h)_settings;
-
- *settings = (messages_cb_settings_h)_settings;
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_save_settings(messages_service_h service, messages_cb_settings_h settings)
-{
- int i;
- int count;
- int ret;
-
- messages_service_s *_svc = (messages_service_s *)service;
- messages_cb_settings_s *_settings = (messages_cb_settings_s *)settings;
-
- messages_cb_channel_s *_ch;
- msg_struct_list_s *channels = NULL;
-
- CHECK_NULL(_svc);
- CHECK_NULL(_svc->service_h);
- CHECK_NULL(_settings);
- CHECK_NULL(_settings->_struct);
-
- msg_get_list_handle(_settings->_struct, MSG_CB_CHANNEL_LIST_STRUCT, (void **)&channels);
-
- count = g_slist_length(_settings->channel_list);
- if (CB_CHANNEL_MAX < count)
- {
- count = CB_CHANNEL_MAX;
- }
- channels->nCount = count;
-
- for (i=0; i < channels->nCount; i++)
- {
- _ch = (messages_cb_channel_s *)g_slist_nth_data(_settings->channel_list, i);
-
- msg_set_bool_value(channels->msg_struct_info[i], MSG_CB_CHANNEL_ACTIVATE_BOOL, _ch->activated);
- msg_set_int_value(channels->msg_struct_info[i], MSG_CB_CHANNEL_ID_FROM_INT, _ch->from_id);
- msg_set_int_value(channels->msg_struct_info[i], MSG_CB_CHANNEL_ID_TO_INT, _ch->to_id);
- msg_set_str_value(channels->msg_struct_info[i], MSG_CB_CHANNEL_NAME_STR, _ch->name, CB_CHANNEL_NAME_MAX);
- }
-
- ret = msg_set_cb_opt(_svc->service_h, _settings->_struct);
-
- return ERROR_CONVERT(ret);
-}
-
-
-int messages_cb_settings_set_enabled(messages_cb_settings_h settings, bool enabled)
-{
- int ret;
- messages_cb_settings_s *_settings = (messages_cb_settings_s *)settings;
-
- CHECK_NULL(_settings);
- CHECK_NULL(_settings->_struct);
-
- ret = msg_set_bool_value(_settings->_struct, MSG_CB_RECEIVE_BOOL, enabled);
- if (MSG_SUCCESS != ret)
- {
- return ERROR_CONVERT(ret);
- }
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_settings_is_enabled(messages_cb_settings_h settings, bool *enabled)
-{
- int ret;
- bool _enabled;
- messages_cb_settings_s *_settings = (messages_cb_settings_s *)settings;
-
- CHECK_NULL(_settings);
- CHECK_NULL(_settings->_struct);
- CHECK_NULL(enabled);
-
- ret = msg_get_bool_value(_settings->_struct, MSG_CB_RECEIVE_BOOL, &_enabled);
- if (MSG_SUCCESS != ret)
- {
- return ERROR_CONVERT(ret);
- }
-
- *enabled = _enabled;
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_settings_add_channel(messages_cb_settings_h settings, messages_cb_channel_h channel)
-{
- int count;
-
- messages_cb_settings_s *_settings = (messages_cb_settings_s *)settings;
-
- CHECK_NULL(_settings);
- CHECK_NULL(channel);
-
- count = g_slist_length(_settings->channel_list);
- if (CB_CHANNEL_MAX <= count)
- {
- LOGE("[%s] OUT_OF_RANGE(0x%08x) channel_list is full."
- , __FUNCTION__, MESSAGES_ERROR_OUT_OF_MEMORY);
- return MESSAGES_ERROR_OUT_OF_RANGE;
- }
-
- _settings->channel_list = g_slist_append(_settings->channel_list, channel);
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_settings_remove_channel(messages_cb_settings_h settings, messages_cb_channel_h channel)
-{
- messages_cb_settings_s *_settings = (messages_cb_settings_s *)settings;
-
- CHECK_NULL(_settings);
- CHECK_NULL(channel);
-
- _settings->channel_list = g_slist_remove_all(_settings->channel_list, channel);
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_settings_get_channel(messages_cb_settings_h settings, int index, messages_cb_channel_h *channel)
-{
- messages_cb_channel_h ch;
- messages_cb_settings_s *_settings = (messages_cb_settings_s *)settings;
-
- CHECK_NULL(_settings);
- CHECK_NULL(channel);
-
- ch = (messages_cb_channel_h)g_slist_nth_data(_settings->channel_list, index);
- if (NULL == ch)
- {
- LOGE("[%s:%d] OPERATION_FAILED(0x%08x) : No channel data in the channel list.",
- __FUNCTION__, __LINE__, MESSAGES_ERROR_OPERATION_FAILED);
- return MESSAGES_ERROR_OPERATION_FAILED;
- }
-
- *channel = ch;
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_settings_get_channel_count(messages_cb_settings_h settings, int *count)
-{
- messages_cb_settings_s *_settings = (messages_cb_settings_s *)settings;
-
- CHECK_NULL(_settings);
- CHECK_NULL(count);
-
- *count = g_slist_length(_settings->channel_list);
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_create_channel(messages_cb_channel_h *channel)
-{
- messages_cb_channel_s *_channel;
-
- CHECK_NULL(channel);
-
- _channel = (messages_cb_channel_s *)calloc(1, sizeof(messages_cb_channel_s));
- if (NULL == _channel)
- {
- LOGE("[%s] OUT_OF_MEMORY(0x%08x) fail to create '_channel'."
- , __FUNCTION__, MESSAGES_ERROR_OUT_OF_MEMORY);
- return MESSAGES_ERROR_OUT_OF_MEMORY;
- }
-
- *channel = (messages_cb_channel_h)_channel;
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_destroy_channel(messages_cb_channel_h channel)
-{
- messages_cb_channel_s *_channel = (messages_cb_channel_s *)channel;
-
- CHECK_NULL(_channel);
-
- free(channel);
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_channel_set_id(messages_cb_channel_h channel, int from_id, int to_id)
-{
- messages_cb_channel_s *_channel = (messages_cb_channel_s *)channel;
-
- CHECK_NULL(_channel);
-
- _channel->from_id = from_id;
- _channel->to_id = to_id;
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_channel_get_id(messages_cb_channel_h channel, int *from_id, int *to_id)
-{
- messages_cb_channel_s *_channel = (messages_cb_channel_s *)channel;
-
- CHECK_NULL(_channel);
- CHECK_NULL(from_id);
- CHECK_NULL(to_id);
-
- *from_id = _channel->from_id;
- *to_id = _channel->to_id;
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_channel_set_name(messages_cb_channel_h channel, const char *name)
-{
- int size;
-
- messages_cb_channel_s *_channel = (messages_cb_channel_s *)channel;
-
- CHECK_NULL(_channel);
- CHECK_NULL(name);
-
- size = strlen(name);
-
- if (CB_CHANNEL_NAME_MAX < size)
- {
- LOGE("[%s] OUT_OF_RANGE(0x%08x) channel name > %d"
- , __FUNCTION__, MESSAGES_ERROR_OUT_OF_MEMORY, CB_CHANNEL_NAME_MAX);
- return MESSAGES_ERROR_OUT_OF_RANGE;
- }
-
- strncpy(_channel->name, name, CB_CHANNEL_NAME_MAX);
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_channel_get_name(messages_cb_channel_h channel, char **name)
-{
- messages_cb_channel_s *_channel = (messages_cb_channel_s *)channel;
-
- CHECK_NULL(_channel);
- CHECK_NULL(name);
-
- *name = strdup(_channel->name);
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_channel_set_activated(messages_cb_channel_h channel, bool activated)
-{
- messages_cb_channel_s *_channel = (messages_cb_channel_s *)channel;
-
- CHECK_NULL(_channel);
-
- _channel->activated = activated;
-
- return MESSAGES_ERROR_NONE;
-}
-
-int messages_cb_channel_is_activated(messages_cb_channel_h channel, bool *activated)
-{
- messages_cb_channel_s *_channel = (messages_cb_channel_s *)channel;
-
- CHECK_NULL(_channel);
- CHECK_NULL(activated);
-
- *activated = _channel->activated;
-
- return MESSAGES_ERROR_NONE;
-}
-
-
-
-
-
diff --git a/src/messages_push.c b/src/messages_push.c
index a6f0bd3..fce67f6 100644
--- a/src/messages_push.c
+++ b/src/messages_push.c
@@ -55,6 +55,8 @@ void _messages_push_incoming_mediator_cb(msg_handle_t handle, const char *push_h
int messages_push_add_incoming_cb(messages_service_h service, const char *app_id,
messages_push_incoming_cb callback, void *user_data)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
messages_push_incoming_callback_s *_cb;
@@ -94,6 +96,8 @@ int messages_push_add_incoming_cb(messages_service_h service, const char *app_id
int messages_push_remove_incoming_cb(messages_service_h service, const char *app_id)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int i;
messages_push_incoming_callback_s *_cb;
@@ -120,6 +124,8 @@ int messages_push_remove_incoming_cb(messages_service_h service, const char *app
int messages_push_register(messages_service_h service, const char *content_type, const char *app_id)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
msg_struct_t push_info;
@@ -132,9 +138,9 @@ int messages_push_register(messages_service_h service, const char *content_type,
CHECK_NULL(content_type);
CHECK_NULL(app_id);
- ret = app_get_package(&pkg_name);
+ ret = app_get_id(&pkg_name);
if (APP_ERROR_NONE != ret) {
- LOGE("[%s:%d] OPERATION_FAILED(0x%08x) : app_get_package failed.",
+ LOGE("[%s:%d] OPERATION_FAILED(0x%08x) : app_get_id failed.",
__FUNCTION__, __LINE__, MESSAGES_ERROR_OPERATION_FAILED);
return MESSAGES_ERROR_OPERATION_FAILED;
}
@@ -157,6 +163,8 @@ int messages_push_register(messages_service_h service, const char *content_type,
int messages_push_deregister(messages_service_h service, const char *content_type, const char *app_id)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
msg_struct_t push_info;
@@ -169,9 +177,9 @@ int messages_push_deregister(messages_service_h service, const char *content_typ
CHECK_NULL(content_type);
CHECK_NULL(app_id);
- ret = app_get_package(&pkg_name);
+ ret = app_get_id(&pkg_name);
if (APP_ERROR_NONE != ret) {
- LOGE("[%s:%d] OPERATION_FAILED(0x%08x) : app_get_package failed.",
+ LOGE("[%s:%d] OPERATION_FAILED(0x%08x) : app_get_id failed.",
__FUNCTION__, __LINE__, MESSAGES_ERROR_OPERATION_FAILED);
return MESSAGES_ERROR_OPERATION_FAILED;
}
@@ -195,6 +203,8 @@ int messages_push_deregister(messages_service_h service, const char *content_typ
int messages_push_reregister(messages_service_h service, const char *content_type, const char *app_id,
const char *dst_content_type, const char *dst_app_id)
{
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE);
+
int ret;
msg_struct_t push_info;
@@ -210,9 +220,9 @@ int messages_push_reregister(messages_service_h service, const char *content_typ
CHECK_NULL(dst_content_type);
CHECK_NULL(dst_app_id);
- ret = app_get_package(&pkg_name);
+ ret = app_get_id(&pkg_name);
if (APP_ERROR_NONE != ret) {
- LOGE("[%s:%d] OPERATION_FAILED(0x%08x) : app_get_package failed.",
+ LOGE("[%s:%d] OPERATION_FAILED(0x%08x) : app_get_id failed.",
__FUNCTION__, __LINE__, MESSAGES_ERROR_OPERATION_FAILED);
return MESSAGES_ERROR_OPERATION_FAILED;
}
diff --git a/test/messages_cb_channel_test.c b/test/messages_cb_channel_test.c
deleted file mode 100644
index f3bf92d..0000000
--- a/test/messages_cb_channel_test.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <messages.h>
-
-int main(int argc, char *argv[])
-{
- int ret;
-
- messages_service_h svc;
-
- messages_cb_settings_h settings;
-
-
-
- // open service
- ret = messages_open_service(&svc);
- if (MESSAGES_ERROR_NONE != ret) {
- printf("error: messages_open_service() = %d", ret);
- return 1;
- }
-
- ret = messages_cb_load_settings(svc, &settings);
- if (MESSAGES_ERROR_NONE != ret) {
- printf("error: messages_cb_load_settings() = %d", ret);
- return 1;
- }
-
-
-
-
- // close service
- messages_close_service(svc);
-
-
- return 0;
-}
diff --git a/test/messages_search_test.c b/test/messages_search_test.c
index 5bca8bc..bd157f8 100644
--- a/test/messages_search_test.c
+++ b/test/messages_search_test.c
@@ -9,6 +9,7 @@ bool _search_cb(messages_message_h msg, int index, int result_count, int total_c
messages_message_type_e msgType;
messages_message_box_e mbox;
int ret;
+ int cnt;
char *text;
int i, nAddr;
char *addr = NULL;
@@ -41,6 +42,11 @@ bool _search_cb(messages_message_h msg, int index, int result_count, int total_c
printf("Subject: %s\n", text);
free(text);
}
+
+ ret = messages_mms_get_attachment_count(msg, &cnt);
+ if (MESSAGES_ERROR_NONE == ret) {
+ printf("Attachments: %d\n", cnt);
+ }
} else {
printf("Type: Unknown");
}
diff --git a/test/messages_send_mms_test.c b/test/messages_send_mms_test.c
index 76c0aa8..c2c5583 100644
--- a/test/messages_send_mms_test.c
+++ b/test/messages_send_mms_test.c
@@ -1,18 +1,37 @@
#include <stdio.h>
#include <stdlib.h>
+#include <glib.h>
+
#include <messages.h>
-#define TEST_NUMBER "000000000"
+//#define TEST_NUMBER "splusa2012@gmail.com"
+#define TEST_NUMBER "+491726597478"
+
+static GMainLoop *mainloop;
+
+static void sig_quit(int signo)
+{
+ if(mainloop)
+ {
+ g_main_loop_quit(mainloop);
+ }
+}
void _sent_cb(messages_sending_result_e result, void *user_data)
{
+ printf("sending result=%d\n", (int)result);
}
int main(int argc, char *argv[])
{
int ret;
+ signal(SIGINT, sig_quit);
+ signal(SIGTERM, sig_quit);
+ signal(SIGQUIT, sig_quit);
+ mainloop = g_main_loop_new(NULL, FALSE);
+
messages_service_h svc;
messages_message_h msg;
@@ -34,8 +53,9 @@ int main(int argc, char *argv[])
messages_set_text(msg, "This is a multi-media message!");
messages_mms_set_subject(msg, "TEST!");
-// messages_mms_add_attachment(msg, MESSAGES_MEDIA_VIDEO, "/opt/etc/msg-service/V091120_104905.3gp");
+// messages_mms_add_attachment(msg, MESSAGES_MEDIA_AUDIO, "/tmp/test.amr");
// messages_mms_add_attachment(msg, MESSAGES_MEDIA_IMAGE, "/opt/etc/msg-service/P091120_104633.jpg");
+ messages_mms_add_attachment(msg, MESSAGES_MEDIA_IMAGE, "/opt/media/Images/image2.jpg");
printf("Before Sending\n");
@@ -46,6 +66,9 @@ int main(int argc, char *argv[])
return 1;
}
+ g_main_loop_run(mainloop);
+ g_main_loop_unref(mainloop);
+
// destroy
messages_destroy_message(msg);
messages_close_service(svc);
diff --git a/test/messages_send_sms_test.c b/test/messages_send_sms_test.c
index d54cc53..b324024 100644
--- a/test/messages_send_sms_test.c
+++ b/test/messages_send_sms_test.c
@@ -3,7 +3,7 @@
#include <messages.h>
-#define TEST_NUMBER "00000000000"
+#define TEST_NUMBER "447810507326"
void _sent_cb(messages_sending_result_e result, void *user_data)
{