2 * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef MAPI_STORAGE_H
18 #define MAPI_STORAGE_H
20 /*==================================================================================================
22 ==================================================================================================*/
24 #include "msg_storage_types.h"
33 * @ingroup MSG_SERVICE_FRAMEWORK
34 * @defgroup MSG_SERVICE_FRAMEWORK_STORAGE_MODULE Storage API
35 * @brief The Storage API provides functions to get message information with multiple types.
37 * @addtogroup MSG_SERVICE_FRAMEWORK_STORAGE_MODULE
40 * @section MSG_SERVICE_FRAMEWORK_STORAGE_MODULE_HEADER Required Header
41 * \#include <msg_storage.h>
43 * @section MSG_SERVICE_FRAMEWORK_STORAGE_MODULE_OVERVIEW Overview
45 * The Storage API provides the following functionalities:
47 * - Get message information
49 * @section MSG_SERVICE_FRAMEWORK_STORAGE_MODULE_FEATURE Related Features
50 * This API is related with the following features:\n
51 * - http://tizen.org/feature/network.telephony\n
52 * - http://tizen.org/feature/network.telephony.sms\n
54 * It is recommended to design feature related codes in your application for reliability.\n
56 * 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
58 * 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
60 * 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>
65 /*==================================================================================================
67 ==================================================================================================*/
70 * @brief Saves a message to the database.
74 * @privilege %http://tizen.org/privilege/message.write
76 * @remarks Mandatory fields of a message structure MUST be valid, otherwise the function will fail.
78 * @param[in] handle The Message handle
79 * @param[in] msg A pointer to a message structure
80 * @param[in] send_opt A pointer to a message structure for sending option
82 * @return The message ID on success,
83 * otherwise a negative error value
85 * @retval MESSAGE_ID Success in operation
86 * @retval MSG_ERR_INVALID_PARAMETER(-9) Invalid parameter
87 * @retval MSG_ERR_STORAGE_ERROR Storage error
88 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
89 * @retval MSG_ERR_NOT_SUPPORTED Not supported
92 int msg_add_message(msg_handle_t handle, const msg_struct_t msg, const msg_struct_t send_opt);
96 * @brief Adds a SyncML message to the database.
100 * @privilege %http://tizen.org/privilege/message.write
102 * @remarks Mandatory fields of a message structure MUST be valid, otherwise the function will fail.
104 * @param[in] handle The Message handle
105 * @param[in] syncml_msg A pointer to a syncml message structure
107 * @return @c 0 on success,
108 * otherwise a negative error value
110 * @retval MSG_SUCCESS Success in operation
111 * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid
112 * @retval MSG_ERR_STORAGE_ERROR Storage error
113 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
114 * @retval MSG_ERR_NOT_SUPPORTED Not supported
117 int msg_add_syncml_message(msg_handle_t handle, const msg_struct_t syncml_msg);
121 * @brief Updates a message in the database.
125 * @privilege %http://tizen.org/privilege/message.write
127 * @remarks The function is to update message data for the message identified by the given msgId as long as the given values are valid.
128 * @remarks Message ID MUST NOT be updated because that is a unique ID on platform.
129 * @remarks If applications want to move a message between folders, applications SHOULD call msg_move_to_folder().
130 * @remarks Storage ID MUST NOT be updated.
131 * @remarks If applications want to move the message between storages, applications SHOULD call msg_move_to_storage().
133 * @param[in] handle The Message handle
134 * @param[in] msg A pointer to a message structure
135 * @param[in] send_opt A pointer to a message sending option structure
137 * @return @c 0 on success,
138 * otherwise a negative error value
140 * @retval MSG_SUCCESS Success in operation
141 * @retval MSG_ERR_INVALID_PARAMETER Input parameter is invalid
142 * @retval MSG_ERR_STORAGE_ERROR Storage error
143 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
144 * @retval MSG_ERR_NOT_SUPPORTED Not supported
147 int msg_update_message(msg_handle_t handle, const msg_struct_t msg, const msg_struct_t send_opt);
151 * @brief Updates a message's read status in the database.
155 * @privilege %http://tizen.org/privilege/message.write
157 * @param[in] handle The message handle
158 * @param[in] msg_id The message ID
159 * @param[in] read Set @c true if the message is read,
160 * otherwise set @c false if the message is not read
162 * @return @c 0 on success,
163 * otherwise a negative error value
165 * @retval MSG_SUCCESS Success in operation
166 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
167 * @retval MSG_ERR_STORAGE_ERROR Storage error
168 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
169 * @retval MSG_ERR_NOT_SUPPORTED Not supported
172 int msg_update_read_status(msg_handle_t handle, msg_message_id_t msg_id, bool read);
176 * @brief Updates a message's protected status in the database.
180 * @privilege %http://tizen.org/privilege/message.write
182 * @param[in] handle The message handle
183 * @param[in] msg_id The message ID
184 * @parem[in] is_protected Set @c true if a message is protected,
185 * otherwise set @c false if message is not protected
187 * @return @c 0 on success,
188 * otherwise a negative error value
190 * @retval MSG_SUCCESS Success in operation
191 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
192 * @retval MSG_ERR_STORAGE_ERROR Storage error
193 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
194 * @retval MSG_ERR_NOT_SUPPORTED Not supported
197 int msg_update_protected_status(msg_handle_t handle, msg_message_id_t msg_id, bool is_protected);
201 * @brief Deletes a message by Message ID from the database.
205 * @privilege %http://tizen.org/privilege/message.write
207 * @param[in] handle The message handle
208 * @param[in] msg_id The message ID of the message to be deleted
210 * @return @c 0 on success,
211 * otherwise a negative error value
213 * @retval MSG_SUCCESS Success in operation
214 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
215 * @retval MSG_ERR_STORAGE_ERROR Storage error
216 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
217 * @retval MSG_ERR_NOT_SUPPORTED Not supported
220 int msg_delete_message(msg_handle_t handle, msg_message_id_t msg_id);
224 * @brief Deletes all messages in the specified folder from the database.
228 * @privilege %http://tizen.org/privilege/message.write
230 * @param[in] handle Message handle
231 * @param[in] msg_id Message ID of the message to be deleted
232 * @param[in] bOnlyDB Set @c true to not delete messages in SIM,
233 * otherwise set @c false to delete messages in SIM
235 * @return @c 0 on success,
236 * otherwise a negative error value
238 * @retval MSG_SUCCESS Success in operation
239 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
240 * @retval MSG_ERR_STORAGE_ERROR Storage error
241 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
242 * @retval MSG_ERR_NOT_SUPPORTED Not supported
245 int msg_delete_all_msgs_in_folder(msg_handle_t handle, msg_folder_id_t folder_id, bool bOnlyDB);
250 * @brief Moves a message to the specified folder in the database.
254 * @privilege %http://tizen.org/privilege/message.write
256 * @param[in] handle The message handle
257 * @param[in] msg_id The message ID of the message to be moved
258 * @param[in] dest_folder_id The ID of the destination folder
260 * @return @c 0 on success,
261 * otherwise a negative error value
263 * @retval MSG_SUCCESS Success in operation
264 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
265 * @retval MSG_ERR_STORAGE_ERROR Storage error
266 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
267 * @retval MSG_ERR_NOT_SUPPORTED Not supported
270 int msg_move_msg_to_folder(msg_handle_t handle, msg_message_id_t msg_id, msg_folder_id_t dest_folder_id);
274 * @brief Moves a message to the other storage.
278 * @privilege %http://tizen.org/privilege/message.write
280 * @param[in] handle The message handle
281 * @param[in] msg_id The message ID of the message to be moved
282 * @param[in] storage_id The ID of the destination storage
284 * @return @c 0 on success,
285 * otherwise a negative error value
287 * @retval MSG_SUCCESS Success in operation
288 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
289 * @retval MSG_ERR_STORAGE_ERROR Storage error
290 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
291 * @retval MSG_ERR_NOT_SUPPORTED Not supported
294 int msg_move_msg_to_storage(msg_handle_t handle, msg_message_id_t msg_id, msg_storage_id_t storage_id);
298 * @brief Gets the number of messages in the specified folder from the database.
302 * @privilege %http://tizen.org/privilege/message.read
304 * @param[in] handle The message handle
305 * @param[in] msg_id The message ID of the message to be counted
306 * @param[out] count_info A pointer to an #MSG_COUNT_INFO_S structure
308 * @return @c 0 on success,
309 * otherwise a negative error value
311 * @retval MSG_SUCCESS Success in operation
312 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
313 * @retval MSG_ERR_STORAGE_ERROR Storage error
314 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
315 * @retval MSG_ERR_NOT_SUPPORTED Not supported
318 int msg_count_message(msg_handle_t handle, msg_folder_id_t folder_id, msg_struct_t count_info);
322 * @brief Gets the number of messages of specific message type.
326 * @privilege %http://tizen.org/privilege/message.read
328 * @param[in] handle The message handle
329 * @param[in] msg_type The message type to be counted
330 * @param[out] msg_count A pointer to the number of message
332 * @return @c 0 on success,
333 * otherwise a negative error value
335 * @retval MSG_SUCCESS Success in operation
336 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
337 * @retval MSG_ERR_STORAGE_ERROR Storage error
338 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
339 * @retval MSG_ERR_NOT_SUPPORTED Not supported
342 int msg_count_msg_by_type(msg_handle_t handle, msg_message_type_t msg_type, int *msg_count);
346 * @brief Gets the number of messages of specific address.
350 * @privilege %http://tizen.org/privilege/message.read
352 * @remarks If @a addr_info is @c NULL, nothing happens.
354 * @param[in] handle The message handle
355 * @param[in] addr_info A pointer to an address list information structure
356 * @param[in] msg_thread_count_list A pointer to an thread count information structure
358 * @return @c 0 on success,
359 * otherwise a negative error value
361 * @retval MSG_SUCCESS Success in operation
362 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
363 * @retval MSG_ERR_STORAGE_ERROR Storage error
364 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
365 * @retval MSG_ERR_NOT_SUPPORTED Not supported
368 int msg_count_msg_by_contact(msg_handle_t handle, const msg_struct_t addr_info, msg_struct_t msg_thread_count_list);
372 * @brief Gets the detail information of a message from the database.
373 * @details This API is used to get the detail information of message by message ID.
377 * @privilege %http://tizen.org/privilege/message.read
379 * @remarks Applications need to call msg_release_struct() to free the memory.
380 * @remarks However, if this function fails, the memory for the message is NOT allocated in this function.
382 * @param[in] handle The Message handle
383 * @param[in] msg_id The ID of the Message to be returned
384 * @param[out] msg A pointer to a #msg_struct_t message structure
385 * @param[in] send_opt A pointer to a #msg_struct_t sending option structure
387 * @return @c 0 on success,
388 * otherwise a negative error value
390 * @retval MSG_SUCCESS Success in operation
391 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
392 * @retval MSG_ERR_STORAGE_ERROR Storage error
393 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
394 * @retval MSG_ERR_NOT_SUPPORTED Not supported
397 int msg_get_message(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_t msg, msg_struct_t send_opt);
401 * @brief Gets the detail information of a message on conversation list.
402 * @details This API is used to get the conversation informations of message by message ID.
406 * @privilege %http://tizen.org/privilege/message.read
408 * @param[in] handle The Message handle
409 * @param[in] msg_id The ID of the Message to be returned
410 * @param[out] conv A pointer to a #msg_struct_t of message structure
412 * @return @c 0 on success,
413 * otherwise a negative error value
415 * @retval MSG_SUCCESS Success in operation
416 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
417 * @retval MSG_ERR_STORAGE_ERROR Storage error
418 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
419 * @retval MSG_ERR_NOT_SUPPORTED Not supported
422 int msg_get_conversation(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_t conv);
426 * @brief Gets the v-object data of message.
427 * @details This API is used to get the v-object data of message by message ID.
431 * @privilege %http://tizen.org/privilege/message.read
433 * @param[in] handle The Message handle
434 * @param[in] msg_id The ID of the Message to be returned
435 * @param[out] encoded_data A pointer to a encoded v-object data of message
437 * @return @c 0 on success,
438 * otherwise a negative error value
440 * @retval MSG_SUCCESS Success in operation
441 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
442 * @retval MSG_ERR_STORAGE_ERROR Storage error
443 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
444 * @retval MSG_ERR_NOT_SUPPORTED Not supported
447 int msg_get_vobject_data(msg_handle_t handle, msg_message_id_t msg_id, void** encoded_data);
451 * @brief Gets the information of all peers to whom messages have been sent or received.
455 * @privilege %http://tizen.org/privilege/message.read
457 * @remarks The memory for a list will be allocated in this function.
458 * @remarks Applications need to call msg_release_thread_view_list() to free the memory.
459 * @remarks However, if this function fails, the memory for a list is NOT allocated in this function.
461 * @param[in] handle The Message handle
462 * @param[in] sourt_rule This indicates a sort type and sort order for querying messages
463 * @param[out] msg_thread_view_list A pointer to an #msg_struct_list_s structure
465 * @return @c 0 on success,
466 * otherwise a negative error value
468 * @retval MSG_SUCCESS Success in operation
469 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
470 * @retval MSG_ERR_STORAGE_ERROR Storage error
471 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
472 * @retval MSG_ERR_NOT_SUPPORTED Not supported
475 int msg_get_thread_view_list(msg_handle_t handle, const msg_struct_t sort_rule, msg_struct_list_s *msg_thread_view_list);
479 * @briefs Gets the common information list of messages with the selected thread ID.
483 * @privilege %http://tizen.org/privilege/message.read
485 * @remarks The memory for a list will be allocated in this function.
486 * @remarks Applications need to call msg_release_conversation_view_list() to free the memory.
487 * @remarks However, if this function is failed, the memory for a list is NOT allocated in this function.
489 * @param[in] hMsgHandle The Message handle
490 * @param[in] thread_id The ID of the thread to be returned
491 * @param[out] msg_conv_view_list A pointer to a structure of conversational message list
493 * @return @c 0 on success,
494 * otherwise a negative error value
496 * @retval MSG_SUCCESS Success in operation
497 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
498 * @retval MSG_ERR_STORAGE_ERROR Storage error
499 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
500 * @retval MSG_ERR_NOT_SUPPORTED Not supported
503 int msg_get_conversation_view_list(msg_handle_t handle, msg_thread_id_t thread_id, msg_struct_list_s *msg_conv_view_list);
507 * @brief Deletes all the Messages Sent/Received from the selected list.
511 * @privilege %http://tizen.org/privilege/message.write
513 * @param[in] handle The Message handle
514 * @param[in] thread_id The ID of the thread to be deleted
515 * @param[in] include_protected_msg Set @c true to delete protected messages,
516 * otherwise @c false to not delete protected messages
518 * @return @c 0 on success,
519 * otherwise a negative error value
521 * @retval MSG_SUCCESS Success in operation
522 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
523 * @retval MSG_ERR_STORAGE_ERROR Storage error
524 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
525 * @retval MSG_ERR_NOT_SUPPORTED Not supported
528 int msg_delete_thread_message_list(msg_handle_t handle, msg_thread_id_t thread_id, bool include_protected_msg);
532 * @brief Adds a new folder.
536 * @privilege %http://tizen.org/privilege/message.write
538 * @param[in] handle The Message handle
539 * @param[in] folder_info A pointer to an #MSG_FOLDER_INFO_S structure
541 * @return @c 0 on success,
542 * otherwise a negative error value
544 * @retval MSG_SUCCESS Success in operation
545 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
546 * @retval MSG_ERR_STORAGE_ERROR Storage error
547 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
548 * @retval MSG_ERR_NOT_SUPPORTED Not supported
551 int msg_add_folder(msg_handle_t handle, const msg_struct_t folder_info);
555 * @brief Updates the folder info.
559 * @privilege %http://tizen.org/privilege/message.write
561 * @param[in] handle The Message handle
562 * @param[in] folder_info A pointer to an #MSG_FOLDER_INFO_S structure
564 * @return @c 0 on success,
565 * otherwise a negative error value
567 * @retval MSG_SUCCESS Success in operation
568 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
569 * @retval MSG_ERR_STORAGE_ERROR Storage error
570 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
571 * @retval MSG_ERR_NOT_SUPPORTED Not supported
574 int msg_update_folder(msg_handle_t handle, const msg_struct_t folder_info);
578 * @brief Deletes an existing folder.
582 * @privilege %http://tizen.org/privilege/message.write
584 * @param[in] handle The Message handle
585 * @param[in] folder_id The ID of the folder to be deleted
587 * @return @c 0 on success,
588 * otherwise a negative error value
590 * @retval MSG_SUCCESS Success in operation
591 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
592 * @retval MSG_ERR_STORAGE_ERROR Storage error
593 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
594 * @retval MSG_ERR_NOT_SUPPORTED Not supported
597 int msg_delete_folder(msg_handle_t handle, msg_folder_id_t folder_id);
601 * @brief Gets the information list of folders.
605 * @privilege %http://tizen.org/privilege/message.read
607 * @param[in] handle The Message handle
608 * @param[out] folder_list A pointer to a #msg_struct_list_s structure
610 * @return @c 0 on success,
611 * otherwise a negative error value
613 * @retval MSG_SUCCESS Success in operation
614 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
615 * @retval MSG_ERR_STORAGE_ERROR Storage error
616 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
617 * @retval MSG_ERR_NOT_SUPPORTED Not supported
620 int msg_get_folder_list(msg_handle_t handle, msg_struct_list_s *folder_list);
624 * @brief Creates the specified number of messages in database.
625 * @details This API is used to generate specified number of messages in the database
629 * @privilege %http://tizen.org/privilege/message.write
631 * @param[in] handle The Message handle
632 * @param[in] msg_type The message type \n
633 * One of enum _MSG_MESSAGE_TYPE_E.
634 * @param[in] folder_id The folder for the test messages
635 * @param[in] num_msg The number of messages
637 * @return @c 0 on success,
638 * otherwise a negative error value
640 * @retval MSG_SUCCESS Success in operation
641 * @retval MSG_ERR_INVALID_MSGHANDLE Parameter is invalid
642 * @retval MSG_ERR_STORAGE_ERROR Storage error
643 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
644 * @retval MSG_ERR_NOT_SUPPORTED Not supported
647 int msg_generate_message(msg_handle_t handle, msg_message_type_t msg_type, msg_folder_id_t folder_id, unsigned int num_msg);
651 * @brief Returns the Message Data to be used by the Quick Panel.
655 * @privilege %http://tizen.org/privilege/message.read
657 * @param[in] handle The Message handle
658 * @param[in] type The type of message that Quick Panel needs
659 * @param[out] msg A pointer to a #msg_struct_t structure
661 * @return @c 0 on success,
662 * otherwise a negative error value
664 * @retval MSG_SUCCESS Success in operation
665 * @retval MSG_ERR_DB_STEP There is no Quick Panel message
666 * @retval MSG_ERR_INVALID_PARAMETER(-9) Parameter is invalid
667 * @retval MSG_ERR_STORAGE_ERROR Storage error
668 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
669 * @retval MSG_ERR_NOT_SUPPORTED Not supported
672 int msg_get_quick_panel_data(msg_handle_t handle, msg_quickpanel_type_t type, msg_struct_t msg);
676 * @brief Resets the Messaging database.
680 * @privilege %http://tizen.org/privilege/message.write
682 * @param[in] handle The Message handle
684 * @return @c 0 on success,
685 * otherwise a negative error value
687 * @retval MSG_SUCCESS Success in operation
688 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
689 * @retval MSG_ERR_STORAGE_ERROR Storage error
690 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
691 * @retval MSG_ERR_NOT_SUPPORTED Not supported
694 int msg_reset_database(msg_handle_t handle);
698 * @brief Gets the total size used for message contents.
702 * @privilege %http://tizen.org/privilege/message.read
704 * @param[in] handle The Message handle
705 * @param[out] memsize A pointer to the size
707 * @return @c 0 on success,
708 * otherwise a negative error value
710 * @retval MSG_SUCCESS Success in operation
711 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
712 * @retval MSG_ERR_STORAGE_ERROR Storage error
713 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
714 * @retval MSG_ERR_NOT_SUPPORTED Not supported
717 int msg_get_mem_size(msg_handle_t handle, unsigned int* memsize);
720 * @brief Backs up messages to storage.
724 * @privilege %http://tizen.org/privilege/message.read
726 * @param[in] handle The Message handle
727 * @param[in] type The backup type
728 * @param[in] backup_filepath The path to backup message
730 * @return @c 0 on success,
731 * otherwise a negative error value
733 * @retval MSG_SUCCESS Success in operation
734 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
735 * @retval MSG_ERR_STORAGE_ERROR Storage error
736 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
737 * @retval MSG_ERR_NOT_SUPPORTED Not supported
740 int msg_backup_message(msg_handle_t handle, msg_message_backup_type_t type, const char *backup_filepath);
744 * @brief Restores messages from backed up messages.
748 * @privilege %http://tizen.org/privilege/message.write
750 * @param[in] handle The Message handle
751 * @param[in] backup_filepath The path to backup message
753 * @return @c 0 on success,
754 * otherwise a negative error value
756 * @retval MSG_SUCCESS Success in operation
757 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
758 * @retval MSG_ERR_STORAGE_ERROR Storage error
759 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
760 * @retval MSG_ERR_NOT_SUPPORTED Not supported
763 int msg_restore_message(msg_handle_t handle, const char *backup_filepath);
767 * @brief Searches messages or addresses for the specified string.
768 * @details This API is used to search messages or addresses from storage.
772 * @privilege %http://tizen.org/privilege/message.read
774 * @param[in] handle The Message handle
775 * @param[in] search_string The string to search
776 * @param[out] msg_thread_view_list A pointer to an #msg_struct_list_s structure
778 * @return @c 0 on success,
779 * otherwise a negative error value
781 * @retval MSG_SUCCESS Success in operation
782 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
783 * @retval MSG_ERR_STORAGE_ERROR Storage error
784 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
785 * @retval MSG_ERR_NOT_SUPPORTED Not supported
788 int msg_search_message_for_thread_view(msg_handle_t handle, const char *search_string, msg_struct_list_s *msg_thread_view_list);
792 * @brief Gets reject message list by phone number.
793 * @details This API is used to get reject message list from storage.
797 * @privilege %http://tizen.org/privilege/message.read
799 * @param[in] handle The Message handle
800 * @param[in] phone_num The string of phone number to find
801 * @param[out] msg_reject_msg_list A pointer to a #msg_struct_list_s structure
803 * @return @c 0 on success,
804 * otherwise a negative error value
806 * @retval MSG_SUCCESS Success in operation
807 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
808 * @retval MSG_ERR_STORAGE_ERROR Storage error
809 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
810 * @retval MSG_ERR_NOT_SUPPORTED Not supported
813 int msg_get_reject_msg_list(msg_handle_t handle, const char* phone_num, msg_struct_list_s *msg_reject_msg_list);
817 * @brief Registers a callback function about the change of storage status to Message handle.
818 * @details This API is used to register a callback function about the change of storage status "msg_storage_change_cb" to Message handle.
822 * @privilege %http://tizen.org/privilege/message.read
824 * @remarks This function MUST be called after Message handle is opened.
826 * @param[in] handle The Message handle
827 * @param[in] cb The function to be called
828 * @param[in] user_param A pointer to user data
830 * @return @c 0 on success,
831 * otherwise a negative error value
833 * @retval MSG_SUCCESS Success in operation
834 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
835 * @retval MSG_ERR_MSGHANDLE_NOT_CONNECTED Message handle is not connected
836 * @retval MSG_ERR_MEMORY_ERROR Memory is error
837 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
838 * @retval MSG_ERR_NOT_SUPPORTED Not supported
841 int msg_reg_storage_change_callback(msg_handle_t handle, msg_storage_change_cb cb, void *user_param);
845 * @brief Gets the report status information of message.
849 * @privilege %http://tizen.org/privilege/message.read
851 * @param[in] handle The Message handle
852 * @param[in] msg_id The ID of the message
853 * @param[out] report_status A pointer to a #msg_struct_list_s structure
855 * @return @c 0 on success,
856 * otherwise a negative error value
858 * @retval MSG_SUCCESS Success in operation
859 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
860 * @retval MSG_ERR_STORAGE_ERROR Storage error
861 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
862 * @retval MSG_ERR_NOT_SUPPORTED Not supported
865 int msg_get_report_status(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_list_s *report_list);
869 * @brief Gets the address list for specific thread ID.
873 * @privilege %http://tizen.org/privilege/message.read
875 * @param[in] handle The Message handle
876 * @param[in] msg_id The ID of the message
877 * @param[out] msg_address_list A pointer to a #msg_struct_list_s structure
879 * @return @c 0 on success,
880 * otherwise a negative error value
882 * @retval MSG_SUCCESS Success in operation
883 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
884 * @retval MSG_ERR_STORAGE_ERROR Storage error
885 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
886 * @retval MSG_ERR_NOT_SUPPORTED Not supported
889 int msg_get_address_list(msg_handle_t handle, msg_thread_id_t thread_id, msg_struct_list_s *msg_address_list);
893 * @brief Gets the thread ID by address.
897 * @privilege %http://tizen.org/privilege/message.read
899 * @param[in] handle The Message handle
900 * @param[in] msg_address_list A pointer to a #msg_struct_list_s structure
901 * @param[out] thread_id The thread ID of the message
903 * @return @c 0 on success,
904 * otherwise a negative error value
906 * @retval MSG_SUCCESS Success in operation
907 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
908 * @retval MSG_ERR_STORAGE_ERROR Storage error
909 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
910 * @retval MSG_ERR_NOT_SUPPORTED Not supported
913 int msg_get_thread_id_by_address(msg_handle_t handle, msg_struct_list_s *msg_address_list, msg_thread_id_t *thread_id);
916 * @brief Gets the thread ID by address.
920 * @privilege %http://tizen.org/privilege/message.read
922 * @param[in] handle The Message handle
923 * @param[in] msg_address_list A pointer to a #msg_list_handle structure
924 * @param[out] thread_id The thread ID of the message
926 * @return @c 0 on success,
927 * otherwise a negative error value
929 * @retval MSG_SUCCESS Success in operation
930 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
931 * @retval MSG_ERR_STORAGE_ERROR Storage error
932 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
933 * @retval MSG_ERR_NOT_SUPPORTED Not supported
936 int msg_get_thread_id_by_address2(msg_handle_t handle, msg_list_handle_t msg_address_list, msg_thread_id_t *thread_id);
941 * @brief Gets the thread information.
945 * @privilege %http://tizen.org/privilege/message.read
947 * @param[in] handle The Message handle
948 * @param[in] thread_id The ID of the thread
949 * @param[out] msg_thread A pointer to a #msg_struct_t structure
951 * @return @c 0 on success,
952 * otherwise a negative error value
954 * @retval MSG_SUCCESS Success in operation
955 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
956 * @retval MSG_ERR_STORAGE_ERROR Storage error
957 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
958 * @retval MSG_ERR_NOT_SUPPORTED Not supported
961 int msg_get_thread(msg_handle_t handle, msg_thread_id_t thread_id, msg_struct_t msg_thread);
965 * @brief Gets the information list of messages.
969 * @privilege %http://tizen.org/privilege/message.read
971 * @param[in] handle The Message handle
972 * @param[in] msg_list_conditions A pointer to a #msg_struct_t structure for getting conditions
973 * @param[out] msg_list A pointer to a #msg_struct_list_s structure
975 * @return @c 0 on success,
976 * otherwise a negative error value
978 * @retval MSG_SUCCESS Success in operation
979 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
980 * @retval MSG_ERR_STORAGE_ERROR Storage error
981 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
982 * @retval MSG_ERR_NOT_SUPPORTED Not supported
985 int msg_get_message_list2(msg_handle_t handle, const msg_struct_t msg_list_conditions, msg_struct_list_s *msg_list);
989 * @brief A function to get media list of a chat room.
993 * @privilege %http://tizen.org/privilege/message.read
995 * @remarks This function MUST be called after Message handle is opened.
997 * @param[in] handle The Message handle
998 * @param[in] thread_id The thread id of conversation to get media list
999 * @param[out] msg_list The media file list in a conversation
1001 * @return @c 0 on success,
1002 * otherwise a negative error value
1004 * @retval MSG_SUCCESS Success in operation
1005 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
1006 * @retval MSG_ERR_CALLBACK_ERROR Callback registration error
1007 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
1010 int msg_get_media_list(msg_handle_t handle, msg_thread_id_t thread_id, msg_list_handle_t *msg_list);
1014 * @brief Adds a new push event.
1018 * @privilege %http://tizen.org/privilege/message.write
1020 * @param[in] handle The Message handle
1021 * @param[in] push_event A pointer to a #msg_struct_t structure for push event
1023 * @return @c 0 on success,
1024 * otherwise a negative error value
1026 * @retval MSG_SUCCESS Success in operation
1027 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
1028 * @retval MSG_ERR_STORAGE_ERROR Storage error
1029 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
1030 * @retval MSG_ERR_NOT_SUPPORTED Not supported
1033 int msg_add_push_event(msg_handle_t handle, const msg_struct_t push_event);
1037 * @brief Deletes a push event.
1041 * @privilege %http://tizen.org/privilege/message.write
1043 * @param[in] handle The Message handle
1044 * @param[in] push_event A pointer to a #msg_struct_t structure for push event
1046 * @return @c 0 on success,
1047 * otherwise a negative error value
1049 * @retval MSG_SUCCESS Success in operation
1050 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
1051 * @retval MSG_ERR_STORAGE_ERROR Storage error
1052 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
1053 * @retval MSG_ERR_NOT_SUPPORTED Not supported
1056 int msg_delete_push_event(msg_handle_t handle, const msg_struct_t push_event);
1060 * @brief Updates a push event.
1064 * @privilege %http://tizen.org/privilege/message.write
1066 * @param[in] handle The Message handle
1067 * @param[in] src_event A pointer to a #msg_struct_t structure for source push event
1068 * @param[in] dst_event A pointer to a #msg_struct_t structure for destination push event
1070 * @return @c 0 on success,
1071 * otherwise a negative error value
1073 * @retval MSG_SUCCESS Success in operation
1074 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
1075 * @retval MSG_ERR_STORAGE_ERROR Storage error
1076 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
1077 * @retval MSG_ERR_NOT_SUPPORTED Not supported
1080 int msg_update_push_event(msg_handle_t handle, const msg_struct_t src_event, const msg_struct_t dst_event);
1084 * @brief Deletes messages by Message ID list from the database.
1088 * @privilege %http://tizen.org/privilege/message.write
1090 * @param[in] handle sThe Message handle
1091 * @param[in] msg_id_list The message ID list to be deleted
1093 * @return @c 0 on success,
1094 * otherwise a negative error value
1096 * @retval MSG_SUCCESS Success in operation
1097 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
1098 * @retval MSG_ERR_STORAGE_ERROR Storage error
1099 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
1100 * @retval MSG_ERR_NOT_SUPPORTED Not supported
1103 int msg_delete_msgs_by_list(msg_handle_t handle, msg_id_list_s *msg_id_list);
1107 * @brief Marks a conversation given by thread ID as read.
1111 * @privilege %http://tizen.org/privilege/message.write
1113 * @param[in] handle The Message handle
1114 * @param[in] thread_id The thread ID to be updated
1116 * @return @c 0 on success,
1117 * otherwise a negative error value
1119 * @retval MSG_SUCCESS Success in operation
1120 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
1121 * @retval MSG_ERR_STORAGE_ERROR Storage error
1122 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
1123 * @retval MSG_ERR_NOT_SUPPORTED Not supported
1126 int msg_set_conversation_to_read(msg_handle_t handle, msg_thread_id_t thread_id);
1130 * @brief Gets a DB records with specified query.
1134 * @privilege %http://tizen.org/privilege/message.read
1136 * @remarks You must release @a db_res using msg_db_free().
1137 * @remarks You should set @a query with SQL query string after 'SELECT'.
1139 * @param[in] handle The Message handle
1140 * @param[in] query The SQL SELECT query
1141 * @param[out] db_res The result of SQL SELECT query
1142 * @param[out] row_count The row count of result
1143 * @param[out] col_count The column count of result
1145 * @return @c 0 on success,
1146 * otherwise a negative error value
1148 * @retval MSG_SUCCESS Success in operation
1149 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
1150 * @retval MSG_ERR_STORAGE_ERROR Storage error
1151 * @retval MSG_ERR_DB_BUSY DB operation is busy
1152 * @retval MSG_ERR_DB_GETTABLE DB get table operation is failed
1153 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
1154 * @retval MSG_ERR_NOT_SUPPORTED Not supported
1156 * @see msg_db_free()
1158 int msg_db_select_with_query(msg_handle_t handle, const char *query, char ***db_res, int *row_count, int *col_count);
1161 * @brief Release memory for result of SQL query.
1165 * @param[in] handle The Message handle
1166 * @param[in] db_res The DB result pointer to release
1168 * @return @c 0 on success,
1169 * otherwise a negative error value
1171 * @retval MSG_SUCCESS Success in operation
1172 * @retval MSG_ERR_INVALID_PARAMETER Parameter is invalid
1173 * @retval MSG_ERR_STORAGE_ERROR Storage error
1174 * @retval MSG_ERR_PERMISSION_DENIED The application does not have the privilege to call this method
1175 * @retval MSG_ERR_NOT_SUPPORTED Not supported
1177 * @see msg_db_select_with_query()
1179 int msg_db_free(msg_handle_t handle, char **db_res);
1188 #endif // MAPI_STORAGE_H