4 * Copyright (c) 2000 - 2011 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-internal-types.h"
46 #define MAILTEMP "tmp"
47 #define FIRST_ACCOUNT_ID 1
50 #ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
51 #define QUERY_SIZE 8192
52 #define MAX_INTEGER_LENGTH 5 /* 32767 -> 5 bytes */
57 unsigned long server_mail_id;
60 #endif /* __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__ */
65 /* Account information */
66 int account_id; /* Account id */
67 char *account_name; /* Account name */
68 char *logo_icon_path; /* Account logo icon path */
69 int account_svc_id; /* Specifies id from account-svc */
70 int sync_status; /* Sync Status. SYNC_STATUS_FINISHED, SYNC_STATUS_SYNCING, SYNC_STATUS_HAVE_NEW_MAILS */
71 int sync_disabled; /* If this attriube is set as true, email-service will not synchronize this account. */
72 int default_mail_slot_size;
74 void *user_data; /* binary user data */
75 int user_data_length; /* user data length */
77 /* User information */
78 char *user_display_name; /* User's display name */
79 char *user_email_address; /* User's email address */
80 char *reply_to_address; /* Email address for reply */
81 char *return_address; /* Email address for error from server*/
83 /* Configuration for incoming server */
84 email_account_server_t incoming_server_type; /* Incoming server type */
85 char *incoming_server_address; /* Incoming server address */
86 int incoming_server_port_number; /* Incoming server port number */
87 char *incoming_server_user_name; /* Incoming server user name */
88 char *incoming_server_password; /* Incoming server password */
89 int incoming_server_secure_connection; /* Does incoming server requires secured connection? */
91 /* Options for incoming server */
92 email_imap4_retrieval_mode_t retrieval_mode; /* Retrieval mode : EMAIL_IMAP4_RETRIEVAL_MODE_NEW or EMAIL_IMAP4_RETRIEVAL_MODE_ALL */
93 int keep_mails_on_pop_server_after_download; /* Keep mails on POP server after download */
94 int check_interval; /* Specifies the interval for checking new mail periodically */
95 int auto_download_size; /* Specifies the size for auto download in bytes. -1 means entire mails body */
97 /* Configuration for outgoing server */
98 email_account_server_t outgoing_server_type;
99 char *outgoing_server_address;
100 int outgoing_server_port_number;
101 char *outgoing_server_user_name;
102 char *outgoing_server_password;
103 int outgoing_server_secure_connection; /* Does outgoing server requires secured connection? */
104 int outgoing_server_need_authentication; /* Does outgoing server requires authentication? */
105 int outgoing_server_use_same_authenticator; /* Use same authenticator for outgoing server */ /* flag2 */
107 /* Options for outgoing server */
108 email_option_t options;
110 /* Authentication Options */
111 int pop_before_smtp; /* POP before SMTP Authentication */
112 int incoming_server_requires_apop; /* APOP authentication */
115 email_smime_type smime_type; /* Sepeifies the smime type 0=Normal 1=Clear signed 2=encrypted 3=Signed + encrypted */
116 char *certificate_path; /* Sepeifies the certificate path of private*/
117 email_cipher_type cipher_type; /* Sepeifies the encryption algorithm*/
118 email_digest_type digest_type; /* Sepeifies the digest algorithm*/
119 } emstorage_account_tbl_t;
128 int expiration_month;
130 char *issue_organization_name;
135 } emstorage_certificate_tbl_t;
139 int account_id; /* MUST BE '0' : currently, only global rule supported. */
141 int type; /* from/subject/body */
143 int action_type; /* move/block/delete */
144 int target_mailbox_id; /* destination mailbox */
145 int flag1; /* for rule ON/OFF */
146 int flag2; /* For rule type INCLUDE/Exactly SAME AS */
147 } emstorage_rule_tbl_t;
149 /* mail_box_tbl table entity */
156 email_mailbox_type_e mailbox_type;
158 int sync_with_server_yn; /* whether mailbox is a sync IMAP mailbox */
159 int modifiable_yn; /* whether mailbox is able to be deleted/modified */
160 int unread_count; /* Removed. 16-Dec-2010, count unread mails at the moment it is required. not store in the DB */
161 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 */
162 int total_mail_count_on_server; /* Specifies the total number of mails in the mailbox in the mail server */
163 int has_archived_mails;
165 time_t last_sync_time; /* The last synchronization time */
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 char *full_address_from;
196 char *full_address_reply;
197 char *full_address_to;
198 char *full_address_cc;
199 char *full_address_bcc;
200 char *full_address_return;
201 char *email_address_sender;
202 char *email_address_recipient;
204 char *alias_recipient;
205 int body_download_status;
206 char *file_path_plain;
207 char *file_path_html;
208 char *file_path_mime_entity;
210 char flags_seen_field;
211 char flags_deleted_field;
212 char flags_flagged_field;
213 char flags_answered_field;
214 char flags_recent_field;
215 char flags_draft_field;
216 char flags_forwarded_field;
222 int attachment_count;
223 int inline_content_count;
225 int thread_item_count;
227 int meeting_request_status;
231 } emstorage_mail_tbl_t;
233 /* mail_attachment_tbl entity */
237 char *attachment_name;
238 char *attachment_path;
243 int attachment_save_status; /* 1 : existing, 0 : not existing */
244 int attachment_drm_type; /* 0 : none, 1 : object, 2 : rights, 3 : dcf */
245 int attachment_drm_method; /* 0 : none, 1 : FL, 2 : CD, 3 : SSD, 4 : SD */
246 int attachment_inline_content_status; /* 1 : inline content , 0 : not inline content */
247 char *attachment_mime_type;
248 #ifdef __ATTACHMENT_OPTI__
252 } emstorage_attachment_tbl_t;
256 RETRIEVE_ALL = 1, /* mail */
257 RETRIEVE_ENVELOPE, /* mail envelope */
258 RETRIEVE_SUMMARY, /* mail summary */
259 RETRIEVE_FIELDS_FOR_DELETE, /* account_id, mail_id, server_mail_yn, server_mailbox, server_mail_id */
260 RETRIEVE_ACCOUNT, /* account_id */
261 RETRIEVE_FLAG, /* mailbox, flag1, thread_id */
262 RETRIEVE_ID, /* mail_id */
263 RETRIEVE_ADDRESS, /* mail_id, contact_info */
264 } emstorage_mail_field_type_t;
266 typedef struct _emstorage_search_filter_t {
269 struct _emstorage_search_filter_t *next;
270 } emstorage_search_filter_t;
273 EMAIL_CREATE_DB_NORMAL = 0,
274 EMAIL_CREATE_DB_CHECK,
275 } emstorage_create_db_type_t;
278 /*****************************************************************************
280 *****************************************************************************/
281 #define MAX_PW_FILE_NAME_LENGTH 128 /* password file name for secure storage */
283 #ifdef __FEATURE_LOCAL_ACTIVITY__
287 ACTIVITY_FETCHIMAPFOLDER = 1, /* Fetch Mail server Activity */
288 ACTIVITY_DELETEMAIL, /* Delete Mail Activity */
289 ACTIVITY_MODIFYFLAG, /* Modify Mail flag Activity */
290 ACTIVITY_MODIFYSEENFLAG, /* Modify Mail seen flag Activity */
291 ACTIVITY_MOVEMAIL, /* Move Mail Activity */
292 ACTIVITY_DELETEALLMAIL, /* Delete All Mails activity */
293 ACTIVITY_COPYMAIL, /* Copy Mail Activity */
294 ACTIVITY_SAVEMAIL, /* Save Mail activity */
295 ACTIVITY_DELETEMAIL_SEND, /* New Delete Mail Activity added to be processed by send thread */
300 * emstorage_activity_tbl_t - Email Local activity Structure
305 int activity_id; /* Activity ID */
306 int account_id; /* Account ID */
307 int mail_id; /* Mail ID */
308 int activity_type; /* Local Activity Type */
309 char *server_mailid; /* Server Mail ID or Mailbox name */
310 char *src_mbox; /* Source Mailbox in case of mail_move */
311 char *dest_mbox; /* Destination Mailbox name in case of Mail move operation */
313 } emstorage_activity_tbl_t;
317 INTERNAL_FUNC int emstorage_shm_file_init(const char *shm_file_name);
320 /************** Database Management ***************/
323 * description : open db and register busy handler
325 INTERNAL_FUNC int em_db_open(sqlite3 **sqlite_handle, int *err_code);
330 * description : open db and set global variable sqlite_emmb
334 INTERNAL_FUNC sqlite3* emstorage_db_open(int *err_code);
339 * description : close db with global variable sqlite_emmb
343 INTERNAL_FUNC int emstorage_db_close(int *err_code);
348 * description : initialize storage manager
352 INTERNAL_FUNC int emstorage_open(int *err_code);
357 * description : cleanup storage manager
361 INTERNAL_FUNC int emstorage_close(int *err_code);
364 * emstorage_create_table
366 * description : create account/address table in database.
370 INTERNAL_FUNC int emstorage_create_table(emstorage_create_db_type_t type, int *err_code);
374 * Check whether there is the same account information in the db
376 * @param[in] account account that
377 * @param[in] transaction If the argument is true, engine commits transaction or executes rollback.
378 * @param[out] err_code Error code.
380 * @return This function returns true if there is no duplicated account. returns false and set error code if there are duplicated accounts or error
382 INTERNAL_FUNC int emstorage_check_duplicated_account(email_account_t *account, int transaction, int *err_code);
386 * Get number of accounts from account table.
388 * @param[out] count The number of accounts is saved here.
389 * @param[in] transaction If the argument is true, engine commits transaction or executes rollback.
391 * @return This function returns 0 on success or error code on failure.
393 INTERNAL_FUNC int emstorage_get_account_count(int *count, int transaction, int *err_code);
396 * Get account from account table.
398 * @param[in, out] select_num Upon entry, the argument contains the number of accounts to select.
399 Upon exit, it is set to the number of accounts to been selected.
400 * @param[out] account_list The selected accounts is saved here. this pointer must be freed after being used.
401 * @param[in] transaction If the argument is true, engine commits transaction or executes rollback.
403 * @return This function returns 0 on success or error code on failure.
405 INTERNAL_FUNC int emstorage_get_account_list(int *select_num, emstorage_account_tbl_t **account_list, int transaction, int with_password, int *err_code);
408 * emstorage_get_account_by_name
410 * description : get account from account table by account name
412 * db : database pointer
413 * account_id : account id
414 * pulloption : option to specify fetching full or partial data
415 * account : buffer to hold selected account
416 * this buffer must be free after it has been used.
419 /* sowmya.kr, 281209 Adding signature to options in email_account_t changes */
421 INTERNAL_FUNC int emstorage_get_account_by_id(int account_id, int pulloption, emstorage_account_tbl_t **account, int transaction, int *err_code);
425 * emstorage_get_password_length_of_account
427 * description: get password length of account.
429 * account_id : account id
430 * password_length : password length
434 INTERNAL_FUNC int emstorage_get_password_length_of_account(int account_id, int *password_length, int* err_code);
437 * emstorage_update_account
439 * description : change a account from account table
441 * account_id : account id
442 * account : buffer to hold selected account
445 INTERNAL_FUNC int emstorage_update_account(int account_id, emstorage_account_tbl_t *account, int transaction, int *err_code);
448 INTERNAL_FUNC int emstorage_set_field_of_accounts_with_integer_value(int account_id, char *field_name, int value, int transaction);
451 * emstorage_get_sync_status_of_account
453 * description : get a sync status field from account table
455 * account_id : account id
456 * result_sync_status : sync status value
460 INTERNAL_FUNC int emstorage_get_sync_status_of_account(int account_id, int *result_sync_status,int *err_code);
463 * emstorage_update_sync_status_of_account
465 * description : update a sync status field from account table
467 * account_id : account id
468 * set_operator : set operater. refer email_set_type_t
469 * sync_status : sync status value
473 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);
476 * emstorage_add_account
478 * description : add a account to account table
482 INTERNAL_FUNC int emstorage_add_account(emstorage_account_tbl_t *account, int transaction, int *err_code);
485 * emstorage_delete_account
487 * description : delete a account from account table
489 * db : database pointer
490 * account_id : account id to be deteted
493 INTERNAL_FUNC int emstorage_delete_account(int account_id, int transaction, int *err_code);
496 * emstorage_free_account
498 * description : free local accout memory
500 * account_list : double pointer
501 * count : count of local account
504 INTERNAL_FUNC int emstorage_free_account(emstorage_account_tbl_t **account_list, int count, int *err_code);
507 /************** Mailbox(Local box And Imap mailbox) Management ******************/
510 * emstorage_get_mailbox_count
512 * description : get number of mailbox from local mailbox table
514 * db : database pointer
515 * count : number of accounts
518 INTERNAL_FUNC int emstorage_get_mailbox_count(int account_id, int local_yn, int *count, int transaction, int *err_code);
521 * emstorage_get_mailbox
523 * description : get local mailbox from local mailbox table
525 * db : database pointer
526 * sort_type : in - sorting type.
527 * select_num : in - number of selected account
528 * out - number to been selected
529 * mailbox_list : buffer to hold selected account
530 * this buffer must be free after it has been used.
533 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);
536 * emstorage_get_child_mailbox_list
538 * description : get child mailbox list from given mailbox
540 * account_id : in - account id
541 * parent_mailbox_name : in - parent_mailbox_name to fetch child list
542 * local_yn - in - local mailbox or not
543 * select_num - out : count of mailboxes
544 * mailbox_list - out : list of mailboxes
545 * err_code - out : error code, if any
549 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);
552 * emstorage_get_mailbox_by_name
554 * description : get local mailbox from local mailbox table by mailbox name
556 * db : database pointer
557 * mailbox_name : mailbox name
558 * mailbox : buffer to hold selected local mailbox
559 * this buffer must be free after it has been used.
562 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);
563 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);
564 INTERNAL_FUNC int emstorage_get_mailbox_by_id(int input_mailbox_id, emstorage_mailbox_tbl_t** output_mailbox);
565 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);
566 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);
567 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);
568 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);
569 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);
573 * emstorage_update_mailbox
575 * description : change a account from account table
577 * db : database pointer
578 * mailbox_name : mailbox name
579 * mailbox : buffer to hold selected local mailbox
582 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);
585 * emstorage_update_mailbox_type
587 * description : change a mailbox from mailbox tbl
591 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);
594 * emstorage_add_mailbox
596 * description : add a local mailbox to local mailbox table
600 INTERNAL_FUNC int emstorage_add_mailbox(emstorage_mailbox_tbl_t *mailbox, int transaction, int *err_code);
603 * emstorage_delete_mailbox
605 * description : delete a local mailbox from local mailbox table
607 * db : database pointer
608 * mailbox_name : mailbox name of record to be deteted
611 INTERNAL_FUNC int emstorage_delete_mailbox(int account_id, int local_yn, int input_mailbox_id, int transaction, int *err_code);
613 INTERNAL_FUNC int emstorage_rename_mailbox(int input_mailbox_id, char *input_new_mailbox_path, char *input_new_mailbox_alias, int input_transaction);
614 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);
615 INTERNAL_FUNC int emstorage_set_mail_slot_size(int account_id, int mailbox_id, int new_slot_size, int transaction, int *err_code);
617 INTERNAL_FUNC int emstorage_set_all_mailbox_modifiable_yn(int account_id, int modifiable_yn, int transaction, int *err_code);
618 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);
619 INTERNAL_FUNC int emstorage_stamp_last_sync_time_of_mailbox(int input_mailbox_id, int input_transaction);
622 * emstorage_free_mailbox
624 * description : free local mailbox memory
626 * mailbox_list : double pointer
627 * count : count of local mailbox
630 INTERNAL_FUNC int emstorage_free_mailbox(emstorage_mailbox_tbl_t **mailbox_list, int count, int *err_code);
633 /************** Read Mail UID Management ******************/
637 INTERNAL_FUNC int emstorage_get_count_read_mail_uid(int account_id, char *mailbox_name, int *count, int transaction, int *err_code);
641 * emstorage_check_read_mail_uid
643 * description : check that this uid exists in uid table
645 * db : database pointer
646 * mailbox_name : mailbox name
647 * s_uid : uid string to be checked
648 * exist : variable to hold checking result. (0 : not exist, 1 : exist)
651 INTERNAL_FUNC int emstorage_check_read_mail_uid(int account_id, char *mailbox_name, char *uid, int *exist, int transaction, int *err_code);
654 * emstorage_get_read_mail_size
656 * description : get mail size from read mail uid
658 * db : database pointer
659 * mailbox_id : local mailbox id
660 * local_uid : mail uid of local mailbox
661 * mailbox_name : server mailbox name
662 * uid : mail uid string of server mail
663 * read_mail_uid : variable to hold read mail uid information
666 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);
668 INTERNAL_FUNC int emstorage_get_downloaded_mail(int mail_id, emstorage_mail_tbl_t **mail, int transaction, int *err_code);
671 * emstorage_get_read_mail_size
673 * description : get mail size from read mail uid
675 * db : database pointer
676 * mailbox_name : mailbox name
677 * s_uid : mail uid string
678 * size : variable to hold mail size
681 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);
684 * emstorage_add_downloaded_mail
686 * description : add read mail uid
690 INTERNAL_FUNC int emstorage_add_downloaded_mail(emstorage_read_mail_uid_tbl_t *read_mail_uid, int transaction, int *err_code);
693 * emstorage_change_read_mail_uid
695 * description : modify read mail uid
699 INTERNAL_FUNC int emstorage_change_read_mail_uid(int account_id, int local_mailbox_id, int local_uid, char *mailbox_name, char *uid,
700 emstorage_read_mail_uid_tbl_t *read_mail_uid, int transaction, int *err_code);
703 * emstorage_remove_downloaded_mail
709 INTERNAL_FUNC int emstorage_remove_downloaded_mail(int account_id, char *mailbox_name, char *uid, int transaction, int *err_code);
712 INTERNAL_FUNC int emstorage_update_read_mail_uid(int mail_id, char *new_server_uid, char *mbox_name, int *err_code);
717 INTERNAL_FUNC int emstorage_free_read_mail_uid(emstorage_read_mail_uid_tbl_t **read_mail_uid, int count, int *err_code);
721 /************** Rules(Filtering) Management ******************/
724 * emstorage_get_rule_count
726 * description : get number of rules from rule table
728 * db : database pointer
729 * count : number of accounts
732 INTERNAL_FUNC int emstorage_get_rule_count(int account_id, int *count, int transaction, int *err_code);
737 * description : get rules from rule table
739 * db : database pointer
740 * start_idx : the first index to be selected (min : 0)
741 * select_num : in - number of selected account
742 * out - number to been selected
743 * is_completed : is completed ?
746 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);
751 * description : get rules from rule table
755 INTERNAL_FUNC int emstorage_get_rule_by_id(int account_id, int rule_id, emstorage_rule_tbl_t **rule, int transaction, int *err_code);
758 * emstorage_change_rule
760 * description : change a account from account table
762 * db : database pointer
763 * mailbox_name : mailbox name
764 * rule : buffer to hold selected rule
767 INTERNAL_FUNC int emstorage_change_rule(int account_id, int rule_id, emstorage_rule_tbl_t *rule, int transaction, int *err_code);
770 * emstorage_find_rule
772 * description : find a rule already exists
776 INTERNAL_FUNC int emstorage_find_rule(emstorage_rule_tbl_t *rule, int transaction, int *err_code);
781 * description : add a rule to rule table
785 INTERNAL_FUNC int emstorage_add_rule(emstorage_rule_tbl_t *rule, int transaction, int *err_code);
788 * emstorage_delete_rule
790 * description : delete a rule from rule table
792 * db : database pointer
793 * rule : rule to be deteted
796 INTERNAL_FUNC int emstorage_delete_rule(int account_id, int rule_id, int transaction, int *err_code);
799 * emstorage_free_rule
801 * description : free rule memory
803 * count : count of rule
806 INTERNAL_FUNC int emstorage_free_rule(emstorage_rule_tbl_t **rule_list, int count, int *err_code);
809 /************** Mail Management ******************/
812 * emstorage_get_mail_count
814 * description : get mail total and unseen count from mail table
816 * total : total count
817 * unseen : unseen mail count
820 INTERNAL_FUNC int emstorage_get_mail_count(int account_id, const char *mailbox, int *total, int *unseen, int transaction, int *err_code);
823 * emstorage_get_mail_by_id
825 * description : get mail from mail table by mail id
828 * mail : double pointer to hold mail
831 INTERNAL_FUNC int emstorage_get_mail_by_id(int mail_id, emstorage_mail_tbl_t **mail, int transaction, int *err_code);
836 * description : get mail from mail table by mail sequence
838 * account_id : account id
839 * mailbox : mailbox name
840 * mail_no : mail sequence number (not mail id)
841 * mail : double pointer to hold mail
844 INTERNAL_FUNC int emstorage_get_mail_field_by_id(int mail_id, int type, emstorage_mail_tbl_t **mail, int transaction, int *err_code);
847 * emstorage_get_mail_field_by_multiple_mail_id
859 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);
862 * emstorage_query_mail_count
864 * description : query mail count
866 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);
869 * emstorage_query_mail_list
871 * description : query mail id list
873 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);
876 * emstorage_query_mail_list
878 * description : query mail list information
880 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);
883 * emstorage_query_mail_tbl
885 * description : query mail table information
887 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);
890 * emstorage_query_mailbox_tbl
892 * description : query mail box table information
895 INTERNAL_FUNC int emstorage_query_mailbox_tbl(const char *input_conditional_clause, int input_get_mail_count, int input_transaction, emstorage_mailbox_tbl_t **output_mailbox_list, int *output_mailbox_count);
898 * emstorage_get_mail_list
900 * description : search mail list information
903 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);
905 * emstorage_get_mails
907 * description : search mail list information
909 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);
910 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);
911 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);
912 INTERNAL_FUNC int emstorage_get_latest_unread_mailid(int account_id, int *mail_id, int *err_code);
916 * Prepare mail search.
918 * @param[in] search Specifies the searching condition.
919 * @param[in] account_id Specifies the account id. if 0, all accounts.
920 * @param[in] mailbox Specifies the mailbox name. if NULL, all mailboxes.
921 * @param[in] sorting Specifies the sorting condition.
922 * @param[out] search_handle the searching handle is saved here.
923 * @param[out] searched the result count is saved here.
925 * @return This function returns 0 on success or error code on failure.
927 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);
930 * emstorage_mail_search_result
932 * description : retrieve mail as searching result
934 * search_handle : handle to been gotten from emstorage_mail_search_start
935 * mail : double pointer to hold mail
938 INTERNAL_FUNC int emstorage_mail_search_result(int search_handle, emstorage_mail_field_type_t type, void **data, int transaction, int *err_code);
941 * emstorage_mail_search_end
943 * description : finish searching
945 * search_handle : handle to be finished
948 INTERNAL_FUNC int emstorage_mail_search_end(int search_handle, int transaction, int *err_code);
953 * emstorage_set_field_of_mails_with_integer_value
955 * description : update a filed of mail
957 * account_id : Specifies the account id.
958 * mail_ids : mail id list to be changed
959 * mail_ids_count : count of mail list
960 * field_name : specified field name
961 * value : specified value
964 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);
967 * emstorage_change_mail_field
969 * description : update partial mail data
972 * type : changing type
973 * mail : mail pointer
976 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);
979 * emstorage_increase_mail_id
981 * description : increase unique mail id
983 * mail_id : pointer to store the unique id
988 * emstorage_change_mail
990 * description : update mail
992 * mail_id : mail id to be changed
993 * mail : mail pointer
996 INTERNAL_FUNC int emstorage_change_mail(int mail_id, emstorage_mail_tbl_t *mail, int transaction, int *err_code);
997 INTERNAL_FUNC int emstorage_clean_save_status(int save_status, int *err_code);
998 INTERNAL_FUNC int emstorage_update_server_uid(char *old_server_uid, char *new_server_uid, int *err_code);
999 INTERNAL_FUNC int emstorage_modify_mailbox_of_mails(char *old_mailbox_name, char *new_mailbox_name, int transaction, int *err_code);
1001 INTERNAL_FUNC int emstorage_increase_mail_id(int *mail_id, int transaction, int *err_code);
1004 * emstorage_add_mail
1006 * description : add a mail to mail table
1008 * mail : mail pointer to be inserted
1009 * get_id : must get uinque id in function
1012 INTERNAL_FUNC int emstorage_add_mail(emstorage_mail_tbl_t *mail, int get_id, int transaction, int *err_code);
1015 * emstorage_move_multiple_mails
1020 * input_mailbox_id :
1027 INTERNAL_FUNC int emstorage_move_multiple_mails(int account_id, int input_mailbox_id, int mail_ids[], int number_of_mails, int transaction, int *err_code);
1030 * emstorage_delete_mail
1032 * description : delete mail from mail table
1034 * mail_id : mail id to be deleted. if 0, all mail will be deleted.
1035 * from_server : delete mail on server.
1038 INTERNAL_FUNC int emstorage_delete_mail(int mail_id, int from_server, int transaction, int *err_code);
1041 * emstorage_delete_mail_by_account
1043 * description : delete mail from mail table by account id
1045 * account_id : account id.
1048 INTERNAL_FUNC int emstorage_delete_mail_by_account(int account_id, int transaction, int *err_code);
1051 * emstorage_delete_mail
1053 * description : delete mail from mail table
1055 * account_id : account id.
1056 * mailbox : mail box
1059 INTERNAL_FUNC int emstorage_delete_mail_by_mailbox(int account_id, char *mailbox, int transaction, int *err_code);
1062 * emstorage_delete_multiple_mails
1072 INTERNAL_FUNC int emstorage_delete_multiple_mails(int mail_ids[], int number_of_mails, int transaction, int *err_code);
1075 * emstorage_free_mail
1077 * description : free memory
1079 * mail_list : mail array
1080 * count : the number of array element
1083 INTERNAL_FUNC int emstorage_free_mail(emstorage_mail_tbl_t **mail_list, int count, int *err_code);
1086 * emstorage_get_attachment
1088 * description : get attachment from attachment table
1091 * no : attachment sequence
1092 * attachment : double pointer to hold attachment data
1095 INTERNAL_FUNC int emstorage_get_attachment_count(int mail_id, int *count, int transaction, int *err_code);
1098 * emstorage_get_attachment_list
1100 * description : get attachment list from attachment table
1102 * input_mail_id : mail id
1103 * input_transaction : transaction option
1104 * attachment_list : result attachment list
1105 * output_attachment_count : result attachment count
1106 * return : This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR__XXX) on failure.
1109 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);
1113 * emstorage_get_attachment
1115 * description : get attachment from attachment table
1117 * attachment_id : attachment id
1118 * attachment : double pointer to hold attachment data
1121 INTERNAL_FUNC int emstorage_get_attachment(int attachment_id, emstorage_attachment_tbl_t **attachment, int transaction, int *err_code);
1124 * emstorage_get_attachment
1126 * description : get nth-attachment from attachment table
1129 * nth : index of the desired attachment (min : 1)
1130 * attachment : double pointer to hold attachment data
1133 INTERNAL_FUNC int emstorage_get_attachment_nth(int mail_id, int nth, emstorage_attachment_tbl_t **attachment, int transaction, int *err_code);
1136 * emstorage_change_attachment_field
1138 * description : update partial mail attachment data
1141 * type : changing type
1142 * mail : mail pointer
1145 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);
1147 /* Get new attachment id */
1149 * emstorage_get_new_attachment_no
1151 * description : Get new attachment id
1153 * attachment_no : attachment id pointer
1157 INTERNAL_FUNC int emstorage_get_new_attachment_no(int *attachment_no, int *err_code);
1159 /* insert attachment to mail attachment table */
1161 * emstorage_add_attachment
1163 * description : insert a attachment to attachment table
1165 * attachment : attachment pointer
1168 INTERNAL_FUNC int emstorage_add_attachment(emstorage_attachment_tbl_t *attachment, int iscopy, int transaction, int *err_code);
1171 INTERNAL_FUNC int emstorage_update_attachment(emstorage_attachment_tbl_t *attachment, int transaction, int *err_code);
1173 /* delete a mail from mail table */
1175 * emstorage_delete_attachment_on_db
1177 * description : delete attachment from attachment table
1179 * attachment_id : attachment id
1182 INTERNAL_FUNC int emstorage_delete_attachment_on_db(int attachment_id, int transaction, int *err_code);
1184 INTERNAL_FUNC int emstorage_delete_all_attachments_of_mail(int mail_id, int transaction, int *err_code);
1187 * emstorage_delete_attachment_all_on_db
1189 * description : delete attachment from mail table
1191 * account_id : account id.
1192 * mailbox : mail box
1195 INTERNAL_FUNC int emstorage_delete_attachment_all_on_db(int account_id, char *mailbox, int transaction, int *err_code);
1198 * emstorage_free_attachment
1200 * description : free memory
1202 * mail_list : mail array
1203 * count : the number of array element
1206 INTERNAL_FUNC int emstorage_free_attachment(emstorage_attachment_tbl_t **attachment_list, int count, int *err_code);
1208 INTERNAL_FUNC int emstorage_is_mailbox_full(int account_id, email_mailbox_t *mailbox, int *result, int *err_code);
1210 INTERNAL_FUNC int emstorage_get_max_mail_count();
1212 INTERNAL_FUNC int emstorage_mail_get_total_diskspace_usage(unsigned long *total_usage, int transaction, int *err_code);
1216 * begin a transaction.
1218 * @param[in] d1 Reserved.
1219 * @param[in] d2 Reserved.
1220 * @remarks emstorage_commit_transaction or emstorage_commit_transaction must be called after this function.
1221 * @return This function returns 0 on success or error code on failure.
1224 INTERNAL_FUNC int emstorage_begin_transaction(void *d1, void *d2, int *err_code);
1227 * commit a transaction.
1229 * @param[in] d1 Reserved.
1230 * @param[in] d2 Reserved.
1232 * @return This function returns 0 on success or error code on failure.
1234 INTERNAL_FUNC int emstorage_commit_transaction(void *d1, void *d2, int *err_code);
1239 * @param[in] d1 Reserved.
1240 * @param[in] d2 Reserved.
1242 * @return This function returns 0 on success or error code on failure.
1244 INTERNAL_FUNC int emstorage_rollback_transaction(void *d1, void *d2, int *err_code);
1247 * clear mail data from db.
1249 * @param[in] transaction
1250 * @param[out] err_code
1252 * @return This function returns 0 on success or error code on failure.
1255 INTERNAL_FUNC int emstorage_clear_mail_data(int transaction, int *err_code);
1258 * emstorage_get_save_name
1260 * description : get file name for saving data
1262 * account_id : account id
1264 * atch_id : attachment id
1266 * name_buf : buffer to hold file name. (MAX : 512Bytes)
1269 INTERNAL_FUNC int emstorage_get_save_name(int account_id, int mail_id, int atch_id, char *fname, char *name_buf, int *err_code);
1272 * emstorage_get_dele_name
1274 * description : get a name for deleting contents from file system.
1276 * account_id : account id
1278 * atch_id : attachment id
1280 * name_buf : buffer to hold file name. (MAX : 512Bytes)
1283 INTERNAL_FUNC int emstorage_get_dele_name(int account_id, int mail_id, int atch_id, char *fname, char *name_buf, int *err_code);
1286 * emstorage_create_dir
1288 * description : create directory
1290 * name_buf : buffer to hold file name. (MAX : 512Bytes)
1291 * no : attachment no.
1294 INTERNAL_FUNC int emstorage_create_dir(int account_id, int mail_id, int atch_id, int *err_code);
1297 * emstorage_copy_file
1299 * description : copy a attachment file
1301 * src_file : source file
1302 * dst_file : destination file
1305 INTERNAL_FUNC int emstorage_copy_file(char *src_file, char *dst_file, int sync_file, int *err_code);
1308 * emstorage_move_file
1310 * description : move a file
1312 * src_file : source file
1313 * dst_file : destination file
1316 INTERNAL_FUNC int emstorage_move_file(char *src_file, char *dst_file, int sync_status, int *err_code);
1319 * emstorage_move_file
1321 * description : delete a file
1323 * src_file : file to be deleted
1326 INTERNAL_FUNC int emstorage_delete_file(char *src_file, int *err_code);
1329 * emstorage_delete_dir
1331 * description : delete a directory
1333 * src_dir : directory to be deleted
1336 INTERNAL_FUNC int emstorage_delete_dir(char *src_dir, int *err_code);
1340 INTERNAL_FUNC void emstorage_flush_db_cache();
1341 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);
1343 * emstorage_notify_storage_event - Notification for storage related operations
1345 INTERNAL_FUNC int emstorage_notify_storage_event(email_noti_on_storage_event event_type, int data1, int data2 , char *data3, int data4);
1348 * emstorage_notify_network_event - Notification for network related operations
1350 INTERNAL_FUNC int emstorage_notify_network_event(email_noti_on_network_event event_type, int data1, char *data2, int data3, int data4);
1353 * emstorage_notify_response_to_api - Notification for response to API
1355 INTERNAL_FUNC int emstorage_notify_response_to_api(email_event_type_t event_type, int data1, int data2);
1357 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);
1358 INTERNAL_FUNC int emstorage_free_sender_list(email_sender_list_t **sender_list, int count);
1360 /* Handling Thread mail */
1361 INTERNAL_FUNC int emstorage_get_thread_information(int thread_id, emstorage_mail_tbl_t **mail_table_data, int transaction, int *err_code);
1362 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);
1363 INTERNAL_FUNC int emstorage_get_thread_id_by_mail_id(int mail_id, int *thread_id, int *err_code);
1364 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);
1366 #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
1368 #define BULK_PARTIAL_BODY_DOWNLOAD_COUNT 10
1371 ACCOUNT_IDX_MAIL_PARTIAL_BODY_ACTIVITY_TBL = 0,
1372 MAIL_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL,
1373 SERVER_MAIL_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL,
1374 ACTIVITY_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL,
1375 ACTIVITY_TYPE_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL,
1376 MAILBOX_ID_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL,
1377 MAILBOX_NAME_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL,
1381 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);
1382 INTERNAL_FUNC int emstorage_add_pbd_activity(email_event_partial_body_thd *local_activity, int *activity_id, int transaction, int *err_code);
1383 INTERNAL_FUNC int emstorage_get_pbd_mailbox_list(int account_id, int **mailbox_list, int *count, int transaction, int *err_code);
1384 INTERNAL_FUNC int emstorage_get_pbd_account_list(int **account_list, int *count, int transaction, int *err_code);
1385 INTERNAL_FUNC int emstorage_get_pbd_activity_count(int *activity_id_count, int transaction, int *err_code);
1386 INTERNAL_FUNC int emstorage_delete_full_pbd_activity_data(int account_id, int transaction, int *err_code);
1387 INTERNAL_FUNC int emstorage_delete_pbd_activity(int account_id, int mail_id, int activity_id, int transaction, int *err_code);
1388 INTERNAL_FUNC int emstorage_get_mailbox_pbd_activity_count(int account_id, int input_mailbox_id, int *activity_count, int transaction, int *err_code);
1389 INTERNAL_FUNC int emstorage_update_pbd_activity(char *old_server_uid, char *new_server_uid, char *mbox_name, int *err_code);
1390 INTERNAL_FUNC int emstorage_create_file(char *buf, size_t file_size, char *dst_file, int *err_code);
1394 INTERNAL_FUNC int emstorage_free_address_info_list(email_address_info_list_t **address_info_list);
1396 INTERNAL_FUNC void emstorage_create_dir_if_delete();
1398 #ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
1399 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);
1402 * @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);
1403 * Prepare an array of mail_id and corresponding server mail id.
1405 *@author h.gahlaut@samsung.com
1406 * @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)
1407 * where 88 is the length of fixed keywords including ending null character in the QUERY to be formed
1408 * @param[out] idset Returns the array of mail_id and corresponding server_mail_id sorted by server_mail_ids in ascending order
1409 * @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
1410 * @param[out] err_code Returns the error code.
1411 * @remarks An Example of Query to be exexuted in this API :
1412 * SELECT local_uid, s_uid from mail_read_mail_uid_tbl where local_uid in (12, 13, 56, 78);
1413 * @return This function returns true on success or false on failure.
1416 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);
1421 * @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)
1422 * Move mails by specified rule for spam filtering.
1424 * @author kyuho.jo@samsung.com
1425 * @param[in] account_id Account id of the mails and the mailboxes.
1426 * @param[in] dest_mailbox_name Mailbox name of spam mailbox.
1427 * @param[in] rule Filtering rule.
1428 * @param[out] filtered_mail_id_list Mail id list which are filtered by the rule.
1429 * @param[out] count_of_mails Count of mails which are filtered by the rule.
1430 * @param[out] err_code Returns the error code.
1433 * @return This function returns true on success or false on failure.
1435 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);
1437 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);
1438 INTERNAL_FUNC int emstorage_get_meeting_request(int mail_id, email_meeting_request_t **meeting_req, int transaction, int *err_code);
1439 INTERNAL_FUNC int emstorage_update_meeting_request(email_meeting_request_t *meeting_req, int transaction, int *err_code);
1440 INTERNAL_FUNC int emstorage_delete_meeting_request(int account_id, int mail_id, int input_mailbox_id, int transaction, int *err_code);
1441 INTERNAL_FUNC void emstorage_free_meeting_request(email_meeting_request_t *meeting_req);
1443 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);
1444 INTERNAL_FUNC int emstorage_free_list_filter(email_list_filter_t **input_filter_list, int input_filter_count);
1446 #ifdef __FEATURE_LOCAL_ACTIVITY__
1448 *emstorage_get_next_activity_id
1450 *description : get an activity id for a new activity
1452 INTERNAL_FUNC int emstorage_get_next_activity_id(int *activity_id, int *err_code);
1455 *emstorage_get_activity_id_list
1456 *description : get the list of activity ids
1461 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);
1463 * emstorage_add_activity
1465 * description : add an activity to activity table
1469 INTERNAL_FUNC int emstorage_add_activity(emstorage_activity_tbl_t *local_activity, int transaction, int *err_code);
1472 * emstorage_get_activity - Get the Local activity from the Mail activity table
1475 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);
1478 * emstorage_delete_local_activity - Deletes the Local acitivity Generated based on activity_type
1479 * or based on server mail id
1482 INTERNAL_FUNC int emstorage_delete_local_activity(emstorage_activity_tbl_t *local_activity, int transaction, int *err_code);
1485 * emstorage_free_local_activity - Free the allocated Activity data
1489 INTERNAL_FUNC int emstorage_free_local_activity(emstorage_activity_tbl_t **local_activity_list, int count, int *err_code);
1492 * emstorage_free_activity_id_list - Free the allocated Activity List data
1496 INTERNAL_FUNC int emstorage_free_activity_id_list(int *activity_id_list, int *error_code);
1500 INTERNAL_FUNC int emstorage_add_certificate(emstorage_certificate_tbl_t *certificate, int transaction, int *err_code);
1502 INTERNAL_FUNC int emstorage_free_certificate(emstorage_certificate_tbl_t **certificate_list, int count, int *err_code);
1504 INTERNAL_FUNC int emstorage_get_certificate_list(int *select_num, emstorage_certificate_tbl_t **certificate_list, int transaction, int with_password, int *err_code);
1506 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);
1508 INTERNAL_FUNC int emstorage_get_certificate_by_index(int index, emstorage_certificate_tbl_t **certificate, int transaction, int with_password, int *err_code);
1510 INTERNAL_FUNC int emstorage_delete_certificate(int index, int transaction, int *err_code);
1514 #endif /* __cplusplus */
1516 #endif /* __EMAIL_STORAGE_H__ */