RSA sync with private
[platform/core/messaging/msg-service.git] / plugin / mms_plugin / include / MmsPluginStorage.h
1 /*
2 * Copyright 2012  Samsung Electronics Co., Ltd
3 *
4 * Licensed under the Flora License, Version 1.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.tizenopensource.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 MMS_PLUGIN_STORAGE_H
18 #define MMS_PLUGIN_STORAGE_H
19
20 /*==================================================================================================
21                                                         INCLUDE FILES
22 ==================================================================================================*/
23 #include "MsgStorageTypes.h"
24 #include "MsgSqliteWrapper.h"
25 #include "MmsPluginMessage.h"
26
27
28 /*==================================================================================================
29                                                         CLASS DEFINITIONS
30 ==================================================================================================*/
31 class MmsPluginStorage
32 {
33 public:
34         static MmsPluginStorage *instance();
35
36         MmsPluginStorage();
37         ~MmsPluginStorage();
38
39         void addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData);
40         void getMmsMessage(MmsMsg **pMmsMsg);
41         void getMmsAttrib(msg_message_id_t msgId, MmsMsg *pMmsMsg);
42         msg_error_t getMmsMessageId(msg_message_id_t selectedMsgId, MmsMsg *pMmsMsg);
43         void composeReadReport(MSG_MESSAGE_INFO_S *pMsgInfo);
44
45         int searchMsgId(char *toNumber, char *szMsgID);
46         int getMmsVersion(msg_message_id_t selectedMsgId);
47
48         msg_error_t updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData);
49         msg_error_t updateConfMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
50         msg_error_t updateMmsAttrib(msg_message_id_t msgId, MmsAttrib *attrib, MSG_SUB_TYPE_T msgSubType);
51         msg_error_t updateMmsAttachCount(msg_message_id_t msgId, int count);
52         msg_error_t updateNetStatus(msg_message_id_t msgId, msg_network_status_t netStatus);
53
54         msg_error_t insertDeliveryReport(msg_message_id_t msgId, char *address, MmsMsgMultiStatus *pStatus);
55         msg_error_t insertReadReport(msg_message_id_t msgId, char *address, MmsMsgMultiStatus *pStatus);
56         msg_error_t insertPreviewInfo(int msgId, int type, char *value, int count = 0);
57
58         msg_error_t setReadReportSendStatus(msg_message_id_t msgId, int readReportSendStatus);
59         msg_error_t plgGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg,  MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg);
60         msg_error_t getContentLocation(MSG_MESSAGE_INFO_S *pMsgInfo);
61         msg_error_t getMmsRawFilePath(msg_message_id_t msgId, char *pFilepath);
62         msg_error_t plgGetRestoreMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg, char *filePath);
63         /* reject_msg_support */
64         msg_error_t getTrID(MSG_MESSAGE_INFO_S *pMsgInfo, char *pszTrID, int nBufferLen);
65         /* reject_msg_support */
66
67         msg_error_t updateMsgServerID(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo);
68
69         MmsMsgMultiStatus *getMultiStatus(msg_message_id_t msgId);
70         msg_error_t getMsgText(MMS_MESSAGE_DATA_S *pMmsMsg, char *pMsgText);
71
72 private:
73         msg_error_t addMmsMsgToDB(MmsMsg *pMmsMsg, const MSG_MESSAGE_INFO_S *pMsgInfo, int attachCnt = 0);
74
75         static MmsPluginStorage *pInstance;
76
77         MsgDbHandler dbHandle;
78
79         MmsMsg mmsMsg;
80 };
81
82 #endif //MMS_PLUGIN_STORAGE_H
83