4 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
23 /******************************************************************************
24 * File : email-storage.h
25 * Desc : email-core Storage Library Header
30 * 2006.07.28 : created
31 *****************************************************************************/
32 #ifndef __EMAIL_STORAGE_H__
33 #define __EMAIL_STORAGE_H__
38 #endif /* __cplusplus */
42 #include "email-types.h"
43 #include "email-core-tasks.h"
44 #include "email-internal-types.h"
46 #define FIRST_ACCOUNT_ID 1
49 #ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
50 #define QUERY_SIZE 8192
51 #define MAX_INTEGER_LENGTH 5 /* 32767 -> 5 bytes */
56 unsigned long server_mail_id;
59 #endif /* __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__ */
64 /* Account information */
65 int account_id; /* Account id */
66 char *account_name; /* Account name */
67 char *logo_icon_path; /* Account logo icon path */
68 int account_svc_id; /* Specifies id from account-svc */
69 int sync_status; /* Sync Status. SYNC_STATUS_FINISHED, SYNC_STATUS_SYNCING, SYNC_STATUS_HAVE_NEW_MAILS */
70 int sync_disabled; /* If this attriube is set as true, email-service will not synchronize this account. */
71 int default_mail_slot_size;
73 void *user_data; /* binary user data */
74 int user_data_length; /* user data length */
76 /* User information */
77 char *user_display_name; /* User's display name */
78 char *user_email_address; /* User's email address */
79 char *reply_to_address; /* Email address for reply */
80 char *return_address; /* Email address for error from server*/
82 /* Configuration for incoming server */
83 email_account_server_t incoming_server_type; /* Incoming server type */
84 char *incoming_server_address; /* Incoming server address */
85 int incoming_server_port_number; /* Incoming server port number */
86 char *incoming_server_user_name; /* Incoming server user name */
87 char *incoming_server_password; /* Incoming server password */
88 int incoming_server_secure_connection; /* Does incoming server requires secured connection? */
90 /* Options for incoming server */
91 email_imap4_retrieval_mode_t retrieval_mode; /* Retrieval mode : EMAIL_IMAP4_RETRIEVAL_MODE_NEW or EMAIL_IMAP4_RETRIEVAL_MODE_ALL */
92 int keep_mails_on_pop_server_after_download; /* Keep mails on POP server after download */
93 int check_interval; /* Specifies the interval for checking new mail periodically */
94 int auto_download_size; /* Specifies the size for auto download in bytes. -1 means entire mails body */
96 /* Configuration for outgoing server */
97 email_account_server_t outgoing_server_type;
98 char *outgoing_server_address;
99 int outgoing_server_port_number;
100 char *outgoing_server_user_name;
101 char *outgoing_server_password;
102 int outgoing_server_secure_connection; /* Does outgoing server requires secured connection? */
103 int outgoing_server_need_authentication; /* Does outgoing server requires authentication? */
104 int outgoing_server_use_same_authenticator; /* Use same authenticator for outgoing server */ /* flag2 */
106 /* Options for outgoing server */
107 email_option_t options;
109 /* Authentication Options */
110 int pop_before_smtp; /* POP before SMTP Authentication */
111 int incoming_server_requires_apop; /* APOP authentication */
114 email_smime_type smime_type; /* Sepeifies the smime type 0=Normal 1=Clear signed 2=encrypted 3=Signed + encrypted */
115 char *certificate_path; /* Sepeifies the certificate path of private*/
116 email_cipher_type cipher_type; /* Sepeifies the encryption algorithm*/
117 email_digest_type digest_type; /* Sepeifies the digest algorithm*/
118 } emstorage_account_tbl_t;
127 int expiration_month;
129 char *issue_organization_name;
134 } emstorage_certificate_tbl_t;
138 int account_id; /* MUST BE '0' : currently, only global rule supported. */
140 int type; /* from/subject/body */
142 int action_type; /* move/block/delete */
143 int target_mailbox_id; /* destination mailbox */
144 int flag1; /* for rule ON/OFF */
145 int flag2; /* For rule type INCLUDE/Exactly SAME AS */
146 } emstorage_rule_tbl_t;
148 /* mail_box_tbl table entity */
155 email_mailbox_type_e mailbox_type;
157 int modifiable_yn; /* whether mailbox is able to be deleted/modified */
158 int unread_count; /* Removed. 16-Dec-2010, count unread mails at the moment it is required. not store in the DB */
159 int total_mail_count_on_local; /* Specifies the total number of mails in the mailbox in the local DB. count unread mails at the moment it is required. not store in the DB */
160 int total_mail_count_on_server; /* Specifies the total number of mails in the mailbox in the mail server */
161 int has_archived_mails;
164 time_t last_sync_time; /* The last synchronization time */
165 int deleted_flag; /* whether mailbox is deleted */
166 } emstorage_mailbox_tbl_t;
168 /* mail_read_uid_tbl table entity */
174 char *mailbox_name; /* server mailbox */
175 char *s_uid; /* uid on server */
176 int data1; /* rfc822 size */
178 int flag; /* rule id */
180 } emstorage_read_mail_uid_tbl_t;
191 int server_mail_status;
192 char *server_mailbox_name;
193 char *server_mail_id;
195 int reference_mail_id;
196 char *full_address_from;
197 char *full_address_reply;
198 char *full_address_to;
199 char *full_address_cc;
200 char *full_address_bcc;
201 char *full_address_return;
202 char *email_address_sender;
203 char *email_address_recipient;
205 char *alias_recipient;
206 int body_download_status;
207 char *file_path_plain;
208 char *file_path_html;
209 char *file_path_mime_entity;
211 char flags_seen_field;
212 char flags_deleted_field;
213 char flags_flagged_field;
214 char flags_answered_field;
215 char flags_recent_field;
216 char flags_draft_field;
217 char flags_forwarded_field;
219 email_mail_priority_t priority;
220 email_mail_status_t save_status;
222 email_mail_report_t report_status;
223 int attachment_count;
224 int inline_content_count;
226 int thread_item_count;
228 email_mail_type_t meeting_request_status;
229 email_message_class message_class;
230 email_digest_type digest_type;
231 email_smime_type smime_type;
232 } emstorage_mail_tbl_t;
234 /* mail_attachment_tbl entity */
238 char *attachment_name;
239 char *attachment_path;
244 int attachment_save_status; /* 1 : existing, 0 : not existing */
245 int attachment_drm_type; /* 0 : none, 1 : object, 2 : rights, 3 : dcf */
246 int attachment_drm_method; /* 0 : none, 1 : FL, 2 : CD, 3 : SSD, 4 : SD */
247 int attachment_inline_content_status; /* 1 : inline content , 0 : not inline content */
248 char *attachment_mime_type;
249 #ifdef __ATTACHMENT_OPTI__
253 } emstorage_attachment_tbl_t;
257 RETRIEVE_ALL = 1, /* mail */
258 RETRIEVE_ENVELOPE, /* mail envelope */
259 RETRIEVE_SUMMARY, /* mail summary */
260 RETRIEVE_FIELDS_FOR_DELETE, /* account_id, mail_id, server_mail_yn, server_mailbox, server_mail_id */
261 RETRIEVE_ACCOUNT, /* account_id */
262 RETRIEVE_FLAG, /* mailbox, flag1, thread_id */
263 RETRIEVE_ID, /* mail_id */
264 RETRIEVE_ADDRESS, /* mail_id, contact_info */
265 } emstorage_mail_field_type_t;
267 typedef struct _emstorage_search_filter_t {
270 struct _emstorage_search_filter_t *next;
271 } emstorage_search_filter_t;
274 EMAIL_CREATE_DB_NORMAL = 0,
275 EMAIL_CREATE_DB_CHECK,
276 } emstorage_create_db_type_t;
279 /*****************************************************************************
281 *****************************************************************************/
282 #define MAX_PW_FILE_NAME_LENGTH 128 /* password file name for secure storage */
284 #ifdef __FEATURE_LOCAL_ACTIVITY__
288 ACTIVITY_FETCHIMAPFOLDER = 1, /* Fetch Mail server Activity */
289 ACTIVITY_DELETEMAIL, /* Delete Mail Activity */
290 ACTIVITY_MODIFYFLAG, /* Modify Mail flag Activity */
291 ACTIVITY_MODIFYSEENFLAG, /* Modify Mail seen flag Activity */
292 ACTIVITY_MOVEMAIL, /* Move Mail Activity */
293 ACTIVITY_DELETEALLMAIL, /* Delete All Mails activity */
294 ACTIVITY_COPYMAIL, /* Copy Mail Activity */
295 ACTIVITY_SAVEMAIL, /* Save Mail activity */
296 ACTIVITY_DELETEMAIL_SEND, /* New Delete Mail Activity added to be processed by send thread */
301 * emstorage_activity_tbl_t - Email Local activity Structure
306 int activity_id; /* Activity ID */
307 int account_id; /* Account ID */
308 int mail_id; /* Mail ID */
309 int activity_type; /* Local Activity Type */
310 char *server_mailid; /* Server Mail ID or Mailbox name */
311 char *src_mbox; /* Source Mailbox in case of mail_move */
312 char *dest_mbox; /* Destination Mailbox name in case of Mail move operation */
314 } emstorage_activity_tbl_t;
318 INTERNAL_FUNC int emstorage_shm_file_init(const char *shm_file_name);
321 /************** Database Management ***************/
324 * description : open db and register busy handler
326 INTERNAL_FUNC int em_db_open(sqlite3 **sqlite_handle, int *err_code);
331 * description : open db and set global variable sqlite_emmb
335 INTERNAL_FUNC sqlite3* emstorage_db_open(int *err_code);
340 * description : close db with global variable sqlite_emmb
344 INTERNAL_FUNC int emstorage_db_close(int *err_code);
349 * description : initialize storage manager
353 INTERNAL_FUNC int emstorage_open(int *err_code);
358 * description : cleanup storage manager
362 INTERNAL_FUNC int emstorage_close(int *err_code);
365 * emstorage_create_table
367 * description : create account/address table in database.
371 INTERNAL_FUNC int emstorage_create_table(emstorage_create_db_type_t type, int *err_code);
375 * Check whether there is the same account information in the db
377 * @param[in] account account that
378 * @param[in] transaction If the argument is true, engine commits transaction or executes rollback.
379 * @param[out] err_code Error code.
381 * @return This function returns true if there is no duplicated account. returns false and set error code if there are duplicated accounts or error
383 INTERNAL_FUNC int emstorage_check_duplicated_account(email_account_t *account, int transaction, int *err_code);
387 * Get number of accounts from account table.
389 * @param[out] count The number of accounts is saved here.
390 * @param[in] transaction If the argument is true, engine commits transaction or executes rollback.
392 * @return This function returns 0 on success or error code on failure.
394 INTERNAL_FUNC int emstorage_get_account_count(int *count, int transaction, int *err_code);
397 * Get account from account table.
399 * @param[in, out] select_num Upon entry, the argument contains the number of accounts to select.
400 Upon exit, it is set to the number of accounts to been selected.
401 * @param[out] account_list The selected accounts is saved here. this pointer must be freed after being used.
402 * @param[in] transaction If the argument is true, engine commits transaction or executes rollback.
404 * @return This function returns 0 on success or error code on failure.
406 INTERNAL_FUNC int emstorage_get_account_list(int *select_num, emstorage_account_tbl_t **account_list, int transaction, int with_password, int *err_code);
409 * emstorage_get_account_by_name
411 * description : get account from account table by account name
413 * db : database pointer
414 * account_id : account id
415 * pulloption : option to specify fetching full or partial data
416 * account : buffer to hold selected account
417 * this buffer must be free after it has been used.
420 /* sowmya.kr, 281209 Adding signature to options in email_account_t changes */
422 INTERNAL_FUNC int emstorage_get_account_by_id(int account_id, int pulloption, emstorage_account_tbl_t **account, int transaction, int *err_code);
426 * emstorage_get_password_length_of_account
428 * description: get password length of account.
430 * account_id : account id
431 * password_length : password length
435 INTERNAL_FUNC int emstorage_get_password_length_of_account(int account_id, int *password_length, int* err_code);
438 * emstorage_update_account
440 * description : change a account from account table
442 * account_id : account id
443 * account : buffer to hold selected account
446 INTERNAL_FUNC int emstorage_update_account(int account_id, emstorage_account_tbl_t *account, int transaction, int *err_code);
449 INTERNAL_FUNC int emstorage_set_field_of_accounts_with_integer_value(int account_id, char *field_name, int value, int transaction);
452 * emstorage_get_sync_status_of_account
454 * description : get a sync status field from account table
456 * account_id : account id
457 * result_sync_status : sync status value
461 INTERNAL_FUNC int emstorage_get_sync_status_of_account(int account_id, int *result_sync_status,int *err_code);
464 * emstorage_update_sync_status_of_account
466 * description : update a sync status field from account table
468 * account_id : account id
469 * set_operator : set operater. refer email_set_type_t
470 * sync_status : sync status value
474 INTERNAL_FUNC int emstorage_update_sync_status_of_account(int account_id, email_set_type_t set_operator, int sync_status, int transaction, int *err_code);
477 * emstorage_add_account
479 * description : add a account to account table
483 INTERNAL_FUNC int emstorage_add_account(emstorage_account_tbl_t *account, int transaction, int *err_code);
486 * emstorage_delete_account
488 * description : delete a account from account table
490 * db : database pointer
491 * account_id : account id to be deteted
494 INTERNAL_FUNC int emstorage_delete_account(int account_id, int transaction, int *err_code);
497 * emstorage_free_account
499 * description : free local accout memory
501 * account_list : double pointer
502 * count : count of local account
505 INTERNAL_FUNC int emstorage_free_account(emstorage_account_tbl_t **account_list, int count, int *err_code);
508 /************** Mailbox(Local box And Imap mailbox) Management ******************/
511 * emstorage_get_mailbox_count
513 * description : get number of mailbox from local mailbox table
515 * db : database pointer
516 * count : number of accounts
519 INTERNAL_FUNC int emstorage_get_mailbox_count(int account_id, int local_yn, int *count, int transaction, int *err_code);
522 * emstorage_get_mailbox
524 * description : get local mailbox from local mailbox table
526 * db : database pointer
527 * sort_type : in - sorting type.
528 * select_num : in - number of selected account
529 * out - number to been selected
530 * mailbox_list : buffer to hold selected account
531 * this buffer must be free after it has been used.
534 INTERNAL_FUNC int emstorage_get_mailbox_list(int account_id, int local_yn, email_mailbox_sort_type_t sort_type, int *select_num, emstorage_mailbox_tbl_t **mailbox_list, int transaction, int *err_code);
537 * emstorage_get_child_mailbox_list
539 * description : get child mailbox list from given mailbox
541 * account_id : in - account id
542 * parent_mailbox_name : in - parent_mailbox_name to fetch child list
543 * local_yn - in - local mailbox or not
544 * select_num - out : count of mailboxes
545 * mailbox_list - out : list of mailboxes
546 * err_code - out : error code, if any
550 INTERNAL_FUNC int emstorage_get_child_mailbox_list(int account_id, char *parent_mailbox_name, int *select_num, emstorage_mailbox_tbl_t **mailbox_list, int transaction, int *err_code);
553 * emstorage_get_mailbox_by_name
555 * description : get local mailbox from local mailbox table by mailbox name
557 * db : database pointer
558 * mailbox_name : mailbox name
559 * mailbox : buffer to hold selected local mailbox
560 * this buffer must be free after it has been used.
563 INTERNAL_FUNC int emstorage_get_mailbox_by_name(int account_id, int local_yn, char *mailbox_name, emstorage_mailbox_tbl_t **mailbox, int transaction, int *err_code);
564 INTERNAL_FUNC int emstorage_get_mailbox_by_mailbox_type(int account_id, email_mailbox_type_e mailbox_type, emstorage_mailbox_tbl_t **mailbox, int transaction, int *err_code);
565 INTERNAL_FUNC int emstorage_get_mailbox_by_id(int input_mailbox_id, emstorage_mailbox_tbl_t** output_mailbox);
566 INTERNAL_FUNC int emstorage_get_mailbox_list_ex(int account_id, int local_yn, int with_count, int *select_num, emstorage_mailbox_tbl_t **mailbox_list, int transaction, int *err_code);
567 INTERNAL_FUNC int emstorage_get_mailbox_id_by_mailbox_type(int account_id, email_mailbox_type_e mailbox_type, int *mailbox_id, int transaction, int *err_code);
568 INTERNAL_FUNC int emstorage_get_mailbox_name_by_mailbox_type(int account_id, email_mailbox_type_e mailbox_type, char **mailbox_name, int transaction, int *err_code);
569 INTERNAL_FUNC int emstorage_update_mailbox_modifiable_yn(int account_id, int local_yn, char *mailbox_name, int modifiable_yn, int transaction, int *err_code);
570 INTERNAL_FUNC int emstorage_update_mailbox_total_count(int account_id, int input_mailbox_id, int total_count_on_server, int transaction, int *err_code);
574 * emstorage_update_mailbox
576 * description : change a account from account table
578 * db : database pointer
579 * mailbox_name : mailbox name
580 * mailbox : buffer to hold selected local mailbox
583 INTERNAL_FUNC int emstorage_update_mailbox(int account_id, int local_yn, int input_mailbox_id, emstorage_mailbox_tbl_t *mailbox, int transaction, int *err_code);
586 * emstorage_update_mailbox_type
588 * description : change a mailbox from mailbox tbl
592 INTERNAL_FUNC int emstorage_update_mailbox_type(int account_id, int local_yn, char *mailbox_name, email_mailbox_type_e new_mailbox_type, int transaction, int *err_code);
595 * emstorage_set_local_mailbox
597 * description : change 'local' field on mailbox table.
601 INTERNAL_FUNC int emstorage_set_local_mailbox(int input_mailbox_id, int input_is_local_mailbox, int transaction);
603 INTERNAL_FUNC int emstorage_set_field_of_mailbox_with_integer_value(int input_account_id, int *input_mailbox_id_array, int input_mailbox_id_count, char *input_field_name, int input_value, int transaction);
606 * emstorage_add_mailbox
608 * description : add a local mailbox to local mailbox table
612 INTERNAL_FUNC int emstorage_add_mailbox(emstorage_mailbox_tbl_t *mailbox, int transaction, int *err_code);
615 * emstorage_delete_mailbox
617 * description : delete a local mailbox from local mailbox table
619 * db : database pointer
620 * mailbox_name : mailbox name of record to be deteted
623 INTERNAL_FUNC int emstorage_delete_mailbox(int account_id, int local_yn, int input_mailbox_id, int transaction, int *err_code);
625 INTERNAL_FUNC int emstorage_rename_mailbox(int input_mailbox_id, char *input_new_mailbox_path, char *input_new_mailbox_alias, int input_transaction);
626 INTERNAL_FUNC int emstorage_get_overflowed_mail_id_list(int account_id, int input_mailbox_id, int mail_slot_size, int **mail_id_list, int *mail_id_count, int transaction, int *err_code);
627 INTERNAL_FUNC int emstorage_set_mail_slot_size(int account_id, int mailbox_id, int new_slot_size, int transaction, int *err_code);
629 INTERNAL_FUNC int emstorage_set_all_mailbox_modifiable_yn(int account_id, int modifiable_yn, int transaction, int *err_code);
630 INTERNAL_FUNC int emstorage_get_mailbox_by_modifiable_yn(int account_id, int modifiable_yn, int *select_num, emstorage_mailbox_tbl_t **mailbox_list, int transaction, int *err_code);
631 INTERNAL_FUNC int emstorage_stamp_last_sync_time_of_mailbox(int input_mailbox_id, int input_transaction);
634 * emstorage_free_mailbox
636 * description : free local mailbox memory
638 * mailbox_list : double pointer
639 * count : count of local mailbox
642 INTERNAL_FUNC int emstorage_free_mailbox(emstorage_mailbox_tbl_t **mailbox_list, int count, int *err_code);
645 /************** Read Mail UID Management ******************/
649 INTERNAL_FUNC int emstorage_get_count_read_mail_uid(int account_id, char *mailbox_name, int *count, int transaction, int *err_code);
653 * emstorage_check_read_mail_uid
655 * description : check that this uid exists in uid table
657 * db : database pointer
658 * mailbox_name : mailbox name
659 * s_uid : uid string to be checked
660 * exist : variable to hold checking result. (0 : not exist, 1 : exist)
663 INTERNAL_FUNC int emstorage_check_read_mail_uid(int account_id, char *mailbox_name, char *uid, int *exist, int transaction, int *err_code);
666 * emstorage_get_read_mail_size
668 * description : get mail size from read mail uid
670 * db : database pointer
671 * mailbox_id : local mailbox id
672 * local_uid : mail uid of local mailbox
673 * mailbox_name : server mailbox name
674 * uid : mail uid string of server mail
675 * read_mail_uid : variable to hold read mail uid information
678 INTERNAL_FUNC int emstorage_get_downloaded_list(int account_id, int mailbox_id, emstorage_read_mail_uid_tbl_t **read_mail_uid, int *count, int transaction, int *err_code);
680 INTERNAL_FUNC int emstorage_get_downloaded_mail(int mail_id, emstorage_mail_tbl_t **mail, int transaction, int *err_code);
683 * emstorage_get_read_mail_size
685 * description : get mail size from read mail uid
687 * db : database pointer
688 * mailbox_name : mailbox name
689 * s_uid : mail uid string
690 * size : variable to hold mail size
693 INTERNAL_FUNC int emstorage_get_downloaded_mail_size(int account_id, char *local_mbox, int local_uid, char *mailbox_name, char *uid, int *mail_size, int transaction, int *err_code);
696 * emstorage_add_downloaded_mail
698 * description : add read mail uid
702 INTERNAL_FUNC int emstorage_add_downloaded_mail(emstorage_read_mail_uid_tbl_t *read_mail_uid, int transaction, int *err_code);
705 * emstorage_change_read_mail_uid
707 * description : modify read mail uid
711 INTERNAL_FUNC int emstorage_change_read_mail_uid(int account_id, int local_mailbox_id, int local_uid, char *mailbox_name, char *uid,
712 emstorage_read_mail_uid_tbl_t *read_mail_uid, int transaction, int *err_code);
715 * emstorage_remove_downloaded_mail
721 INTERNAL_FUNC int emstorage_remove_downloaded_mail(int account_id, char *mailbox_name, char *uid, int transaction, int *err_code);
724 INTERNAL_FUNC int emstorage_update_read_mail_uid(int mail_id, char *new_server_uid, char *mbox_name, int *err_code);
729 INTERNAL_FUNC int emstorage_free_read_mail_uid(emstorage_read_mail_uid_tbl_t **read_mail_uid, int count, int *err_code);
733 /************** Rules(Filtering) Management ******************/
736 * emstorage_get_rule_count
738 * description : get number of rules from rule table
740 * db : database pointer
741 * count : number of accounts
744 INTERNAL_FUNC int emstorage_get_rule_count(int account_id, int *count, int transaction, int *err_code);
749 * description : get rules from rule table
751 * db : database pointer
752 * start_idx : the first index to be selected (min : 0)
753 * select_num : in - number of selected account
754 * out - number to been selected
755 * is_completed : is completed ?
758 INTERNAL_FUNC int emstorage_get_rule(int account_id, int type, int start_idx, int *select_num, int *is_completed, emstorage_rule_tbl_t **rule_list, int transaction, int *err_code);
763 * description : get rules from rule table
767 INTERNAL_FUNC int emstorage_get_rule_by_id(int account_id, int rule_id, emstorage_rule_tbl_t **rule, int transaction, int *err_code);
770 * emstorage_change_rule
772 * description : change a account from account table
774 * db : database pointer
775 * mailbox_name : mailbox name
776 * rule : buffer to hold selected rule
779 INTERNAL_FUNC int emstorage_change_rule(int account_id, int rule_id, emstorage_rule_tbl_t *rule, int transaction, int *err_code);
782 * emstorage_find_rule
784 * description : find a rule already exists
788 INTERNAL_FUNC int emstorage_find_rule(emstorage_rule_tbl_t *rule, int transaction, int *err_code);
793 * description : add a rule to rule table
797 INTERNAL_FUNC int emstorage_add_rule(emstorage_rule_tbl_t *rule, int transaction, int *err_code);
800 * emstorage_delete_rule
802 * description : delete a rule from rule table
804 * db : database pointer
805 * rule : rule to be deteted
808 INTERNAL_FUNC int emstorage_delete_rule(int account_id, int rule_id, int transaction, int *err_code);
811 * emstorage_free_rule
813 * description : free rule memory
815 * count : count of rule
818 INTERNAL_FUNC int emstorage_free_rule(emstorage_rule_tbl_t **rule_list, int count, int *err_code);
821 /************** Mail Management ******************/
824 * emstorage_get_mail_count
826 * description : get mail total and unseen count from mail table
828 * total : total count
829 * unseen : unseen mail count
832 INTERNAL_FUNC int emstorage_get_mail_count(int account_id, const char *mailbox, int *total, int *unseen, int transaction, int *err_code);
835 * emstorage_get_mail_by_id
837 * description : get mail from mail table by mail id
840 * mail : double pointer to hold mail
843 INTERNAL_FUNC int emstorage_get_mail_by_id(int mail_id, emstorage_mail_tbl_t **mail, int transaction, int *err_code);
848 * description : get mail from mail table by mail sequence
850 * account_id : account id
851 * mailbox : mailbox name
852 * mail_no : mail sequence number (not mail id)
853 * mail : double pointer to hold mail
856 INTERNAL_FUNC int emstorage_get_mail_field_by_id(int mail_id, int type, emstorage_mail_tbl_t **mail, int transaction, int *err_code);
859 * emstorage_get_mail_field_by_multiple_mail_id
871 INTERNAL_FUNC int emstorage_get_mail_field_by_multiple_mail_id(int mail_ids[], int number_of_mails, int type, emstorage_mail_tbl_t** mail, int transaction, int *err_code);
874 * emstorage_query_mail_count
876 * description : query mail count
878 INTERNAL_FUNC int emstorage_query_mail_count(const char *input_conditional_clause, int input_transaction, int *output_total_mail_count, int *output_unseen_mail_count);
881 * emstorage_query_mail_list
883 * description : query mail id list
885 INTERNAL_FUNC int emstorage_query_mail_id_list(const char *input_conditional_clause, int input_transaction, int **output_mail_id_list, int *output_mail_id_count);
888 * emstorage_query_mail_list
890 * description : query mail list information
892 INTERNAL_FUNC int emstorage_query_mail_list(const char *conditional_clause, int transaction, email_mail_list_item_t** result_mail_list, int *result_count, int *err_code);
895 * emstorage_query_mail_tbl
897 * description : query mail table information
899 INTERNAL_FUNC int emstorage_query_mail_tbl(const char *conditional_clause, int transaction, emstorage_mail_tbl_t** result_mail_tbl, int *result_count, int *err_code);
902 * emstorage_query_mailbox_tbl
904 * description : query mail box table information
907 INTERNAL_FUNC int emstorage_query_mailbox_tbl(const char *input_conditional_clause, const char *input_ordering_clause, int input_get_mail_count, int input_transaction, emstorage_mailbox_tbl_t **output_mailbox_list, int *output_mailbox_count);
910 * emstorage_get_mail_list
912 * description : search mail list information
915 INTERNAL_FUNC int emstorage_get_mail_list(int account_id, int mailbox_id, email_email_address_list_t* addr_list, int thread_id, int start_index, int limit_count, int search_type, const char *search_value, email_sort_type_t sorting, int transaction, email_mail_list_item_t** mail_list, int *result_count, int *err_code);
917 * emstorage_get_mails
919 * description : search mail list information
921 INTERNAL_FUNC int emstorage_get_mails(int account_id, int mailbox_id, email_email_address_list_t* addr_list, int thread_id, int start_index, int limit_count, email_sort_type_t sorting, int transaction, emstorage_mail_tbl_t** mail_list, int *result_count, int *err_code);
922 INTERNAL_FUNC int emstorage_get_searched_mail_list(int account_id, int mailbox_id, int thread_id, int search_type, const char *search_value, int start_index, int limit_count, email_sort_type_t sorting, int transaction, email_mail_list_item_t **mail_list, int *result_count, int *err_code);
923 INTERNAL_FUNC int emstorage_get_maildata_by_servermailid(int account_id, char *server_mail_id, emstorage_mail_tbl_t **mail, int transaction, int *err_code);
924 INTERNAL_FUNC int emstorage_get_latest_unread_mailid(int account_id, int *mail_id, int *err_code);
928 * Prepare mail search.
930 * @param[in] search Specifies the searching condition.
931 * @param[in] account_id Specifies the account id. if 0, all accounts.
932 * @param[in] mailbox Specifies the mailbox name. if NULL, all mailboxes.
933 * @param[in] sorting Specifies the sorting condition.
934 * @param[out] search_handle the searching handle is saved here.
935 * @param[out] searched the result count is saved here.
937 * @return This function returns 0 on success or error code on failure.
939 INTERNAL_FUNC int emstorage_mail_search_start(emstorage_search_filter_t *search, int account_id, char *mailbox, int sorting, int *search_handle, int *searched, int transaction, int *err_code);
942 * emstorage_mail_search_result
944 * description : retrieve mail as searching result
946 * search_handle : handle to been gotten from emstorage_mail_search_start
947 * mail : double pointer to hold mail
950 INTERNAL_FUNC int emstorage_mail_search_result(int search_handle, emstorage_mail_field_type_t type, void **data, int transaction, int *err_code);
953 * emstorage_mail_search_end
955 * description : finish searching
957 * search_handle : handle to be finished
960 INTERNAL_FUNC int emstorage_mail_search_end(int search_handle, int transaction, int *err_code);
965 * emstorage_set_field_of_mails_with_integer_value
967 * description : update a filed of mail
969 * account_id : Specifies the account id.
970 * mail_ids : mail id list to be changed
971 * mail_ids_count : count of mail list
972 * field_name : specified field name
973 * value : specified value
976 INTERNAL_FUNC int emstorage_set_field_of_mails_with_integer_value(int account_id, int mail_ids[], int mail_ids_count, char *field_name, int value, int transaction, int *err_code);
979 * emstorage_change_mail_field
981 * description : update partial mail data
984 * type : changing type
985 * mail : mail pointer
988 INTERNAL_FUNC int emstorage_change_mail_field(int mail_id, email_mail_change_type_t type, emstorage_mail_tbl_t *mail, int transaction, int *err_code);
991 * emstorage_increase_mail_id
993 * description : increase unique mail id
995 * mail_id : pointer to store the unique id
1000 * emstorage_change_mail
1002 * description : update mail
1004 * mail_id : mail id to be changed
1005 * mail : mail pointer
1008 INTERNAL_FUNC int emstorage_change_mail(int mail_id, emstorage_mail_tbl_t *mail, int transaction, int *err_code);
1009 INTERNAL_FUNC int emstorage_clean_save_status(int save_status, int *err_code);
1010 INTERNAL_FUNC int emstorage_update_server_uid(char *old_server_uid, char *new_server_uid, int *err_code);
1011 INTERNAL_FUNC int emstorage_modify_mailbox_of_mails(char *old_mailbox_name, char *new_mailbox_name, int transaction, int *err_code);
1013 INTERNAL_FUNC int emstorage_increase_mail_id(int *mail_id, int transaction, int *err_code);
1016 * emstorage_add_mail
1018 * description : add a mail to mail table
1020 * mail : mail pointer to be inserted
1021 * get_id : must get uinque id in function
1024 INTERNAL_FUNC int emstorage_add_mail(emstorage_mail_tbl_t *mail, int get_id, int transaction, int *err_code);
1027 * emstorage_move_multiple_mails_on_db
1032 * input_mailbox_id :
1039 INTERNAL_FUNC int emstorage_move_multiple_mails_on_db(int account_id, int input_mailbox_id, int mail_ids[], int number_of_mails, int transaction, int *err_code);
1042 * emstorage_delete_mail
1044 * description : delete mail from mail table
1046 * mail_id : mail id to be deleted. if 0, all mail will be deleted.
1047 * from_server : delete mail on server.
1050 INTERNAL_FUNC int emstorage_delete_mail(int mail_id, int from_server, int transaction, int *err_code);
1053 * emstorage_delete_mail_by_account
1055 * description : delete mail from mail table by account id
1057 * account_id : account id.
1060 INTERNAL_FUNC int emstorage_delete_mail_by_account(int account_id, int transaction, int *err_code);
1063 * emstorage_delete_mail
1065 * description : delete mail from mail table
1067 * account_id : account id.
1068 * mailbox : mail box
1071 INTERNAL_FUNC int emstorage_delete_mail_by_mailbox(int account_id, char *mailbox, int transaction, int *err_code);
1074 * emstorage_delete_multiple_mails
1084 INTERNAL_FUNC int emstorage_delete_multiple_mails(int mail_ids[], int number_of_mails, int transaction, int *err_code);
1087 * emstorage_free_mail
1089 * description : free memory
1091 * mail_list : mail array
1092 * count : the number of array element
1095 INTERNAL_FUNC int emstorage_free_mail(emstorage_mail_tbl_t **mail_list, int count, int *err_code);
1098 * emstorage_get_attachment
1100 * description : get attachment from attachment table
1103 * no : attachment sequence
1104 * attachment : double pointer to hold attachment data
1107 INTERNAL_FUNC int emstorage_get_attachment_count(int mail_id, int *count, int transaction, int *err_code);
1110 * emstorage_get_attachment_list
1112 * description : get attachment list from attachment table
1114 * input_mail_id : mail id
1115 * input_transaction : transaction option
1116 * attachment_list : result attachment list
1117 * output_attachment_count : result attachment count
1118 * return : This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR__XXX) on failure.
1121 INTERNAL_FUNC int emstorage_get_attachment_list(int input_mail_id, int input_transaction, emstorage_attachment_tbl_t** output_attachment_list, int *output_attachment_count);
1125 * emstorage_get_attachment
1127 * description : get attachment from attachment table
1129 * attachment_id : attachment id
1130 * attachment : double pointer to hold attachment data
1133 INTERNAL_FUNC int emstorage_get_attachment(int attachment_id, emstorage_attachment_tbl_t **attachment, int transaction, int *err_code);
1136 * emstorage_get_attachment
1138 * description : get nth-attachment from attachment table
1141 * nth : index of the desired attachment (min : 1)
1142 * attachment : double pointer to hold attachment data
1145 INTERNAL_FUNC int emstorage_get_attachment_nth(int mail_id, int nth, emstorage_attachment_tbl_t **attachment, int transaction, int *err_code);
1148 * emstorage_change_attachment_field
1150 * description : update partial mail attachment data
1153 * type : changing type
1154 * mail : mail pointer
1157 INTERNAL_FUNC int emstorage_change_attachment_field(int mail_id, email_mail_change_type_t type, emstorage_attachment_tbl_t *attachment, int transaction, int *err_code);
1159 /* Get new attachment id */
1161 * emstorage_get_new_attachment_no
1163 * description : Get new attachment id
1165 * attachment_no : attachment id pointer
1169 INTERNAL_FUNC int emstorage_get_new_attachment_no(int *attachment_no, int *err_code);
1171 /* insert attachment to mail attachment table */
1173 * emstorage_add_attachment
1175 * description : insert a attachment to attachment table
1177 * attachment : attachment pointer
1180 INTERNAL_FUNC int emstorage_add_attachment(emstorage_attachment_tbl_t *attachment, int iscopy, int transaction, int *err_code);
1183 INTERNAL_FUNC int emstorage_update_attachment(emstorage_attachment_tbl_t *attachment, int transaction, int *err_code);
1185 /* delete a mail from mail table */
1187 * emstorage_delete_attachment_on_db
1189 * description : delete attachment from attachment table
1191 * attachment_id : attachment id
1194 INTERNAL_FUNC int emstorage_delete_attachment_on_db(int attachment_id, int transaction, int *err_code);
1196 INTERNAL_FUNC int emstorage_delete_all_attachments_of_mail(int mail_id, int transaction, int *err_code);
1199 * emstorage_delete_attachment_all_on_db
1201 * description : delete attachment from mail table
1203 * account_id : account id.
1204 * mailbox : mail box
1207 INTERNAL_FUNC int emstorage_delete_attachment_all_on_db(int account_id, char *mailbox, int transaction, int *err_code);
1210 * emstorage_free_attachment
1212 * description : free memory
1214 * mail_list : mail array
1215 * count : the number of array element
1218 INTERNAL_FUNC int emstorage_free_attachment(emstorage_attachment_tbl_t **attachment_list, int count, int *err_code);
1220 INTERNAL_FUNC int emstorage_is_mailbox_full(int account_id, email_mailbox_t *mailbox, int *result, int *err_code);
1222 INTERNAL_FUNC int emstorage_get_max_mail_count();
1224 INTERNAL_FUNC int emstorage_mail_get_total_diskspace_usage(unsigned long *total_usage, int transaction, int *err_code);
1228 * begin a transaction.
1230 * @param[in] d1 Reserved.
1231 * @param[in] d2 Reserved.
1232 * @remarks emstorage_commit_transaction or emstorage_commit_transaction must be called after this function.
1233 * @return This function returns 0 on success or error code on failure.
1236 INTERNAL_FUNC int emstorage_begin_transaction(void *d1, void *d2, int *err_code);
1239 * commit a transaction.
1241 * @param[in] d1 Reserved.
1242 * @param[in] d2 Reserved.
1244 * @return This function returns 0 on success or error code on failure.
1246 INTERNAL_FUNC int emstorage_commit_transaction(void *d1, void *d2, int *err_code);
1251 * @param[in] d1 Reserved.
1252 * @param[in] d2 Reserved.
1254 * @return This function returns 0 on success or error code on failure.
1256 INTERNAL_FUNC int emstorage_rollback_transaction(void *d1, void *d2, int *err_code);
1259 * clear mail data from db.
1261 * @param[in] transaction
1262 * @param[out] err_code
1264 * @return This function returns 0 on success or error code on failure.
1267 INTERNAL_FUNC int emstorage_clear_mail_data(int transaction, int *err_code);
1270 INTERNAL_FUNC char *emstorage_make_directory_path_from_file_path(char *file_name);
1273 * emstorage_get_save_name
1275 * description : get file name for saving data
1277 * account_id : account id
1279 * atch_id : attachment id
1281 * name_buf : buffer to hold file name. (MAX : 512Bytes)
1284 INTERNAL_FUNC int emstorage_get_save_name(int account_id, int mail_id, int atch_id, char *fname, char *name_buf, int *err_code);
1287 * emstorage_get_dele_name
1289 * description : get a name for deleting contents from file system.
1291 * account_id : account id
1293 * atch_id : attachment id
1295 * name_buf : buffer to hold file name. (MAX : 512Bytes)
1298 INTERNAL_FUNC int emstorage_get_dele_name(int account_id, int mail_id, int atch_id, char *fname, char *name_buf, int *err_code);
1301 * emstorage_create_dir
1303 * description : create directory
1305 * name_buf : buffer to hold file name. (MAX : 512Bytes)
1306 * no : attachment no.
1309 INTERNAL_FUNC int emstorage_create_dir(int account_id, int mail_id, int atch_id, int *err_code);
1312 * emstorage_copy_file
1314 * description : copy a attachment file
1316 * src_file : source file
1317 * dst_file : destination file
1320 INTERNAL_FUNC int emstorage_copy_file(char *src_file, char *dst_file, int sync_file, int *err_code);
1323 * emstorage_move_file
1325 * description : move a file
1327 * src_file : source file
1328 * dst_file : destination file
1331 INTERNAL_FUNC int emstorage_move_file(char *src_file, char *dst_file, int sync_status, int *err_code);
1334 * emstorage_move_file
1336 * description : delete a file
1338 * src_file : file to be deleted
1341 INTERNAL_FUNC int emstorage_delete_file(char *src_file, int *err_code);
1344 * emstorage_delete_dir
1346 * description : delete a directory
1348 * src_dir : directory to be deleted
1351 INTERNAL_FUNC int emstorage_delete_dir(char *src_dir, int *err_code);
1355 INTERNAL_FUNC void emstorage_flush_db_cache();
1356 INTERNAL_FUNC int emstorage_test(int mail_id, int account_id, char *full_address_to, char *full_address_cc, char *full_address_bcc, int *err_code);
1358 INTERNAL_FUNC int emstorage_get_sender_list(int account_id, const char *mailbox_name, int search_type, const char *search_value, email_sort_type_t sorting, email_sender_list_t** sender_list, int *sender_count, int *err_code);
1359 INTERNAL_FUNC int emstorage_free_sender_list(email_sender_list_t **sender_list, int count);
1361 /* Handling Thread mail */
1362 INTERNAL_FUNC int emstorage_get_thread_information(int thread_id, emstorage_mail_tbl_t **mail_table_data, int transaction, int *err_code);
1363 INTERNAL_FUNC int emstorage_get_thread_id_of_thread_mails(emstorage_mail_tbl_t *mail_table_data, int *thread_id, int *result_latest_mail_id_in_thread, int *thread_item_count);
1364 INTERNAL_FUNC int emstorage_get_thread_id_by_mail_id(int mail_id, int *thread_id, int *err_code);
1365 INTERNAL_FUNC int emstorage_update_latest_thread_mail(int account_id, int thread_id, int latest_mail_id, int thread_item_count, int transaction, int *err_code);
1367 #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
1369 #define BULK_PARTIAL_BODY_DOWNLOAD_COUNT 10
1372 ACCOUNT_IDX_MAIL_PARTIAL_BODY_ACTIVITY_TBL = 0,
1373 MAIL_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL,
1374 SERVER_MAIL_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL,
1375 ACTIVITY_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL,
1376 ACTIVITY_TYPE_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL,
1377 MAILBOX_ID_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL,
1378 MAILBOX_NAME_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL,
1382 INTERNAL_FUNC int emstorage_get_pbd_activity_data(int account_id, int input_mailbox_id, email_event_partial_body_thd** event_start, int *count, int transaction, int *err_code);
1383 INTERNAL_FUNC int emstorage_add_pbd_activity(email_event_partial_body_thd *local_activity, int *activity_id, int transaction, int *err_code);
1384 INTERNAL_FUNC int emstorage_get_pbd_mailbox_list(int account_id, int **mailbox_list, int *count, int transaction, int *err_code);
1385 INTERNAL_FUNC int emstorage_get_pbd_account_list(int **account_list, int *count, int transaction, int *err_code);
1386 INTERNAL_FUNC int emstorage_get_pbd_activity_count(int *activity_id_count, int transaction, int *err_code);
1387 INTERNAL_FUNC int emstorage_delete_full_pbd_activity_data(int account_id, int transaction, int *err_code);
1388 INTERNAL_FUNC int emstorage_delete_pbd_activity(int account_id, int mail_id, int activity_id, int transaction, int *err_code);
1389 INTERNAL_FUNC int emstorage_get_mailbox_pbd_activity_count(int account_id, int input_mailbox_id, int *activity_count, int transaction, int *err_code);
1390 INTERNAL_FUNC int emstorage_update_pbd_activity(char *old_server_uid, char *new_server_uid, char *mbox_name, int *err_code);
1391 INTERNAL_FUNC int emstorage_create_file(char *buf, size_t file_size, char *dst_file, int *err_code);
1395 INTERNAL_FUNC int emstorage_free_address_info_list(email_address_info_list_t **address_info_list);
1397 INTERNAL_FUNC void emstorage_create_dir_if_delete();
1399 #ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
1400 INTERNAL_FUNC int emstorage_update_read_mail_uid_by_server_uid(char *old_server_uid, char *new_server_uid, char *mbox_name, int *err_code);
1403 * @fn emstorage_get_id_set_from_mail_ids(int mail_ids[], int mail_id_count, email_id_set_t **server_uids, int *id_set_count, int *err_code);
1404 * Prepare an array of mail_id and corresponding server mail id.
1406 *@author h.gahlaut@samsung.com
1407 * @param[in] mail_ids Specifies the comma separated string of mail_ids. Maximaum size of string should be less than or equal to (QUERY_SIZE - 88)
1408 * where 88 is the length of fixed keywords including ending null character in the QUERY to be formed
1409 * @param[out] idset Returns the array of mail_id and corresponding server_mail_id sorted by server_mail_ids in ascending order
1410 * @param[out] id_set_count Returns the no. of cells in idset array i.e. no. of sets of mail_ids and server_mail_ids
1411 * @param[out] err_code Returns the error code.
1412 * @remarks An Example of Query to be exexuted in this API :
1413 * SELECT local_uid, s_uid from mail_read_mail_uid_tbl where local_uid in (12, 13, 56, 78);
1414 * @return This function returns true on success or false on failure.
1417 INTERNAL_FUNC int emstorage_get_id_set_from_mail_ids(char *mail_ids, email_id_set_t **idset, int *id_set_count, int *err_code);
1422 * @fn emstorage_filter_mails_by_rule(int account_id, char dest_mailbox_name, email_rule_t *rule, int **filtered_mail_id_list, int *count_of_mails, int err_code)
1423 * Move mails by specified rule for spam filtering.
1425 * @author kyuho.jo@samsung.com
1426 * @param[in] account_id Account id of the mails and the mailboxes.
1427 * @param[in] dest_mailbox_name Mailbox name of spam mailbox.
1428 * @param[in] rule Filtering rule.
1429 * @param[out] filtered_mail_id_list Mail id list which are filtered by the rule.
1430 * @param[out] count_of_mails Count of mails which are filtered by the rule.
1431 * @param[out] err_code Returns the error code.
1434 * @return This function returns true on success or false on failure.
1436 INTERNAL_FUNC int emstorage_filter_mails_by_rule(int account_id, int dest_mailbox_id, emstorage_rule_tbl_t *rule, int **filtered_mail_id_list, int *count_of_mails, int *err_code);
1438 INTERNAL_FUNC int emstorage_add_meeting_request(int account_id, int input_mailbox_id, email_meeting_request_t *meeting_req, int transaction, int *err_code);
1439 INTERNAL_FUNC int emstorage_get_meeting_request(int mail_id, email_meeting_request_t **meeting_req, int transaction, int *err_code);
1440 INTERNAL_FUNC int emstorage_update_meeting_request(email_meeting_request_t *meeting_req, int transaction, int *err_code);
1441 INTERNAL_FUNC int emstorage_delete_meeting_request(int account_id, int mail_id, int input_mailbox_id, int transaction, int *err_code);
1442 INTERNAL_FUNC void emstorage_free_meeting_request(email_meeting_request_t *meeting_req);
1444 INTERNAL_FUNC int emstorage_write_conditional_clause_for_getting_mail_list(email_list_filter_t *input_filter_list, int input_filter_count, email_list_sorting_rule_t *input_sorting_rule_list, int input_sorting_rule_count, int input_start_index, int input_limit_count, char **output_conditional_clause);
1445 INTERNAL_FUNC int emstorage_free_list_filter(email_list_filter_t **input_filter_list, int input_filter_count);
1447 #ifdef __FEATURE_LOCAL_ACTIVITY__
1449 *emstorage_get_next_activity_id
1451 *description : get an activity id for a new activity
1453 INTERNAL_FUNC int emstorage_get_next_activity_id(int *activity_id, int *err_code);
1456 *emstorage_get_activity_id_list
1457 *description : get the list of activity ids
1462 INTERNAL_FUNC int emstorage_get_activity_id_list(int account_id, int **activity_id_list, int *activity_count, int lowest_activity_type, int highest_activity_type, int transaction, int*err_code);
1464 * emstorage_add_activity
1466 * description : add an activity to activity table
1470 INTERNAL_FUNC int emstorage_add_activity(emstorage_activity_tbl_t *local_activity, int transaction, int *err_code);
1473 * emstorage_get_activity - Get the Local activity from the Mail activity table
1476 INTERNAL_FUNC int emstorage_get_activity(int account_id, int activity_id, emstorage_activity_tbl_t **activity_list, int *select_num, int transaction, int *err_code);
1479 * emstorage_delete_local_activity - Deletes the Local acitivity Generated based on activity_type
1480 * or based on server mail id
1483 INTERNAL_FUNC int emstorage_delete_local_activity(emstorage_activity_tbl_t *local_activity, int transaction, int *err_code);
1486 * emstorage_free_local_activity - Free the allocated Activity data
1490 INTERNAL_FUNC int emstorage_free_local_activity(emstorage_activity_tbl_t **local_activity_list, int count, int *err_code);
1493 * emstorage_free_activity_id_list - Free the allocated Activity List data
1497 INTERNAL_FUNC int emstorage_free_activity_id_list(int *activity_id_list, int *error_code);
1501 INTERNAL_FUNC int emstorage_add_certificate(emstorage_certificate_tbl_t *certificate, int transaction, int *err_code);
1503 INTERNAL_FUNC int emstorage_free_certificate(emstorage_certificate_tbl_t **certificate_list, int count, int *err_code);
1505 INTERNAL_FUNC int emstorage_get_certificate_list(int *select_num, emstorage_certificate_tbl_t **certificate_list, int transaction, int with_password, int *err_code);
1507 INTERNAL_FUNC int emstorage_get_certificate_by_email_address(char *email_address, emstorage_certificate_tbl_t **certificate, int transaction, int with_password, int *err_code);
1509 INTERNAL_FUNC int emstorage_get_certificate_by_index(int index, emstorage_certificate_tbl_t **certificate, int transaction, int with_password, int *err_code);
1511 INTERNAL_FUNC int emstorage_delete_certificate(int index, int transaction, int *err_code);
1514 INTERNAL_FUNC int emstorage_add_task(email_task_type_t input_task_type, email_task_priority_t input_task_priority, char *input_task_parameter, int input_task_parameter_length, int input_transaction, int *output_task_id);
1516 INTERNAL_FUNC int emstorage_delete_task(int task_id, int transaction);
1518 INTERNAL_FUNC int emstorage_update_task_status(int task_id, email_task_status_type_t task_status, int transaction);
1520 INTERNAL_FUNC int emstorage_query_task(const char *input_conditional_clause, const char *input_ordering_clause, email_task_t **output_task_list, int *output_task_count);
1525 #endif /* __cplusplus */
1527 #endif /* __EMAIL_STORAGE_H__ */