Modify flora license version.
[platform/core/messaging/msg-service.git] / include / framework / MsgStorageHandler.h
1 /*
2 * Copyright 2012-2013  Samsung Electronics Co., Ltd
3 *
4 * Licensed under the Flora License, Version 1.1 (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
7 *
8 *    http://floralicense.org/license/
9 *
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.
15 */
16
17 #ifndef MSG_STORAGE_HANDLER_H
18 #define MSG_STORAGE_HANDLER_H
19
20 /*==================================================================================================
21                                          INCLUDE FILES
22 ==================================================================================================*/
23 #include "MsgStorageTypes.h"
24 #include "MsgSettingTypes.h"
25 #include "MsgFilterTypes.h"
26 #include "MsgMmsTypes.h"
27 #include "MsgTransportTypes.h"
28 #include "MsgInternalTypes.h"
29
30 /*==================================================================================================
31                                      FUNCTION PROTOTYPES
32 ==================================================================================================*/
33 msg_error_t MsgStoConnectDB();
34 msg_error_t MsgStoDisconnectDB();
35
36 msg_error_t MsgStoInitDB(bool bSimChanged);
37
38 msg_error_t MsgCreateConversationTable();
39 msg_error_t MsgCreateAddressTable();
40 msg_error_t MsgCreateFolderTable();
41 msg_error_t MsgCreateMsgTable();
42 msg_error_t MsgCreateSimMessageTable();
43 msg_error_t MsgCreateWAPMessageTable();
44 msg_error_t MsgCreateCBMessageTable();
45 msg_error_t MsgCreateSyncMLMessageTable();
46 msg_error_t MsgCreateSmsSendOptTable();
47 msg_error_t MsgCreateFilterTable();
48 msg_error_t MsgCreateMmsTable();
49 msg_error_t MsgAddDefaultFolders();
50 msg_error_t MsgAddDefaultAddress();
51 msg_error_t MsgStoResetDatabase();
52
53 msg_error_t MsgStoBackupMessage(msg_message_backup_type_t type, const char *filepath);
54 msg_error_t MsgStoRestoreMessage(const char *filepath);
55
56 msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S* pSendOptInfo);
57 msg_error_t MsgStoUpdateMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S* pSendOptInfo);
58 msg_error_t MsgStoUpdateReadStatus(msg_message_id_t MsgId, bool bRead);
59 msg_error_t MsgStoUpdateThreadReadStatus(msg_thread_id_t ThreadId);
60 msg_error_t MsgStoUpdateProtectedStatus(msg_message_id_t MsgId, bool bProtected);
61 msg_error_t MsgStoDeleteMessage(msg_message_id_t MsgId, bool bCheckIndication);
62 msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t FolderId, bool bOnlyDB, msg_id_list_s *pMsgIdList);
63 msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList);
64 msg_error_t MsgStoMoveMessageToFolder(msg_message_id_t MsgId, msg_folder_id_t DestFolderId);
65 msg_error_t MsgStoMoveMessageToStorage(const msg_message_id_t MsgId, const msg_storage_id_t DestStorageId);
66 msg_error_t MsgStoCountMessage(msg_folder_id_t FolderId, MSG_COUNT_INFO_S *pCountInfo);
67 msg_error_t MsgStoCountMsgByType(const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCount);
68 msg_error_t MsgStoGetMessage(msg_message_id_t MsgId, MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S* pSendOptInfo);
69 msg_error_t MsgStoGetConversationViewItem(msg_message_id_t msgId, MSG_CONVERSATION_VIEW_S *pConv);
70 msg_error_t MsgStoGetFolderViewList(msg_folder_id_t FolderId, const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pMsgFolderViewList);
71 msg_error_t MsgStoAddSyncMLMessage(MSG_MESSAGE_INFO_S *pMsgInfo, int ExtId, int PinCode);
72 msg_error_t MsgStoGetMsgType(msg_message_id_t msgId, MSG_MESSAGE_TYPE_S* pMsgType);
73 msg_error_t MsgStoGetText(msg_message_id_t MsgId, char *pSubject, char *pMsgText);
74 msg_error_t MsgStoGetQuickPanelData(msg_quickpanel_type_t Type, MSG_MESSAGE_INFO_S *pMsg);
75 msg_error_t MsgStoGetThreadViewList(const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pThreadViewList);
76 msg_error_t MsgStoGetConversationViewList(msg_thread_id_t ThreadId, msg_struct_list_s *pConvViewList);
77 msg_error_t MsgStoDeleteThreadMessageList(msg_thread_id_t ThreadId, bool bIncludeProtect, msg_id_list_s *pMsgIdList);
78 msg_error_t MsgStoCountMsgByContact(const MSG_THREAD_LIST_INDEX_S *pAddrInfo, MSG_THREAD_COUNT_INFO_S *pThreadCountInfo);
79 msg_error_t MsgStoSearchMessage(const char *pSearchString, msg_struct_list_s *pThreadViewList);
80 msg_error_t MsgStoSearchMessage(const MSG_SEARCH_CONDITION_S *pSearchCon, int offset, int limit, msg_struct_list_s *pMsgList);
81 msg_error_t MsgStoGetRejectMsgList(const char *pNumber, msg_struct_list_s *pRejectMsgList);
82 msg_error_t MsgStoGetReportStatus(msg_message_id_t msgId, int *count, MSG_REPORT_STATUS_INFO_S **pReportStatus);
83 msg_error_t MsgStoGetThreadIdByAddress(const MSG_MESSAGE_INFO_S *pMsg, msg_thread_id_t *pThreadId);
84 msg_error_t MsgStoGetThreadUnreadCnt(msg_thread_id_t ThreadId, int *cnt);
85
86 msg_error_t MsgStoGetAddressList(const msg_thread_id_t threadId, msg_struct_list_s *pAddrList);
87 msg_error_t MsgStoGetThreadInfo(msg_thread_id_t threadId, MSG_THREAD_VIEW_S *pThreadInfo);
88 msg_error_t MsgStoGetMessageList(msg_folder_id_t folderId, msg_thread_id_t threadId, msg_message_type_t msgType, msg_storage_id_t storageId, msg_struct_list_s *pMsgList);
89
90 // Folder
91 msg_error_t MsgStoAddFolder(const MSG_FOLDER_INFO_S *pFolderInfo);
92 msg_error_t MsgStoUpdateFolder(const MSG_FOLDER_INFO_S *pFolderInfo);
93 msg_error_t MsgStoDeleteFolder(msg_folder_id_t FolderId);
94 msg_error_t MsgStoGetFolderList(msg_struct_list_s *pFolderList);
95
96 // Filter
97 msg_error_t MsgStoAddFilter(const MSG_FILTER_S *pFilter);
98 msg_error_t MsgStoUpdateFilter(const MSG_FILTER_S *pFilter);
99 msg_error_t MsgStoDeleteFilter(msg_filter_id_t FilterId);
100 msg_error_t MsgStoGetFilterList(msg_struct_list_s *pFilterList);
101 msg_error_t MsgStoSetFilterActivation(msg_filter_id_t filterId, bool bActive);
102
103 // Sim Operation related Functions
104 msg_error_t MsgInitSimMessage(MSG_SIM_STATUS_T SimStatus);
105 msg_error_t MsgStoClearSimMessageInDB();
106
107 // Internal Function
108 msg_error_t MsgMakeSortRule(const MSG_SORT_RULE_S *pSortRule, char *pSqlSort);
109 msg_error_t MsgStoGetSmsSendOpt(msg_message_id_t MsgId, MSG_SENDINGOPT_INFO_S* pSendOpt);
110 msg_error_t MsgStoGetMmsSendOpt(msg_message_id_t MsgId, MSG_SENDINGOPT_INFO_S* pSendOpt);
111
112 // SyncML Msg
113 msg_error_t MsgStoGetSyncMLExtId(msg_message_id_t msgId, int *extId);
114 bool MsgStoCheckSyncMLMsgInThread(msg_thread_id_t threadId);
115
116 msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg);
117 msg_error_t MsgStoGetContentLocation(MSG_MESSAGE_INFO_S* pMsgInfo);
118 msg_error_t MsgStoSetReadReportSendStatus(msg_message_id_t msgId, int readReportSendStatus);
119
120
121 ///////////////////////////////////////////////////////////////////////////////////
122 // For MMS - will be removed
123 msg_error_t MsgStoGetOrgAddressList(MSG_MESSAGE_INFO_S *pMsg);
124 msg_error_t MsgStoGetSubject(msg_message_id_t MsgId, char* pSubject);
125 msg_error_t MsgStoGetRecipientList(msg_message_id_t msgId, MSG_RECIPIENTS_LIST_S *pRecipientList);
126 msg_error_t MsgStoGetReadStatus(msg_message_id_t MsgId, bool *pReadStatus);
127 msg_error_t MsgStoGetAddrInfo(msg_message_id_t MsgId, MSG_ADDRESS_INFO_S *pAddrInfo);
128
129 ///////////////////////////////////////////////////////////////////////////////////
130
131 msg_error_t MsgStoResetNetworkStatus();
132 msg_error_t MsgStoCleanAbnormalMmsData();
133 msg_error_t MsgStoCheckReadReportStatus(msg_message_id_t msgId);
134
135 msg_error_t MsgStoAddPushEvent(MSG_PUSH_EVENT_INFO_S* pPushEvent);
136 msg_error_t MsgStoDeletePushEvent(MSG_PUSH_EVENT_INFO_S* pPushEvent);
137 msg_error_t MsgStoUpdatePushEvent(MSG_PUSH_EVENT_INFO_S* pSrc, MSG_PUSH_EVENT_INFO_S* pDst);
138
139 #endif // MSG_STORAGE_HANDLER_H
140