modify msg-service to support dpm feature
[platform/core/messaging/msg-service.git] / include / framework / MsgStorageHandler.h
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
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, msg_id_list_s**result_id_list);
55
56 msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S* pSendOptInfo);
57 msg_error_t MsgStoRestoreMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo);
58 msg_error_t MsgStoUpdateMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S* pSendOptInfo);
59 msg_error_t MsgStoUpdateReadStatus(msg_message_id_t MsgId, bool bRead);
60 msg_error_t MsgStoUpdateThreadReadStatus(msg_thread_id_t ThreadId, msg_id_list_s *pMsgIdList);
61 msg_error_t MsgStoUpdateProtectedStatus(msg_message_id_t MsgId, bool bProtected);
62 msg_error_t MsgStoDeleteMessage(msg_message_id_t MsgId, bool bCheckIndication);
63 msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t FolderId, bool bOnlyDB, msg_id_list_s *pMsgIdList);
64 msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList);
65 msg_error_t MsgStoMoveMessageToFolder(msg_message_id_t MsgId, msg_folder_id_t DestFolderId);
66 msg_error_t MsgStoMoveMessageToStorage(const msg_message_id_t MsgId, const msg_storage_id_t DestStorageId);
67 msg_error_t MsgStoCountMessage(msg_folder_id_t FolderId, MSG_COUNT_INFO_S *pCountInfo);
68 msg_error_t MsgStoCountMsgByType(const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCount);
69 msg_error_t MsgStoGetMessage(msg_message_id_t MsgId, MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S* pSendOptInfo);
70 msg_error_t MsgStoAddSyncMLMessage(MSG_MESSAGE_INFO_S *pMsgInfo, int ExtId, int PinCode);
71 msg_error_t MsgStoGetMsgType(msg_message_id_t msgId, MSG_MESSAGE_TYPE_S* pMsgType);
72 msg_error_t MsgStoGetText(msg_message_id_t MsgId, char *pSubject, char *pMsgText);
73 msg_error_t MsgStoGetQuickPanelData(msg_quickpanel_type_t Type, MSG_MESSAGE_INFO_S *pMsg);
74 msg_error_t MsgStoDeleteThreadMessageList(msg_thread_id_t ThreadId, bool bIncludeProtect, msg_id_list_s *pMsgIdList);
75 msg_error_t MsgStoSetTempAddressTable(MSG_ADDRESS_INFO_S *pAddrInfo, int addr_cnt);
76 msg_error_t MsgStoCountMsgByContact(const MSG_THREAD_LIST_INDEX_S *pAddrInfo, MSG_THREAD_COUNT_INFO_S *pThreadCountInfo);
77 msg_error_t MsgStoGetSmsReportStatus(msg_message_id_t msgId, int *count, MSG_REPORT_STATUS_INFO_S **pReportStatus);
78 msg_error_t MsgStoGetMmsReportStatus(msg_message_id_t msgId, int *count, MSG_REPORT_STATUS_INFO_S **pReportStatus);
79 msg_error_t MsgStoGetThreadIdByAddress(const MSG_MESSAGE_INFO_S *pMsg, msg_thread_id_t *pThreadId);
80 msg_error_t MsgStoGetThreadUnreadCnt(msg_thread_id_t ThreadId, int *cnt);
81
82 msg_error_t MsgStoGetThreadInfo(msg_thread_id_t threadId, MSG_THREAD_VIEW_S *pThreadInfo);
83
84 /* Folder */
85 msg_error_t MsgStoAddFolder(const MSG_FOLDER_INFO_S *pFolderInfo);
86 msg_error_t MsgStoUpdateFolder(const MSG_FOLDER_INFO_S *pFolderInfo);
87 msg_error_t MsgStoDeleteFolder(msg_folder_id_t FolderId);
88 msg_error_t MsgStoGetFolderList(msg_struct_list_s *pFolderList);
89
90 /* Filter */
91 msg_error_t MsgStoAddFilter(const MSG_FILTER_S *pFilter);
92 msg_error_t MsgStoUpdateFilter(const MSG_FILTER_S *pFilter);
93 msg_error_t MsgStoDeleteFilter(msg_filter_id_t FilterId);
94 msg_error_t MsgStoGetFilterList(msg_struct_list_s *pFilterList);
95 msg_error_t MsgStoSetFilterActivation(msg_filter_id_t filterId, bool bActive);
96
97 /* Sim Operation related Functions */
98 msg_error_t MsgStoClearSimMessageInDB();
99
100 /* Internal Function */
101 msg_error_t MsgStoGetSmsSendOpt(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S* pSendOpt);
102 msg_error_t MsgStoGetMmsSendOpt(msg_message_id_t MsgId, MSG_SENDINGOPT_INFO_S* pSendOpt);
103
104 /* SyncML Msg */
105 msg_error_t MsgStoGetSyncMLExtId(msg_message_id_t msgId, int *extId);
106 bool MsgStoCheckSyncMLMsgInThread(msg_thread_id_t threadId);
107
108 msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg);
109 msg_error_t MsgStoGetContentLocation(MSG_MESSAGE_INFO_S* pMsgInfo);
110 msg_error_t MsgStoSetReadReportSendStatus(msg_message_id_t msgId, int readReportSendStatus);
111 msg_error_t MsgStoGetReadReportSendStatus(msg_message_id_t msgId, int *pReadReportSendStatus);
112
113 /* For MMS - will be removed */
114 msg_error_t MsgStoGetOrgAddressList(MSG_MESSAGE_INFO_S *pMsg);
115 msg_error_t MsgStoGetSubject(msg_message_id_t MsgId, char* pSubject);
116 msg_error_t MsgStoGetRecipientList(msg_message_id_t msgId, MSG_RECIPIENTS_LIST_S *pRecipientList);
117 msg_error_t MsgStoGetReadStatus(msg_message_id_t MsgId, bool *pReadStatus);
118 msg_error_t MsgStoGetAddrInfo(msg_message_id_t MsgId, MSG_ADDRESS_INFO_S *pAddrInfo);
119
120
121 msg_error_t MsgStoResetNetworkStatus();
122 #if 0
123 msg_error_t MsgStoResetCBMessage();
124 #endif
125 msg_error_t MsgStoCleanAbnormalMmsData();
126 msg_error_t MsgStoCheckReadReportStatus(msg_message_id_t msgId);
127 msg_error_t MsgStoAutoDeleteConversation(msg_thread_id_t threadId, msg_id_list_s *msgIdList);
128
129 msg_error_t MsgStoAddPushEvent(MSG_PUSH_EVENT_INFO_S* pPushEvent);
130 msg_error_t MsgStoDeletePushEvent(MSG_PUSH_EVENT_INFO_S* pPushEvent);
131 msg_error_t MsgStoUpdatePushEvent(MSG_PUSH_EVENT_INFO_S* pSrc, MSG_PUSH_EVENT_INFO_S* pDst);
132
133 msg_message_id_t MsgStoAddSimMessage(MSG_MESSAGE_INFO_S *pMsg, int *simIdList, int listSize);
134 msg_error_t MsgStoGetFailedMessage(int **failed_msg_list, int *count);
135
136 msg_error_t MsgStoGetReplaceMsgId(MSG_MESSAGE_INFO_S *pMsgInfo);
137 msg_error_t MsgStoAddWAPMsg(MSG_MESSAGE_INFO_S *pMsgInfo);
138 msg_error_t MsgStoAddCOWAPMsg(MSG_MESSAGE_INFO_S *pMsgInfo);
139 msg_error_t MsgStoAddCBMsg(MSG_MESSAGE_INFO_S *pMsgInfo);
140 msg_error_t MsgStoCheckPushMsgValidation(MSG_PUSH_MESSAGE_S *pPushMsg, bool *pbProceed);
141 msg_error_t MsgStoUpdateAllAddress();
142 #ifdef FEATURE_SMS_CDMA
143 msg_error_t MsgCheckUniqueness(bool bInsert, msg_message_id_t msgId, MSG_UNIQUE_INDEX_S *p_msg);
144 #endif
145 msg_error_t MsgStoUpdateIMSI(int sim_idx);
146 msg_error_t MsgStoUpdateDPMRestrictedStatus(MSG_MAIN_TYPE_T msgType);
147
148 #endif /* MSG_STORAGE_HANDLER_H */
149