update tizen source
[framework/messaging/msg-service.git] / include / common / MsgStorageTypes.h
1 /*
2 *
3 * Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved.
4 *
5 * This file is part of msg-service.
6 *
7 * Contact: Jaeyun Jeong <jyjeong@samsung.com>
8 *          Sangkoo Kim <sangkoo.kim@samsung.com>
9 *          Seunghwan Lee <sh.cat.lee@samsung.com>
10 *          SoonMin Jung <sm0415.jung@samsung.com>
11 *          Jae-Young Lee <jy4710.lee@samsung.com>
12 *          KeeBum Kim <keebum.kim@samsung.com>
13 *
14 * PROPRIETARY/CONFIDENTIAL
15 *
16 * This software is the confidential and proprietary information of
17 * SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
18 * disclose such Confidential Information and shall use it only in
19 * accordance with the terms of the license agreement you entered
20 * into with SAMSUNG ELECTRONICS.
21 *
22 * SAMSUNG make no representations or warranties about the suitability
23 * of the software, either express or implied, including but not limited
24 * to the implied warranties of merchantability, fitness for a particular
25 * purpose, or non-infringement. SAMSUNG shall not be liable for any
26 * damages suffered by licensee as a result of using, modifying or
27 * distributing this software or its derivatives.
28 *
29 */
30
31 #ifndef MSG_STORAGE_TYPES_H
32 #define MSG_STORAGE_TYPES_H
33
34
35 /**
36  *      @file           MsgStorageTypes.h
37  *      @brief          Defines transport types of messaging framework
38  *      @version        1.0
39  */
40
41
42 /**
43  *      @section                Introduction
44  *      - Introduction : Overview on Messaging Storage Types
45  *      @section                Program
46  *      - Program : Messaging Storage Types Reference
47  */
48
49 /*==================================================================================================
50                                          INCLUDE FILES
51 ==================================================================================================*/
52 #include <time.h>
53
54 #include "MsgTypes.h"
55
56
57 /**
58  *      @ingroup                MESSAGING_FRAMEWORK
59  *      @defgroup       MESSAGING_STORAGE_TYPES Messaging Storage Types
60  *      @{
61  */
62
63 /*==================================================================================================
64                                     DEFINES
65 ==================================================================================================*/
66 #define MAX_FOLDER_NAME_SIZE            20
67 #define MAX_SEGMENT_NUM                 12
68
69
70 /*==================================================================================================
71                                          TYPES
72 ==================================================================================================*/
73
74 /**
75  *      @brief  Represents a folder type. \n
76  *      The values for this type SHOULD be in _MSG_FOLDER_TYPE_E.
77  */
78 typedef unsigned char MSG_FOLDER_TYPE_T;
79
80
81 /**
82  *      @brief  Represents a sort type. \n
83  *      The values for this type SHOULD be in \ref _MSG_SORT_TYPE_E.
84  */
85 typedef unsigned char MSG_SORT_TYPE_T;
86
87
88 /**
89  *      @brief  Represents a Saved SIM message ID.
90  */
91 typedef signed short MSG_SIM_ID_T;
92
93
94 /**
95  *      @brief  Represents a message type for quick panel. \n
96  *      The values for this type SHOULD be in \ref _MSG_QUICKPANEL_TYPE_E.
97  */
98 typedef unsigned char MSG_QUICKPANEL_TYPE_T;
99
100
101 /**
102  *      @brief  Represents a storage change CB type. \n
103  *      The values for this type SHOULD be in \ref _MSG_STORAGE_CHANGE_TYPE_E.
104  */
105 typedef unsigned char MSG_STORAGE_CHANGE_TYPE_T;
106
107
108 /*==================================================================================================
109                                          STRUCTURES
110 ==================================================================================================*/
111 /**
112  *      @brief  Represents the count of read/unread messages.
113  */
114 typedef struct
115 {
116         int     nReadCnt;               /**< The count of read messages */
117         int     nUnreadCnt;             /**< The count of unread messages */
118         int     nSms;                   /**< The count of sms type messages */
119         int     nMms;                   /**< The count of mms type messages */
120 } MSG_COUNT_INFO_S;
121
122
123 /**
124  *      @brief  Represents message thread view information list.
125  */
126 typedef struct
127 {
128         int                                     nCount;                         /**< The count of message thread informatioin */
129         msg_thread_view_t       *msgThreadInfo;         /**< The pointer to message thread informatioin */
130 } MSG_THREAD_VIEW_LIST_S;
131
132
133 /**
134  *      @brief  Represents message information list.
135  */
136 typedef struct
137 {
138         int                                     nCount;                         /**< The count of message informatioin */
139         msg_message_t           *msgInfo;               /**< The pointer to message informatioin */
140 }MSG_LIST_S;
141
142
143 /**
144  *      @brief  Represents message id list.
145  */
146 typedef struct
147 {
148         int                                     nCount;                         /**< The count of message id informatioin */
149         MSG_MESSAGE_ID_T        *msgIdList;                     /**< The pointer to message id informatioin */
150 }MSG_MSGID_LIST_S;
151
152
153 /**
154  *      @brief  Represents a reject message information.
155  */
156 typedef struct
157 {
158         MSG_MESSAGE_ID_T                msgId;                  /**< Indicates the unique message ID. */
159         char                                            msgText[MAX_MSG_TEXT_LEN+1];    /**< Indicates the message text. */
160         time_t                                  displayTime;
161 } MSG_REJECT_MSG_INFO_S;
162
163
164 /**
165  *      @brief  Represents reject message list.
166  */
167 typedef struct
168 {
169         int                                             nCount;                         /**< The count of reject message informatioin */
170         MSG_REJECT_MSG_INFO_S   *rejectMsgInfo;         /**< The pointer to reject message informatioin */
171 }MSG_REJECT_MSG_LIST_S;
172
173
174 /**
175  *      @brief  Represents folder information.
176  */
177 typedef struct
178 {
179         MSG_FOLDER_ID_T         folderId;                       /**< Indicates the unique folder ID. */
180         char                            folderName[MAX_FOLDER_NAME_SIZE+1];     /**< Indicates the name of the folder. */
181         MSG_FOLDER_TYPE_T       folderType;             /**< Indicates the folder type. */
182 } MSG_FOLDER_INFO_S;
183
184
185 /**
186  *      @brief  Represents a folder list.
187  */
188 typedef struct
189 {
190         int                                     nCount;                 /**< The count of folder information */
191         MSG_FOLDER_INFO_S       *folderInfo;            /**< The pointer to folder information */
192 } MSG_FOLDER_LIST_S;
193
194
195 /**
196  *      @brief  Represents contact information.
197  */
198 typedef struct
199 {
200         MSG_CONTACT_ID_T        contactId;                                                      /**< Indicates the unique contact ID. */
201         char                            displayName[MAX_DISPLAY_NAME_LEN+1];    /**< Indicates the display name of contact. */
202         char                            firstName[MAX_DISPLAY_NAME_LEN+1];              /**< Indicates the first name of contact. */
203         char                            lastName[MAX_DISPLAY_NAME_LEN+1];               /**< Indicates the last name of contact. */
204         char                            imagePath[MAX_IMAGE_PATH_LEN+1];                /**< Indicates the image path of contact. */
205 } MSG_CONTACT_INFO_S;
206
207
208 /**
209  *      @brief  Represents a sort rule. \n
210  *      The sort rule structure includes a sort type and a sort order. \n
211  *      Applications can use the sort rule when querying messages.
212  */
213 typedef struct
214 {
215         MSG_SORT_TYPE_T sortType;               /**< Indicates the sort type */
216         bool                                    bAscending;             /**< Indicates the sort order which is ascending or descending */
217 }MSG_SORT_RULE_S;
218
219
220 /**
221  *      @brief  Represents SIM ID List.
222  */
223 typedef struct
224 {
225         unsigned int            count;                                                                          /**< The total number of SIM Msg ID*/
226         MSG_SIM_ID_T    simId[MAX_SEGMENT_NUM];                                         /**< The SIM Msg ID List */
227 } SMS_SIM_ID_LIST_S;
228
229
230 /**
231  *      @brief  Represents recipien list information.
232  */
233 typedef struct
234 {
235         int                                             recipientCnt;
236         MSG_ADDRESS_INFO_S*     recipientAddr;
237 } MSG_RECIPIENTS_LIST_S;
238
239
240 /**
241  *      @brief  Represents search condition values.
242  */
243 typedef struct
244 {
245         MSG_FOLDER_ID_T         folderId;
246         MSG_MESSAGE_TYPE_T              msgType;
247         char                                            *pAddressVal;
248         char                                            *pSearchVal;
249         int                                             reserved;
250 } MSG_SEARCH_CONDITION_S;
251
252
253 /** @brief      Prototype of the function that will be called when the database of message framework is changed.
254  *      Applications SHOULD implement this callback function and register it into Message handle.
255  *      For how to register this callback function, please refer to msg_reg_storage_change_callback.
256  *      The callback function runs in the application process, not in the framework process.
257  *      @param[in]      handle is Message handle.
258  *      @param[in]      user_param is a pointer to user data.
259  *      @return void
260  */
261 typedef void (*msg_storage_change_cb)(MSG_HANDLE_T handle, MSG_STORAGE_CHANGE_TYPE_T storageChangeType, MSG_MSGID_LIST_S *pMsgIdList, void *user_param);
262
263
264 /*==================================================================================================
265                                          ENUMS
266 ==================================================================================================*/
267
268 /**
269  *      @brief  Represents the values of a storage type. \n
270  *      This enum is used as the value of MSG_STORAGE_ID_T.
271  */
272 enum _MSG_STORAGE_ID_E
273 {
274         MSG_STORAGE_UNKNOWN = 0,                /**< Storage Id is unknown. */
275         MSG_STORAGE_PHONE,                      /**< Storage Id is Phone. */
276         MSG_STORAGE_SIM,                                /**< Storage Id is SIM card. */
277 };
278
279
280 /**
281  *      @brief  Represents the values of a storage type. \n
282  *      This enum is used as the value of MSG_FOLDER_ID_T.
283  */
284 enum _MSG_FOLDER_ID_E
285 {
286         MSG_IOSBOX_ID = -1,                     /**< Indicates INBOX, OUTBOX and SENTBOX group folder id. (Only for search option.) */
287         MSG_ALLBOX_ID = 0,                              /**< Indicates INBOX, OUTBOX, SENTBOX and DRAFTBOX group folder id. (Only for search option.) */
288         MSG_INBOX_ID = 1,
289         MSG_OUTBOX_ID = 2,
290         MSG_SENTBOX_ID = 3,
291         MSG_DRAFT_ID = 4,
292         MSG_CBMSGBOX_ID = 5,
293
294         // new folder should be placed here
295
296         MSG_MAX_FOLDER_ID
297 };
298
299
300 /**
301  *      @brief  Represents the values of a folder type. \n
302  *      This enum is used as the value of MSG_FOLDER_TYPE_T.
303  */
304 enum _MSG_FOLDER_TYPE_E
305 {
306         MSG_FOLDER_TYPE_INBOX = 1,              /**< Inbox folder */
307         MSG_FOLDER_TYPE_OUTBOX,         /**< Outbox folder */
308         MSG_FOLDER_TYPE_DRAFT,          /**< Draft folder */
309         MSG_FOLDER_TYPE_USER_DEF                /**< Folder which is created by a user */
310 };
311
312
313 /**
314  *      @brief  Represents the values of a sort type. \n
315  *      This enum is used as the value of MSG_SORT_TYPE_T.
316  */
317 enum _MSG_SORT_TYPE_E
318 {
319         MSG_SORT_BY_UNKNOWN = 0,                        /**< Unknown sort type */
320         MSG_SORT_BY_DISPLAY_FROM,               /**< Sort by display from */
321         MSG_SORT_BY_DISPLAY_TO,                 /**< Sort by display to */
322         MSG_SORT_BY_DISPLAY_TIME,                       /**< Sort by display time */
323         MSG_SORT_BY_MSG_TYPE,                           /**< Sort by msg type */
324         MSG_SORT_BY_READ_STATUS,                        /**< Sort by read status */
325         MSG_SORT_BY_STORAGE_TYPE,               /**< Sort by storage type */
326         MSG_SORT_BY_THREAD_NAME,                        /**< Sort by name for thread view*/
327         MSG_SORT_BY_THREAD_DATE,                        /**< Sort by date for thread view*/
328         MSG_SORT_BY_THREAD_COUNT,               /**< Sort by count for thread view*/
329 };
330
331
332 /**
333  *      @brief  Represents the values of a message type for quick panel. \n
334  *      This enum is used as the value of MSG_QUICKPANEL_TYPE_T.
335  */
336 enum _MSG_QUICKPANEL_TYPE_E
337 {
338         MSG_QUICKPANEL_SMS = 0,
339         MSG_QUICKPANEL_MMS,
340         MSG_QUICKPANEL_DELIVER_REP,
341         MSG_QUICKPANEL_READ_REP,
342         MSG_QUICKPANEL_VOICEMAIL,
343         MSG_QUICKPANEL_MMS_NOTI,
344 };
345
346 /**
347  *      @}
348  */
349 enum _MSG_COUNT_LIMIT_MAILBOX_TYPE_E
350 {
351         MSG_COUNT_LIMIT_INBOX_TYPE,
352         MSG_COUNT_LIMIT_OUTBOX_TYPE,
353         MSG_COUNT_LIMIT_SENTBOX_TYPE,
354         MSG_COUNT_LIMIT_DRAFTBOX_TYPE,
355         MSG_COUNT_LIMIT_CBMSGBOX_TYPE,
356         MSG_COUNT_LIMIT_MAILBOX_TYPE_MAX,
357 };
358
359 enum _MSG_COUNT_LIMIT_MSG_TYPE_E
360 {
361         MSG_COUNT_LIMIT_SMS_TYPE,
362         MSG_COUNT_LIMIT_MMS_TYPE,
363         MSG_COUNT_LIMIT_CB_TYPE,
364         MSG_COUNT_LIMIT_WAPPUSH_TYPE,
365         MSG_COUNT_LIMIT_PROVISION_TYPE,
366         MSG_COUNT_LIMIT_MSG_TYPE_MAX,
367 };
368
369 enum _MSG_STORAGE_CHANGE_TYPE_E
370 {
371         // msg data
372         MSG_STORAGE_CHANGE_INSERT = 1,
373         MSG_STORAGE_CHANGE_UPDATE,
374         MSG_STORAGE_CHANGE_DELETE,
375
376         // thread data
377         MSG_STORAGE_CHANGE_CONTACT,
378 };
379
380 #endif // MSG_STORAGE_TYPES_H
381