diff options
author | jk7744.park <jk7744.park@samsung.com> | 2015-10-24 16:24:34 +0900 |
---|---|---|
committer | jk7744.park <jk7744.park@samsung.com> | 2015-10-24 16:24:34 +0900 |
commit | bf6173804920739f48500451d07953ea4cbbb17c (patch) | |
tree | 4dab497a352b64c2622521a2ad8250b6fe79a352 | |
parent | 35c618a38fd1024dff8dc4549e85ac402a3a833b (diff) | |
download | messages-accepted/tizen_2.4_mobile.tar.gz messages-accepted/tizen_2.4_mobile.tar.bz2 messages-accepted/tizen_2.4_mobile.zip |
tizen 2.4 releasetizen_2.4_mobile_releasesubmit/tizen_2.4/20151028.063620accepted/tizen/2.4/mobile/20151029.034630tizen_2.4accepted/tizen_2.4_mobile
-rwxr-xr-x | doc/messages_doc.h | 12 | ||||
-rw-r--r-- | include/messages.h | 75 | ||||
-rw-r--r-- | include/messages_error.h | 1 | ||||
-rw-r--r-- | include/messages_private.h | 10 | ||||
-rw-r--r-- | include/messages_types.h | 29 | ||||
-rw-r--r-- | packaging/capi-messaging-messages.spec | 8 | ||||
-rwxr-xr-x | src/messages.c | 124 | ||||
-rw-r--r-- | src/messages_push.c | 10 | ||||
-rwxr-xr-x | test/CMakeLists.txt | 4 |
9 files changed, 142 insertions, 131 deletions
diff --git a/doc/messages_doc.h b/doc/messages_doc.h index 241894d..96bac07 100755 --- a/doc/messages_doc.h +++ b/doc/messages_doc.h @@ -43,6 +43,7 @@ * @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.sms\n * - http://tizen.org/feature/network.telephony.mms\n * * It is recommended to design feature related codes in your application for reliability.\n @@ -51,7 +52,7 @@ * * 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> + * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a> * <BR> */ @@ -77,6 +78,7 @@ * @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.sms\n * - http://tizen.org/feature/network.telephony.mms\n * * It is recommended to design feature related codes in your application for reliability.\n @@ -85,13 +87,13 @@ * * 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> + * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><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. + * @brief The WAP PUSH 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 @@ -109,6 +111,7 @@ * @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 + * - http://tizen.org/feature/network.telephony.sms\n * * It is recommended to design feature related codes in your application for reliability.\n * @@ -116,8 +119,9 @@ * * 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> + * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a> * */ + #endif /* __TIZEN_MESSAGES_DOC_H__ */ diff --git a/include/messages.h b/include/messages.h index 1256974..e36e0e5 100644 --- a/include/messages.h +++ b/include/messages.h @@ -42,7 +42,7 @@ extern "C" /** * @brief Opens a handle for the messaging service. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * @privlevel public * @privilege %http://tizen.org/privilege/message.read * @@ -68,7 +68,7 @@ int messages_open_service(messages_service_h *service); /** * @brief Closes a handle for the messaging service. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * @privlevel public * @privilege %http://tizen.org/privilege/message.read * @@ -91,7 +91,7 @@ int messages_close_service(messages_service_h service); /** * @brief Creates a message handle. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @remarks You must release @a msg using messages_destroy_message(). * @@ -115,7 +115,7 @@ int messages_create_message(messages_message_type_e type, messages_message_h *ms /** * @brief Destroys a message handle and releases all its resources. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @param[in] msg The message handle to destroy * @@ -133,7 +133,7 @@ int messages_destroy_message(messages_message_h msg); /** * @brief Gets the message ID of the message. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @param[in] msg The message handle * @param[out] msg_id The message ID @@ -154,7 +154,7 @@ int messages_get_message_id(messages_message_h msg, int *msg_id); /** * @brief Sets the SIM ID of the sending message. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @param[in] msg The message handle * @param[in] sim_id The SIM id to send message @@ -175,7 +175,7 @@ int messages_set_sim_id(messages_message_h msg, int sim_id); /** * @brief Gets the SIM ID of the message. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @param[in] msg The message handle * @param[out] sim_id The SIM id of message @@ -196,7 +196,7 @@ int messages_get_sim_id(messages_message_h msg, int *sim_id); /** * @brief Gets the message box type of the message. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @param[in] msg The message handle * @param[out] mbox The message box type @@ -213,7 +213,7 @@ int messages_get_mbox_type(messages_message_h msg, messages_message_box_e *mbox) /** * @brief Gets the destination port of the message. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @param[in] msg The message handle * @param[out] port The destination port of the message @@ -232,7 +232,7 @@ int messages_get_message_port(messages_message_h msg, int *port); /** * @brief Gets the type of the message. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @param[in] msg The message handle * @param[out] type The message type @@ -251,7 +251,7 @@ 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. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @param[in] msg The message handle * @param[in] address The recipient's address to receive a message \n @@ -274,7 +274,7 @@ int messages_add_address(messages_message_h msg, const char *address, messages_r /** * @brief Gets the total number of recipients in the message. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @param[in] msg The message handle * @param[out] count The total number of recipients @@ -295,7 +295,7 @@ int messages_get_address_count(messages_message_h msg, int *count); /** * @brief Gets a recipient's address with specified index. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @remarks You must release @a address using free(). * @@ -321,7 +321,7 @@ int messages_get_address(messages_message_h msg, int index, char **address, mess /** * @brief Removes all recipients in the message. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @param[in] msg The message handle * @@ -341,7 +341,7 @@ int messages_remove_all_addresses(messages_message_h msg); /** * @brief Sets the text of the message. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @param[in] msg The message handle * @param[in] text The text of the message \n @@ -363,7 +363,7 @@ int messages_set_text(messages_message_h msg, const char *text); /** * @brief Gets the text of the message. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @remarks You must release @a text using free(). * @@ -386,7 +386,7 @@ int messages_get_text(messages_message_h msg, char **text); /** * @brief Gets the time of the message. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @param[in] msg The message handle * @param[out] time The time of the message @@ -403,7 +403,7 @@ int messages_get_time(messages_message_h msg, time_t *time); /** * @brief Sends the message to all recipients. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * @privlevel public * @privilege %http://tizen.org/privilege/message.write * @@ -430,7 +430,7 @@ int messages_send_message(messages_service_h service, messages_message_h msg, bo /** * @brief Gets the message count in the specific message box. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @privlevel public * @privilege %http://tizen.org/privilege/message.read @@ -460,7 +460,7 @@ int messages_get_message_count(messages_service_h service, /** * @brief Searches for messages. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * @privlevel public * @privilege %http://tizen.org/privilege/message.read * @@ -503,7 +503,7 @@ int messages_search_message(messages_service_h service, /** * @brief Searches a message with the given message ID. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * @privlevel public * @privilege %http://tizen.org/privilege/message.read * @@ -530,7 +530,7 @@ int messages_search_message_by_id(messages_service_h service, int msg_id, messag /** * @brief Frees the message array. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @param[in] message_array The array of the message handle * @@ -549,7 +549,7 @@ int messages_free_message_array(messages_message_h *message_array); /** * @brief Retrieves the searched messages by invoking the given callback function iteratively. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * @privlevel public * @privilege %http://tizen.org/privilege/message.read * @@ -589,7 +589,7 @@ int messages_foreach_message(messages_service_h service, /** * @brief Registers a callback to be invoked when an incoming message is received. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * @privlevel public * @privilege %http://tizen.org/privilege/message.read * @@ -617,7 +617,7 @@ int messages_set_message_incoming_cb(messages_service_h service, messages_incomi /** * @brief Unregisters the callback function. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * @privlevel public * @privilege %http://tizen.org/privilege/message.write * @@ -639,7 +639,7 @@ int messages_unset_message_incoming_cb(messages_service_h service); /** * @brief Adds an additional listening port for the incoming SMS messages. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * @privlevel public * @privilege %http://tizen.org/privilege/message.read * @@ -659,6 +659,7 @@ int messages_unset_message_incoming_cb(messages_service_h service); */ int messages_add_sms_listening_port(messages_service_h service, int port); + /** * @addtogroup CAPI_MESSAGING_MESSAGES_MMS_MODULE * @{ @@ -666,7 +667,7 @@ int messages_add_sms_listening_port(messages_service_h service, int port); /** * @brief Sets the subject of the message. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @param[in] msg The message handle * @param[in] subject The subject of the message \n @@ -689,7 +690,7 @@ int messages_mms_set_subject(messages_message_h msg, const char *subject); /** * @brief Gets the subject of the message. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @remarks You must release @a subject using free(). * @@ -714,7 +715,7 @@ int messages_mms_get_subject(messages_message_h msg, char **subject); /** * @brief Adds the attachment to the MMS message. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @param[in] msg The message handle * @param[in] type The attachment type @@ -741,7 +742,7 @@ 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. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @remarks You must release @a path using free(). * @@ -770,7 +771,7 @@ int messages_mms_get_attachment(messages_message_h msg, int index, messages_medi /** * @brief Gets the attachment with the specified index. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @param[in] msg The message handle * @param[out] count The total number of attachments @@ -794,7 +795,7 @@ int messages_mms_get_attachment_count(messages_message_h msg, int *count); /** * @brief Removes all attachments to the MMS message. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @param[in] msg The message handle * @@ -824,7 +825,7 @@ int messages_mms_remove_all_attachments(messages_message_h msg); /** * @brief Registers a callback to be invoked when an WAP Push message is received. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * @privlevel public * @privilege %http://tizen.org/privilege/message.read * @@ -848,7 +849,7 @@ int messages_push_add_incoming_cb(messages_service_h service, const char *app_id /** * @brief Unregisters the WAP push incoming callback function. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @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 @@ -866,7 +867,7 @@ 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. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * @privlevel public * @privilege %http://tizen.org/privilege/message.write * @@ -888,7 +889,7 @@ int messages_push_register(messages_service_h service, const char *content_type, /** * @brief De-registers an application from the mapping table of the WAP Push service. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * @privlevel public * @privilege %http://tizen.org/privilege/message.write * @@ -910,7 +911,7 @@ int messages_push_deregister(messages_service_h service, const char *content_typ /** * @brief Re-registers an application to the mapping table of the WAP Push service. * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * @privlevel public * @privilege %http://tizen.org/privilege/message.write * diff --git a/include/messages_error.h b/include/messages_error.h index 797954f..b156936 100644 --- a/include/messages_error.h +++ b/include/messages_error.h @@ -33,7 +33,6 @@ extern "C" /** * @brief Enumerations of error code for Messaging. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { MESSAGES_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ diff --git a/include/messages_private.h b/include/messages_private.h index 53ac983..58953b8 100644 --- a/include/messages_private.h +++ b/include/messages_private.h @@ -17,6 +17,14 @@ #ifndef __TIZEN_MESSAGING_PRIVATE_H__ #define __TIZEN_MESSAGING_PRIVATE_H__ +#include <dlog.h> + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "CAPI_MESSAGING" +#define DBG_MODE (1) + #ifdef __cplusplus extern "C" { @@ -59,7 +67,7 @@ typedef struct _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" -#define MESSAGES_TELEPHONY_FEATURE "http://tizen.org/feature/network.telephony" +#define MESSAGES_TELEPHONY_SMS_FEATURE "http://tizen.org/feature/network.telephony.sms" #define MESSAGES_TELEPHONY_MMS_FEATURE "http://tizen.org/feature/network.telephony.mms" #define ERROR_CONVERT(err) _messages_error_converter(err, __FUNCTION__, __LINE__); diff --git a/include/messages_types.h b/include/messages_types.h index bb05563..4643298 100644 --- a/include/messages_types.h +++ b/include/messages_types.h @@ -31,20 +31,20 @@ extern "C" /** * @brief The messaging service handle. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 */ typedef struct messages_service_s *messages_service_h; /** * @brief The message handle. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 */ typedef struct messages_message_s *messages_message_h; /** * @brief Enumeration for the message box type. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 */ typedef enum { MESSAGES_MBOX_ALL = 0, /**< All message box type */ @@ -57,7 +57,7 @@ typedef enum { /** * @brief Enumeration for the message type. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 */ typedef enum { MESSAGES_TYPE_UNKNOWN = 0, /**< Unknown type */ @@ -72,7 +72,7 @@ typedef enum { /** * @brief Enumeration for the attachment type for MMS messaging. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 */ typedef enum { MESSAGES_MEDIA_UNKNOWN = 0, /**< Unknown */ @@ -83,7 +83,7 @@ typedef enum { /** * @brief Enumeration for the recipient type of a message. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 */ typedef enum { MESSAGES_RECIPIENT_UNKNOWN = 0, /**< Unknown */ @@ -94,7 +94,7 @@ typedef enum { /** * @brief Enumeration for the result of sending a message. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 */ typedef enum { MESSAGES_SENDING_FAILED = -1, /**< Message sending failed */ @@ -103,7 +103,7 @@ typedef enum { /** * @brief Enumeration for the SIM index of a message. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 */ typedef enum { MESSAGES_SIM_INDEX_UNKNOWN = 0, /**< Unknown SIM Index*/ @@ -111,10 +111,10 @@ typedef enum { 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. - * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @param[in] result The result of message sending * @param[in] user_data The user data passed from the callback registration function @@ -128,8 +128,7 @@ typedef void (* messages_sent_cb)(messages_sending_result_e result, void *user_d /** * @brief Called when an incoming message is received. - * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @param[in] incoming_msg The incoming message * @param[in] user_data The user data passed from the callback registration function @@ -144,8 +143,7 @@ typedef void (* messages_incoming_cb)(messages_message_h incoming_msg, void *use /** * @brief Called when a message is retrieved from a search request. - * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @remarks You should not call messages_destroy_message() with @a msg. * @@ -176,8 +174,7 @@ typedef bool (* messages_search_cb)(messages_message_h msg, int index, int resul /** * @brief Called when an incoming push message is received. - * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif + * @since_tizen 2.3 * * @param[in] header The header of the push message * @param[in] body The body of the push message \n diff --git a/packaging/capi-messaging-messages.spec b/packaging/capi-messaging-messages.spec index f13c158..9ae564f 100644 --- a/packaging/capi-messaging-messages.spec +++ b/packaging/capi-messaging-messages.spec @@ -1,9 +1,14 @@ Name: capi-messaging-messages Summary: A SMS/MMS library in Tizen Native API -Version: 0.1.28 +Version: 0.2.1 Release: 1 License: Apache-2.0 Source0: %{name}-%{version}.tar.gz + +%if "%{?tizen_profile_name}" == "tv" +ExcludeArch: %{arm} %ix86 x86_64 +%endif + BuildRequires: cmake BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(glib-2.0) @@ -58,6 +63,7 @@ cd cmake_build_tmp %files %{_libdir}/libcapi-messaging-messages.so.* %{_datadir}/license/%{name} +#%{_bindir}/* %files devel %{_includedir}/messaging/*.h diff --git a/src/messages.c b/src/messages.c index 2b62a85..3f263f5 100755 --- a/src/messages.c +++ b/src/messages.c @@ -22,7 +22,9 @@ #include <memory.h> #include <glib.h> -#include <dlog.h> + +#include <privacy_checker_client.h> + #include <msg.h> #include <msg_transport.h> #include <msg_storage.h> @@ -31,15 +33,6 @@ #include <messages_types.h> #include <messages_private.h> -#include <privacy_checker_client.h> - -#ifdef LOG_TAG -#undef LOG_TAG -#endif -#define LOG_TAG "CAPI_MESSAGING" -#define DBG_MODE (1) - -#define MAX_MESSAGES_TEXT_LEN 1530 /* Private Utility Functions */ int _messages_get_media_type_from_filepath(const char *filepath); @@ -52,7 +45,7 @@ int _messages_check_feature(char *feature_name); int messages_open_service(messages_service_h *svc) { - CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int ret; messages_service_s *_svc; @@ -73,20 +66,20 @@ int messages_open_service(messages_service_h *svc) _svc->push_incoming_cb_list = NULL; ret = msg_open_msg_handle(&_svc->service_h); - if (MSG_SUCCESS != ret) { - free(_svc); - return ERROR_CONVERT(ret); - } + if (MSG_SUCCESS != ret) + goto ERR_RET; ret = msg_reg_sent_status_callback(_svc->service_h, &_messages_sent_mediator_cb, (void*)_svc); - if (MSG_SUCCESS != ret) { - free(_svc); - return ERROR_CONVERT(ret); - } + if (MSG_SUCCESS != ret) + goto ERR_RET; *svc = (messages_service_h)_svc; return MESSAGES_ERROR_NONE; + +ERR_RET: + free(_svc); + return ERROR_CONVERT(ret); } void _free_push_incoming_cb(messages_push_incoming_callback_s *cb) @@ -101,7 +94,7 @@ 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); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int ret; @@ -129,7 +122,7 @@ 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); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int ret; messages_message_s *_msg = NULL; @@ -160,28 +153,17 @@ int messages_create_message(messages_message_type_e type, messages_message_h *ms { ret = ERROR_CONVERT(msg_set_int_value(_msg->msg_h, MSG_MESSAGE_TYPE_INT, MSG_TYPE_SMS)); if (MESSAGES_ERROR_NONE != ret) - { - msg_release_struct(&_msg->msg_h); - free(_msg); - return ret; - } + goto ERR_RET; } 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; - } + if (MESSAGES_ERROR_NONE != ret) + goto ERR_RET; ret = ERROR_CONVERT(msg_set_int_value(_msg->msg_h, MSG_MESSAGE_TYPE_INT, MSG_TYPE_MMS)); if (MESSAGES_ERROR_NONE != ret) - { - msg_release_struct(&_msg->msg_h); - free(_msg); - return ret; - } + goto ERR_RET; } else { @@ -195,11 +177,16 @@ int messages_create_message(messages_message_type_e type, messages_message_h *ms *msg = (messages_message_h)_msg; return MESSAGES_ERROR_NONE; + +ERR_RET: + msg_release_struct(&_msg->msg_h); + free(_msg); + return ret; } int messages_destroy_message(messages_message_h msg) { - CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int ret; @@ -223,7 +210,7 @@ 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); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int msgType; int ret; @@ -272,7 +259,7 @@ 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); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int ret; @@ -325,7 +312,7 @@ int messages_add_address(messages_message_h msg, const char *address, messages_r int messages_get_address_count(messages_message_h msg, int *count) { - CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int ret; msg_list_handle_t addr_list = NULL; @@ -348,7 +335,7 @@ int messages_get_address_count(messages_message_h msg, int *count) int messages_get_address(messages_message_h msg, int index, char **address, messages_recipient_type_e *type) { - CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int ret; char _address[MAX_ADDRESS_VAL_LEN+1] = {0, }; @@ -426,7 +413,7 @@ int messages_get_address(messages_message_h msg, int index, char **address, mess int messages_remove_all_addresses(messages_message_h msg) { - CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int ret; messages_message_s *_msg = (messages_message_s*)msg; @@ -447,7 +434,7 @@ 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); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); /* Privacy check */ int privacy_ret = privacy_checker_check_by_privilege(MESSAGES_PRIVILEGE_WRITE); @@ -551,7 +538,7 @@ 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); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int ret; msg_folder_id_t folderId; @@ -629,7 +616,7 @@ 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); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int i; int ret; @@ -738,7 +725,7 @@ int messages_search_message(messages_service_h service, int messages_free_message_array(messages_message_h *message_array) { - CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int ret; int i=0; @@ -770,7 +757,7 @@ 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); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); /* Privacy check */ int privacy_ret = privacy_checker_check_by_privilege(MESSAGES_PRIVILEGE_READ); @@ -888,7 +875,7 @@ void _messages_incoming_mediator_cb(msg_handle_t handle, msg_struct_t msg, void int messages_set_message_incoming_cb(messages_service_h svc, messages_incoming_cb callback, void *user_data) { - CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_MMS_FEATURE); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int ret; @@ -907,12 +894,14 @@ int messages_set_message_incoming_cb(messages_service_h svc, messages_incoming_c return ret; } - ret = ERROR_CONVERT( - msg_reg_mms_conf_message_callback(_svc->service_h, &_messages_incoming_mediator_cb, NULL, (void*)_svc) - ); - if (MESSAGES_ERROR_NONE != ret) - { - return ret; + if (MESSAGES_ERROR_NONE == _messages_check_feature(MESSAGES_TELEPHONY_MMS_FEATURE)) { + ret = ERROR_CONVERT( + msg_reg_mms_conf_message_callback(_svc->service_h, &_messages_incoming_mediator_cb, NULL, (void*)_svc) + ); + if (MESSAGES_ERROR_NONE != ret) + { + return ret; + } } } @@ -925,7 +914,7 @@ 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); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int ret; messages_service_s *_svc = (messages_service_s*)service; @@ -950,20 +939,22 @@ 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); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); messages_service_s *_svc = (messages_service_s*)svc; CHECK_NULL(_svc); _svc->incoming_cb_enabled = false; + _svc->incoming_cb = NULL; + _svc->incoming_cb_user_data = NULL; return MESSAGES_ERROR_NONE; } int messages_get_message_port(messages_message_h msg, int *port) { - CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int ret; int _port; @@ -986,7 +977,7 @@ 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); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int ret; int len; @@ -1005,7 +996,7 @@ int messages_set_text(messages_message_h msg, const char *text) if (IS_SMS(type)) { len = strlen(text); - if (len > MAX_MESSAGES_TEXT_LEN) + if (len > MAX_MSG_TEXT_LEN) { LOGE("[%s] INVALID_PARAMETER(0x%08x) : the length of body exceeded the max, 1530 ." , __FUNCTION__, MESSAGES_ERROR_INVALID_PARAMETER); @@ -1044,7 +1035,7 @@ 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); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int ret; char _text[MAX_MSG_TEXT_LEN+1] = {0,}; @@ -1109,7 +1100,7 @@ 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); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int ret; int _time; @@ -1132,7 +1123,7 @@ 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); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int ret; int _id; @@ -1156,7 +1147,7 @@ int messages_get_message_id(messages_message_h msg, int *msg_id) int messages_set_sim_id(messages_message_h msg, int sim_id) { - CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int ret; @@ -1176,7 +1167,7 @@ int messages_set_sim_id(messages_message_h msg, int sim_id) int messages_get_sim_id(messages_message_h msg, int *sim_id) { - CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int ret; int _id; @@ -1200,7 +1191,7 @@ int messages_get_sim_id(messages_message_h msg, int *sim_id) int messages_search_message_by_id(messages_service_h service, int msg_id, messages_message_h *msg) { - CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_FEATURE); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int ret; msg_struct_t new_msg_h; @@ -1277,7 +1268,7 @@ 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); + CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE); int ret; int folder_id; @@ -1531,6 +1522,7 @@ int messages_mms_remove_all_attachments(messages_message_h msg) return MESSAGES_ERROR_NONE; } + int _messages_save_mms_data(messages_message_s *msg) { int i; diff --git a/src/messages_push.c b/src/messages_push.c index fce67f6..70b50a8 100644 --- a/src/messages_push.c +++ b/src/messages_push.c @@ -55,7 +55,7 @@ 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);
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE);
int ret;
messages_push_incoming_callback_s *_cb;
@@ -96,7 +96,7 @@ 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);
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE);
int i;
messages_push_incoming_callback_s *_cb;
@@ -124,7 +124,7 @@ 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);
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE);
int ret;
@@ -163,7 +163,7 @@ 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);
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE);
int ret;
@@ -203,7 +203,7 @@ 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);
+ CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE);
int ret;
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 7715cac..27289db 100755 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,7 @@ SET(fw_test "${fw_name}-test") +SET(CMAKE_SKIP_BUILD_RPATH TRUE) + INCLUDE(FindPkgConfig) pkg_check_modules(${fw_test} REQUIRED glib-2.0) FOREACH(flag ${${fw_test}_CFLAGS}) @@ -14,4 +16,6 @@ FOREACH(src ${sources}) MESSAGE("${src_name}") ADD_EXECUTABLE(${src_name} ${src}) TARGET_LINK_LIBRARIES(${src_name} ${fw_name} ${${fw_test}_LDFLAGS}) + +# INSTALL(TARGETS ${src_name} DESTINATION bin) ENDFOREACH() |