Removed the certificate api
[platform/core/messaging/email-service.git] / email-core / email-storage / include / email-storage.h
1 /*
2 *  email-service
3 *
4 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5 *
6 * Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>
7 *
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
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
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.
19 *
20 */
21
22
23 /******************************************************************************
24  * File :  email-storage.h
25  * Desc :  email-core Storage Library Header
26  *
27  * Auth :
28  *
29  * History :
30  *    2006.07.28  :  created
31  *****************************************************************************/
32 #ifndef __EMAIL_STORAGE_H__
33 #define __EMAIL_STORAGE_H__
34 #include <tzplatform_config.h>
35
36 #ifdef __cplusplus
37 extern "C"
38 {
39 #endif /* __cplusplus */
40
41 #include <sqlite3.h>
42 #include <time.h>
43 #include "email-types.h"
44 #include "email-core-tasks.h"
45 #include "email-internal-types.h"
46 #ifdef __FEATURE_WIFI_AUTO_DOWNLOAD__
47 #include "email-core-auto-download.h"
48 #endif
49
50 #define FIRST_ACCOUNT_ID    1
51 #define EMAIL_SERVICE_CREATE_TABLE_QUERY_FILE_PATH tzplatform_mkpath(TZ_USER_DATA,"email/res/email-service.sql")
52
53
54 #ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
55 #define QUERY_SIZE          8192
56 #define MAX_INTEGER_LENGTH  5  /*  32767 -> 5 bytes */
57 #define FILE_MAX_BUFFER_SIZE     16 * 1024 /* 16 Kbyte */
58
59 #define DB_STMT sqlite3_stmt *
60
61 typedef struct
62 {
63         int mail_id;
64         unsigned long server_mail_id;
65 } email_id_set_t;
66
67 #endif /* __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__ */
68
69
70 typedef struct
71 {
72         /* Account information */
73         int                                account_id;                               /* Account id  */
74         char                              *account_name;                             /* Account name */
75         char                              *logo_icon_path;                           /* Account logo icon path */
76         int                                account_svc_id;                           /* Specifies id from account-svc */
77         int                                sync_status;                              /* Sync Status. SYNC_STATUS_FINISHED, SYNC_STATUS_SYNCING, SYNC_STATUS_HAVE_NEW_MAILS */
78         int                                sync_disabled;                            /* If this attriube is set as true, email-service will not synchronize this account. */
79         int                                default_mail_slot_size;
80         email_roaming_option_t             roaming_option;                           /* roaming option */
81         int                                color_label;                              /* Account color label */
82         void                              *user_data;                                /* binary user data */
83         int                                user_data_length;                         /* user data length */
84
85         /* User information */
86         char                              *user_display_name;                        /* User's display name */
87         char                              *user_email_address;                       /* User's email address */
88         char                              *reply_to_address;                         /* Email address for reply */
89         char                              *return_address;                           /* Email address for error from server*/
90
91         /* Configuration for incoming server */
92         email_account_server_t             incoming_server_type;                     /* Incoming server type */
93         char                              *incoming_server_address;                  /* Incoming server address */
94         int                                incoming_server_port_number;              /* Incoming server port number */
95         char                              *incoming_server_user_name;                /* Incoming server user name */
96         char                              *incoming_server_password;                 /* Incoming server password */
97         int                                incoming_server_secure_connection;        /* Does incoming server requires secured connection? */
98
99         /* Options for incoming server */
100         email_imap4_retrieval_mode_t       retrieval_mode;                           /* Retrieval mode : EMAIL_IMAP4_RETRIEVAL_MODE_NEW or EMAIL_IMAP4_RETRIEVAL_MODE_ALL */
101         int                                keep_mails_on_pop_server_after_download;  /* Keep mails on POP server after download */
102         int                                check_interval;                           /* Specifies the interval for checking new mail periodically */
103         int                                auto_download_size;                       /* Specifies the size for auto download in bytes. -1 means entire mails body */
104         int                                peak_interval;                            /* Specifies the interval for checking new mail periodically of peak schedule */
105         int                                peak_days;                                /* Specifies the weekdays of peak schedule */
106         int                                peak_start_time;                          /* Specifies the start time of peak schedule */
107         int                                peak_end_time;                            /* Specifies the end time of peak schedule */
108
109         /* Configuration for outgoing server */
110         email_account_server_t             outgoing_server_type;
111         char                              *outgoing_server_address;
112         int                                outgoing_server_port_number;
113         char                              *outgoing_server_user_name;
114         char                              *outgoing_server_password;
115         int                                outgoing_server_secure_connection;        /* Does outgoing server requires secured connection? */
116         int                                outgoing_server_need_authentication;      /* Does outgoing server requires authentication? */
117         int                                outgoing_server_use_same_authenticator;   /* Use same authenticator for outgoing server */
118
119         /* Options for outgoing server */
120         email_option_t                     options;
121         int                                auto_resend_times;                        /* Auto retry count for sending a email */
122         int                                outgoing_server_size_limit;               /* Mail size limitation for SMTP sending*/
123
124         /* Auto download */
125         int                                wifi_auto_download;                        /* auto attachment download in wifi connection */
126
127         /* Authentication Options */
128         int                                pop_before_smtp;                          /* POP before SMTP Authentication */
129         int                                incoming_server_requires_apop;            /* APOP authentication */
130         email_authentication_method_t      incoming_server_authentication_method;                    /* authentication method */
131
132         /* S/MIME Options */
133         email_smime_type                   smime_type;                               /* Sepeifies the smime type 0=Normal 1=Clear signed 2=encrypted 3=Signed + encrypted */
134         char                              *certificate_path;                         /* Sepeifies the certificate path of private*/
135         email_cipher_type                  cipher_type;                              /* Sepeifies the encryption algorithm*/
136         email_digest_type                  digest_type;                              /* Sepeifies the digest algorithm*/
137
138     /* Multi user and KNOX options */
139     char                              *user_name;                                /* Specifies the container name */ 
140 } emstorage_account_tbl_t;
141
142 typedef struct
143 {
144         int certificate_id;
145         int issue_year;
146         int issue_month;
147         int issue_day;
148         int expiration_year;
149         int expiration_month;
150         int expiration_day;
151         char *issue_organization_name;
152         char *email_address;
153         char *subject_str;
154         char *filepath;
155         char *password;
156 } emstorage_certificate_tbl_t;
157
158 typedef struct
159 {
160         int   account_id;      /*  MUST BE '0'  :  currently, only global rule supported. */
161         int   rule_id;
162         char *filter_name;
163         int   type;            /*  from/subject/body  */
164         char *value;
165         char *value2;           /* from address */
166         int   action_type;     /*  move/block/delete  */
167         int   target_mailbox_id;    /*  destination mailbox  */
168         int   flag1;           /*  for rule ON/OFF */
169         int   flag2;           /*  For rule type INCLUDE/Exactly SAME AS */
170 } emstorage_rule_tbl_t;
171
172 /* mail_box_tbl table entity */
173 typedef struct
174 {
175         int                   mailbox_id;
176         int                   account_id;
177         int                   local_yn;
178         char                 *mailbox_name;
179         email_mailbox_type_e  mailbox_type;
180         char                 *alias;
181         int                   modifiable_yn;              /*  whether mailbox is able to be deleted/modified */
182         int                   unread_count;               /*  Removed. 16-Dec-2010, count unread mails at the moment it is required. not store in the DB */
183         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 */
184         int                   total_mail_count_on_server; /*  Specifies the total number of mails in the mailbox in the mail server */
185         int                   has_archived_mails;
186         int                   mail_slot_size;
187         int                   no_select;
188         time_t                last_sync_time;             /*  The last synchronization time */
189         int                   deleted_flag;               /*  whether mailbox is deleted */
190         int                   eas_data_length;            /*  Specifies the length of eas_data. */
191         char                  *eas_data;                  /*  Specifies the data for eas engine. */
192 } emstorage_mailbox_tbl_t;
193
194 /* mail_read_uid_tbl table entity */
195 typedef struct
196 {
197         int     account_id;
198         int     mailbox_id;
199         char   *mailbox_name;     /* server mailbox */
200         int     local_uid;
201         char   *server_uid;       /* uid on server */
202         int     rfc822_size;      /* rfc822 size */
203         int     sync_status;
204         char    flags_seen_field; /* SEEN flag */
205         char    flags_flagged_field; /* Favorite flag */
206 } emstorage_read_mail_uid_tbl_t;
207
208 #ifdef __FEATURE_BODY_SEARCH__
209 typedef struct
210 {
211         int mail_id;
212         int account_id;
213         int mailbox_id;
214         char *body_text;
215 } emstorage_mail_text_tbl_t;
216 #endif
217
218 typedef struct
219 {
220         int                    mail_id;
221         int                    account_id;
222         int                    mailbox_id;
223         int                    mailbox_type;
224         char                  *subject;
225         time_t                 date_time;
226         int                    server_mail_status;
227         char                  *server_mailbox_name;
228         char                  *server_mail_id;
229         char                  *message_id;
230         int                    reference_mail_id;
231         char                  *full_address_from;
232         char                  *full_address_reply;
233         char                  *full_address_to;
234         char                  *full_address_cc;
235         char                  *full_address_bcc;
236         char                  *full_address_return;
237         char                  *email_address_sender;
238         char                  *email_address_recipient;
239         char                  *alias_sender;
240         char                  *alias_recipient;
241         int                    body_download_status;
242         char                  *file_path_plain;
243         char                  *file_path_html;
244         char                  *file_path_mime_entity;
245         int                    mail_size;
246         char                   flags_seen_field;
247         char                   flags_deleted_field;
248         char                   flags_flagged_field;
249         char                   flags_answered_field;
250         char                   flags_recent_field;
251         char                   flags_draft_field;
252         char                   flags_forwarded_field;
253         int                    DRM_status;
254         email_mail_priority_t  priority;
255         email_mail_status_t    save_status;
256         int                    lock_status;
257         email_mail_report_t    report_status;
258         int                    attachment_count;
259         int                    inline_content_count;
260         int                    thread_id;
261         int                    thread_item_count;
262         char                  *preview_text;
263         email_mail_type_t      meeting_request_status;
264         email_message_class    message_class;
265         email_digest_type      digest_type;
266         email_smime_type       smime_type;
267         time_t                 scheduled_sending_time;
268         int                    remaining_resend_times;
269         int                    tag_id;
270         time_t                 replied_time;
271         time_t                 forwarded_time;
272         char                  *default_charset;
273         int                    eas_data_length;
274         char                  *eas_data;
275         char                  *pgp_password;
276     char                  *user_name;
277 } emstorage_mail_tbl_t;
278
279 /* mail_attachment_tbl entity */
280 typedef struct
281 {
282         int   attachment_id;
283         char *attachment_name;
284         char *attachment_path;
285         char *content_id;
286         int   attachment_size;
287         int   mail_id;
288         int   account_id;
289         int   mailbox_id;
290         int   attachment_save_status;              /* 1 : existing, 0 : not existing */
291         int   attachment_drm_type;                 /* 0 : none, 1 : object, 2 : rights, 3 : dcf */
292         int   attachment_drm_method;               /* 0 : none, 1 : FL, 2 : CD, 3 : SSD, 4 : SD */
293         int   attachment_inline_content_status;    /* 1 : inline content , 0 : not inline content */
294         char *attachment_mime_type;
295 #ifdef __ATTACHMENT_OPTI__
296         int   encoding;
297         char *section;
298 #endif
299 } emstorage_attachment_tbl_t;
300
301
302 typedef enum {
303         RETRIEVE_ALL = 1,           /*  mail */
304         RETRIEVE_ENVELOPE,          /*  mail envelope */
305         RETRIEVE_SUMMARY,           /*  mail summary */
306         RETRIEVE_FIELDS_FOR_DELETE, /*  account_id, mail_id, server_mail_yn, server_mailbox, server_mail_id */
307         RETRIEVE_ACCOUNT,           /*  account_id */
308         RETRIEVE_FLAG,              /*  mailbox, flag1, thread_id */
309         RETRIEVE_ID,                /*  mail_id */
310         RETRIEVE_ADDRESS,           /*  mail_id, contact_info */
311 } emstorage_mail_field_type_t;
312
313 typedef struct _emstorage_search_filter_t {
314         char *key_type;
315         char *key_value;
316         struct _emstorage_search_filter_t *next;
317 } emstorage_search_filter_t;
318
319 typedef enum {
320         EMAIL_CREATE_DB_NORMAL = 0,
321         EMAIL_CREATE_DB_CHECK,
322 } emstorage_create_db_type_t;
323
324
325 /*****************************************************************************
326                                                                 etc
327 *****************************************************************************/
328 #define MAX_PW_FILE_NAME_LENGTH                   128 /*  password file name for secure storage */
329
330 #ifdef __FEATURE_LOCAL_ACTIVITY__
331
332 typedef enum
333 {
334  ACTIVITY_FETCHIMAPFOLDER = 1,  /* Fetch Mail server Activity */
335  ACTIVITY_DELETEMAIL,                   /* Delete Mail Activity */
336  ACTIVITY_MODIFYFLAG,                   /* Modify Mail flag Activity */
337  ACTIVITY_MODIFYSEENFLAG,               /* Modify Mail seen flag Activity */
338  ACTIVITY_MOVEMAIL,                             /* Move Mail Activity */
339  ACTIVITY_DELETEALLMAIL,                /* Delete All Mails activity */
340  ACTIVITY_COPYMAIL,                             /* Copy Mail Activity */
341  ACTIVITY_SAVEMAIL,                             /* Save Mail activity */
342  ACTIVITY_DELETEMAIL_SEND,              /* New Delete Mail Activity added to be processed by send thread */
343 }eActivity_type;
344
345
346 /**
347  * emstorage_activity_tbl_t - Email Local activity Structure
348  *
349  */
350 typedef struct
351 {
352         int activity_id;                                /* Activity ID */
353         int account_id;                          /* Account ID */
354         int mail_id;                             /* Mail ID    */
355         int activity_type;    /* Local Activity Type */
356         char *server_mailid;                 /* Server Mail ID or Mailbox name */
357         char *src_mbox;                          /* Source Mailbox in case of mail_move */
358         char *dest_mbox;                 /* Destination Mailbox name in case of Mail move operation */
359
360 } emstorage_activity_tbl_t;
361
362 #endif
363
364 INTERNAL_FUNC int emstorage_shm_file_init(const char *shm_file_name);
365
366
367 /************** Database Management ***************/
368 /*
369  * em_db_open
370  * description  :  open db and register busy handler
371  */
372 INTERNAL_FUNC int em_db_open(char *db_file_path, sqlite3 **sqlite_handle, int *err_code);
373
374 /*
375  * emstorage_db_open
376  *
377  * description :  open db and set global variable sqlite_emmb
378  * arguments :
379  * return  :
380  */
381 INTERNAL_FUNC sqlite3* emstorage_db_open(char *multi_user_name, int *err_code);
382
383 /*
384  * emstorage_db_close
385  *
386  * description :  close db with global variable sqlite_emmb
387  * arguments :
388  * return  :
389  */
390 INTERNAL_FUNC int emstorage_db_close(char *multi_user_name, int *err_code);
391
392 /*
393  * emstorage_open
394  *
395  * description :  initialize storage manager
396  * arguments :
397  * return  :
398  */
399 INTERNAL_FUNC int emstorage_open(char *multi_user_name, int *err_code);
400
401 /*
402  * emstorage_close
403  *
404  * description :  cleanup storage manager
405  * arguments :
406  * return  :
407  */
408 INTERNAL_FUNC int emstorage_close(int *err_code);
409
410 /*
411  * emstorage_create_table
412  *
413  * description :  create account/address table in database.
414  * arguments :
415  * return  :
416  */
417 INTERNAL_FUNC int emstorage_create_table(char *multi_user_name, emstorage_create_db_type_t type, int *err_code);
418
419 INTERNAL_FUNC int emstorage_initialize_field_count();
420
421 /**
422  * Check whether there is the same account information in the db
423  *
424  * @param[in] account   account that
425  * @param[in] transaction       If the argument is true, engine commits transaction or executes rollback.
426  * @param[out] err_code Error code.
427  * @remarks N/A
428  * @return This function returns true if there is no duplicated account. returns false and set error code if there are duplicated accounts or error
429  */
430 INTERNAL_FUNC int emstorage_check_duplicated_account(char *multi_user_name, email_account_t *account, int transaction, int *err_code);
431
432 /**
433  * Get number of accounts from account table.
434  *
435  * @param[out] count            The number of accounts is saved here.
436  * @param[in] transaction       If the argument is true, engine commits transaction or executes rollback.
437  * @remarks N/A
438  * @return This function returns 0 on success or error code on failure.
439  */
440 INTERNAL_FUNC int emstorage_get_account_count(char *multi_user_name, int *count, int transaction, int *err_code);
441
442 /**
443  * Get account from account table.
444  *
445  * @param[in, out] select_num   Upon entry, the argument contains the number of accounts to select.
446                                     Upon exit, it is set to the number of accounts to been selected.
447  * @param[out] account_list             The selected accounts is saved here. this pointer must be freed after being used.
448  * @param[in] transaction               If the argument is true, engine commits transaction or executes rollback.
449  * @remarks N/A
450  * @return This function returns 0 on success or error code on failure.
451  */
452 INTERNAL_FUNC int emstorage_get_account_list(char *multi_user_name, int *select_num, emstorage_account_tbl_t **account_list, int transaction, int with_password, int *err_code);
453
454 /*
455  * emstorage_get_account_by_name
456  *
457  * description :  get account from account table by account name
458  * arguments :
459  *    db  :  database pointer
460  *    account_id  :  account id
461  *    pulloption  :  option to specify fetching full or partial data
462  *    account  :  buffer to hold selected account
463  *              this buffer must be free after it has been used.
464  * return  :
465  */
466 /* sowmya.kr, 281209 Adding signature to options in email_account_t changes */
467 INTERNAL_FUNC int emstorage_get_account_by_id(char *multi_user_name, int account_id, int pulloption, emstorage_account_tbl_t **account, int transaction, int *err_code);
468
469 /*
470  * emstorage_get_password_length_of_account
471  *
472  * description: get password length of account.
473  * arguments:
474  *    account_id : account id
475  *    password_length : password length
476  * return :
477  */
478
479 INTERNAL_FUNC int emstorage_get_password_length_of_account(char *multi_user_name, int account_id, int password_type, int *password_length, int* err_code);
480
481 INTERNAL_FUNC int emstorage_update_account_password(char *multi_user_name, int input_account_id, char *input_incoming_server_password, char *input_outgoing_server_password);
482
483 /*
484  * emstorage_update_account
485  *
486  * description :  change a account from account table
487  * arguments :
488  *    account_id  :  account id
489  *    account  :  buffer to hold selected account
490  * return  :
491  */
492 INTERNAL_FUNC int emstorage_update_account(char *multi_user_name, int account_id, emstorage_account_tbl_t *account, int transaction, int *err_code);
493
494 INTERNAL_FUNC int emstorage_set_field_of_accounts_with_integer_value(char *multi_user_name, int account_id, char *field_name, int value, int transaction);
495 /*
496  * emstorage_get_sync_status_of_account
497  *
498  * description :  get a sync status field from account table
499  * arguments :
500  *    account_id  :  account id
501  *    result_sync_status : sync status value
502  * return  :
503  */
504 INTERNAL_FUNC int emstorage_get_sync_status_of_account(char *multi_user_name, int account_id, int *result_sync_status,int *err_code);
505
506 /*
507  * emstorage_update_sync_status_of_account
508  *
509  * description :  update a sync status field from account table
510  * arguments :
511  *    account_id  :  account id
512  *    set_operator  :  set operater. refer email_set_type_t
513  *    sync_status : sync status value
514  * return  :
515  */
516 INTERNAL_FUNC int emstorage_update_sync_status_of_account(char *multi_user_name, int account_id, email_set_type_t set_operator, int sync_status, int transaction, int *err_code);
517
518
519 /*
520  * emstorage_add_account
521  *
522  * description :  add a account to account table
523  * arguments :
524  * return  :
525  */
526 INTERNAL_FUNC int emstorage_add_account(char *multi_user_name, emstorage_account_tbl_t *account, int transaction, int *err_code);
527
528 /*
529  * emstorage_delete_account
530  *
531  * description :  delete a account from account table
532  * arguments :
533  *    db  :  database pointer
534  *    account_id  :  account id to be deteted
535  * return  :
536  */
537 INTERNAL_FUNC int emstorage_delete_account(char *multi_user_name, int account_id, int transaction, int *err_code);
538
539 /*
540  * emstorage_free_account
541  *
542  * description :  free local accout memory
543  * arguments :
544  *    account_list  :  double pointer
545  *    count  :  count of local account
546  * return  :
547  */
548 INTERNAL_FUNC int emstorage_free_account(emstorage_account_tbl_t **account_list, int count, int *err_code);
549
550
551 /************** Mailbox(Local box And Imap mailbox) Management ******************/
552
553 /*
554  * emstorage_get_mailbox_count
555  *
556  * description :  get number of mailbox from local mailbox table
557  * arguments :
558  *    db  :  database pointer
559  *    count  :  number of accounts
560  * return  :
561  */
562 INTERNAL_FUNC int emstorage_get_mailbox_count(char *multi_user_name, int account_id, int local_yn, int *count, int transaction, int *err_code);
563
564 /*
565  * emstorage_get_mailbox
566  *
567  * description :  get local mailbox from local mailbox table
568  * arguments :
569  *    db  :  database pointer
570  *    sort_type          :      in - sorting type.
571  *    select_num         :      in - number of selected account
572  *                              out - number to been selected
573  *    mailbox_list       :      buffer to hold selected account
574  *                      this buffer must be free after it has been used.
575  * return  :
576  */
577 INTERNAL_FUNC int emstorage_get_mailbox_list(char *multi_user_name, 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);
578
579 /*
580  * emstorage_get_child_mailbox_list
581  *
582  * description :  get child mailbox list  from given  mailbox
583  * arguments :
584  *    account_id  :  in - account id
585  *    parent_mailbox_name  :  in - parent_mailbox_name to fetch child list
586  *    local_yn - in - local mailbox or not
587  *    select_num - out   :  count of mailboxes
588  *    mailbox_list - out  :    list of mailboxes
589  *    err_code - out  :  error code, if any
590  */
591 INTERNAL_FUNC int emstorage_get_child_mailbox_list(char *multi_user_name, int account_id, char *parent_mailbox_name, int *select_num, emstorage_mailbox_tbl_t **mailbox_list, int transaction, int *err_code);
592
593 /*
594  * emstorage_get_mailbox_by_name
595  *
596  * description :  get local mailbox from local mailbox table by mailbox name
597  * arguments :
598  *    db  :  database pointer
599  *    mailbox_name  :  mailbox name
600  *    mailbox  :  buffer to hold selected local mailbox
601  *              this buffer must be free after it has been used.
602  * return  :
603  */
604 INTERNAL_FUNC int emstorage_get_mailbox_by_name(char *multi_user_name, int account_id, int local_yn, char *mailbox_name, emstorage_mailbox_tbl_t **mailbox, int transaction, int *err_code);
605
606 INTERNAL_FUNC int emstorage_get_mailbox_by_mailbox_type(char *multi_user_name, int account_id, email_mailbox_type_e mailbox_type, emstorage_mailbox_tbl_t **mailbox, int transaction, int *err_code);
607
608 INTERNAL_FUNC int emstorage_get_mailbox_by_id(char *multi_user_name, int input_mailbox_id, emstorage_mailbox_tbl_t** output_mailbox);
609
610 INTERNAL_FUNC int emstorage_get_mailbox_by_keyword(char *multi_user_name, int account_id, char *keyword, emstorage_mailbox_tbl_t** result_mailbox, int * result_count, int transaction, int *err_code);
611
612 INTERNAL_FUNC int emstorage_get_mailbox_list_ex(char *multi_user_name, int account_id, int local_yn, int with_count, int *select_num, emstorage_mailbox_tbl_t **mailbox_list, int transaction, int *err_code);
613
614 INTERNAL_FUNC int emstorage_get_mailbox_id_by_mailbox_type(char *multi_user_name, int account_id, email_mailbox_type_e mailbox_type, int *mailbox_id, int transaction, int *err_code);
615
616 INTERNAL_FUNC int emstorage_get_mailbox_name_by_mailbox_type(char *multi_user_name, int account_id, email_mailbox_type_e mailbox_type, char **mailbox_name, int transaction, int *err_code);
617
618 INTERNAL_FUNC int emstorage_update_mailbox_modifiable_yn(char *multi_user_name, int account_id, int local_yn, char *mailbox_name, int modifiable_yn, int transaction, int *err_code);
619
620 INTERNAL_FUNC int emstorage_update_mailbox_total_count(char *multi_user_name, int account_id, int input_mailbox_id, int total_count_on_server, int transaction, int *err_code);
621
622
623 /*
624  * emstorage_update_mailbox
625  *
626  * description :  change a account from account table
627  * arguments :
628  *    db  :  database pointer
629  *    mailbox_name  :  mailbox name
630  *    mailbox  :  buffer to hold selected local mailbox
631  * return  :
632  */
633 INTERNAL_FUNC int emstorage_update_mailbox(char *multi_user_name, int account_id, int local_yn, int input_mailbox_id, emstorage_mailbox_tbl_t *mailbox, int transaction, int *err_code);
634
635 /*
636  * emstorage_update_mailbox_type
637  *
638  * description :  change a mailbox from mailbox tbl
639  * arguments :
640  * return  :
641  */
642 INTERNAL_FUNC int emstorage_update_mailbox_type(char *multi_user_name, int account_id, int local_yn, int input_mailbox_id, email_mailbox_type_e new_mailbox_type, int transaction, int *err_code);
643
644 /*
645  * emstorage_set_local_mailbox
646  *
647  * description :  change 'local' field on mailbox table.
648  * arguments :
649  * return  :
650  */
651 INTERNAL_FUNC int emstorage_set_local_mailbox(char *multi_user_name, int input_mailbox_id, int input_is_local_mailbox, int transaction);
652
653 INTERNAL_FUNC int emstorage_set_field_of_mailbox_with_integer_value(char *multi_user_name, int input_account_id, int *input_mailbox_id_array, int input_mailbox_id_count, char *input_field_name, int input_value, int transaction);
654
655 /*
656  * emstorage_add_mailbox
657  *
658  * description :  add a local mailbox to local mailbox table
659  * arguments :
660  * return  :
661  */
662 INTERNAL_FUNC int emstorage_add_mailbox(char *multi_user_name, emstorage_mailbox_tbl_t *mailbox, int transaction, int *err_code);
663
664 /*
665  * emstorage_delete_mailbox
666  *
667  * description :  delete a local mailbox from local mailbox table
668  * arguments :
669  *    db  :  database pointer
670  *    mailbox_name  :  mailbox name of record to be deteted
671  * return  :
672  */
673 INTERNAL_FUNC int emstorage_delete_mailbox(char *multi_user_name, int account_id, int local_yn, int input_mailbox_id, int transaction, int *err_code);
674
675 INTERNAL_FUNC int emstorage_rename_mailbox(char *multi_user_name, int input_mailbox_id, char *input_new_mailbox_name, char *input_new_mailbox_alias, void *input_eas_data, int input_eas_data_length, int input_transaction);
676
677 INTERNAL_FUNC int emstorage_get_overflowed_mail_id_list(char *multi_user_name, int account_id, int input_mailbox_id, int mail_slot_size, int **mail_id_list, int *mail_id_count, int transaction, int *err_code);
678
679 INTERNAL_FUNC int emstorage_set_mail_slot_size(char *multi_user_name, int account_id, int mailbox_id, int new_slot_size, int transaction, int *err_code);
680
681 INTERNAL_FUNC int emstorage_set_all_mailbox_modifiable_yn(char *multi_user_name, int account_id, int modifiable_yn, int transaction, int *err_code);
682
683 INTERNAL_FUNC int emstorage_get_mailbox_by_modifiable_yn(char *multi_user_name, int account_id, int modifiable_yn, int *select_num, emstorage_mailbox_tbl_t **mailbox_list, int transaction, int *err_code);
684
685 INTERNAL_FUNC int emstorage_stamp_last_sync_time_of_mailbox(char *multi_user_name, int input_mailbox_id, int input_transaction);
686
687 /*
688  * emstorage_free_mailbox
689  *
690  * description :  free local mailbox memory
691  * arguments :
692  *    mailbox_list  :  double pointer
693  *    count  :  count of local mailbox
694  * return  :
695  */
696 INTERNAL_FUNC int emstorage_free_mailbox(emstorage_mailbox_tbl_t **mailbox_list, int count, int *err_code);
697
698
699 /************** Read Mail UID Management ******************/
700 INTERNAL_FUNC int emstorage_get_count_read_mail_uid(char *multi_user_name, int account_id, char *mailbox_name, int *count, int transaction, int *err_code);
701
702
703 /*
704  * emstorage_check_read_mail_uid
705  *
706  * description :  check that this uid exists in uid table
707  * arguments :
708  *    db  :  database pointer
709  *    mailbox_name  :  mailbox name
710  *    uid  :  uid string to be checked
711  *    exist  :  variable to hold checking result. (0 : not exist, 1 : exist)
712  * return  :
713  */
714 INTERNAL_FUNC int emstorage_check_read_mail_uid(char *multi_user_name, int account_id, char *mailbox_name, char *uid, int *exist, int transaction, int *err_code);
715
716 /*
717  * emstorage_get_read_mail_size
718  *
719  * description :  get mail size from read mail uid
720  * arguments :
721  *    db  :  database pointer
722  *    mailbox_id  :  local mailbox id
723  *    local_uid  :  mail uid of local mailbox
724  *    mailbox_name  :  server mailbox name
725  *    uid  :  mail uid string of server mail
726  *    read_mail_uid  :  variable to hold read mail uid information
727  * return  :
728  */
729 INTERNAL_FUNC int emstorage_get_downloaded_list(char *multi_user_name, int account_id, int mailbox_id, emstorage_read_mail_uid_tbl_t **read_mail_uid, int *count, int transaction, int *err_code);
730
731 INTERNAL_FUNC int emstorage_get_downloaded_mail(char *multi_user_name, int mail_id, emstorage_mail_tbl_t **mail, int transaction, int *err_code);
732
733 /*
734  * emstorage_get_read_mail_size
735  *
736  * description :  get mail size from read mail uid
737  * arguments :
738  *    db  :  database pointer
739  *    mailbox_name  :  mailbox name
740  *    s_uid  :  mail uid string
741  *    size  :  variable to hold mail size
742  * return  :
743  */
744 INTERNAL_FUNC int emstorage_get_downloaded_mail_size(char *multi_user_name, int account_id, char *local_mbox, int local_uid, char *mailbox_name, char *uid, int *mail_size, int transaction, int *err_code);
745
746 /*
747  * emstorage_add_downloaded_mail
748  *
749  * description :  add read mail uid
750  * arguments :
751  * return  :
752  */
753 INTERNAL_FUNC int emstorage_add_downloaded_mail(char *multi_user_name, emstorage_read_mail_uid_tbl_t *read_mail_uid, int transaction, int *err_code);
754
755 #ifdef __FEATURE_BODY_SEARCH__
756 /*
757  * emstorage_add_mail_text
758  *
759  * description :  add stripped text of mail body to mail_text_tbl
760  * arguments :
761  * return  :
762  */
763 INTERNAL_FUNC int emstorage_add_mail_text(char *multi_user_name, emstorage_mail_text_tbl_t* mail_text, int transaction, int *err_code);
764 #endif
765
766 /*
767  * emstorage_change_read_mail_uid
768  *
769  * description :  modify read mail uid
770  * arguments :
771  * return  :
772  */
773 INTERNAL_FUNC int emstorage_change_read_mail_uid(char *multi_user_name, int account_id, int local_mailbox_id, int local_uid, char *mailbox_name, char *uid,
774                                      emstorage_read_mail_uid_tbl_t *read_mail_uid, int transaction, int *err_code);
775
776 /*
777  * emstorage_remove_downloaded_mail
778  *
779  * description :
780  * arguments :
781  * return  :
782  */
783 INTERNAL_FUNC int emstorage_remove_downloaded_mail(char *multi_user_name, int account_id, char *mailbox_name, char *uid, int transaction, int *err_code);
784
785 INTERNAL_FUNC int emstorage_update_read_mail_uid(char *multi_user_name, int mail_id, char *new_server_uid, char *mbox_name, int *err_code);
786
787 /*
788  *  free memroy
789  */
790 INTERNAL_FUNC int emstorage_free_read_mail_uid(emstorage_read_mail_uid_tbl_t **read_mail_uid, int count, int *err_code);
791
792
793
794 /************** Rules(Filtering) Management ******************/
795
796 /*
797  * emstorage_get_rule_count_by_account_id
798  *
799  * description :  get number of rules from rule table
800  * arguments :
801  *    db  :  database pointer
802  *    count  :  number of accounts
803  * return  :
804  */
805 INTERNAL_FUNC int emstorage_get_rule_count_by_account_id(char *multi_user_name, int account_id, int *count, int transaction, int *err_code);
806
807 /*
808  * emstorage_get_rule
809  *
810  * description :  get rules from rule table
811  * arguments :
812  *    db  :  database pointer
813  *    start_idx  :  the first index to be selected (min : 0)
814  *    select_num  :  in - number of selected account
815  *                 out - number to been selected
816  *    is_completed  :  is completed ?
817  * return  :
818  */
819 INTERNAL_FUNC int emstorage_get_rule(char *multi_user_name, 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);
820
821 /*
822  * emstorage_get_rule
823  *
824  * description :  get rules from rule table
825  * arguments :
826  * return  :
827  */
828 INTERNAL_FUNC int emstorage_get_rule_by_id(char *multi_user_name, int rule_id, emstorage_rule_tbl_t **rule, int transaction, int *err_code);
829
830 /*
831  * emstorage_change_rule
832  *
833  * description :  change a account from account table
834  * arguments :
835  *    db  :  database pointer
836  *    mailbox_name  :  mailbox name
837  *    rule  :  buffer to hold selected rule
838  * return  :
839  */
840 INTERNAL_FUNC int emstorage_change_rule(char *multi_user_name, int rule_id, emstorage_rule_tbl_t *rule, int transaction, int *err_code);
841
842 /*
843  * emstorage_find_rule
844  *
845  * description :  find a rule already exists
846  * arguments :
847  * return  :
848  */
849 INTERNAL_FUNC int emstorage_find_rule(char *multi_user_name, emstorage_rule_tbl_t *rule, int transaction, int *err_code);
850
851 /*
852  * emstorage_add_rule
853  *
854  * description :  add a rule to rule table
855  * arguments :
856  * return  :
857  */
858 INTERNAL_FUNC int emstorage_add_rule(char *multi_user_name, emstorage_rule_tbl_t *rule, int transaction, int *err_code);
859
860 /*
861  * emstorage_delete_rule
862  *
863  * description :  delete a rule from rule table
864  * arguments :
865  *    db  :  database pointer
866  *    rule  :  rule to be deteted
867  * return  :
868  */
869 INTERNAL_FUNC int emstorage_delete_rule(char *multi_user_name, int rule_id, int transaction, int *err_code);
870
871 /*
872  * emstorage_free_rule
873  *
874  * description :  free rule memory
875  * arguments :
876  *    count  :  count of rule
877  * return  :
878  */
879 INTERNAL_FUNC int emstorage_free_rule(emstorage_rule_tbl_t **rule_list, int count, int *err_code);
880
881
882 /************** Mail Management ******************/
883
884 /*
885  * emstorage_get_mail_count
886  *
887  * description :  get mail total and unseen count from mail table
888  * arguments :
889  *    total  :  total count
890  *    unseen  :  unseen mail count
891  * return  :
892  */
893 INTERNAL_FUNC int emstorage_get_mail_count(char *multi_user_name, int account_id, int mailbox_id, int *total, int *unseen, int transaction, int *err_code);
894
895 /*
896  * emstorage_get_mail_by_id
897  *
898  * description :  get mail from mail table by mail id
899  * arguments :
900  *    mail_id  :  mail id
901  *    mail  :  double pointer to hold mail
902  * return  :
903  */
904 INTERNAL_FUNC int emstorage_get_mail_by_id(char *multi_user_name, int mail_id, emstorage_mail_tbl_t **mail, int transaction, int *err_code);
905
906 #ifdef __FEATURE_BODY_SEARCH__
907 /*
908  * emstorage_get_mail_text_by_id
909  *
910  * description :  get mail_text from mail_text table by mail id
911  * arguments :
912  *    mail_id  :  mail id
913  *    mail_text  :  double pointer to hold mail_text
914  * return  :
915  */
916 INTERNAL_FUNC int emstorage_get_mail_text_by_id(char *multi_user_name, int mail_id, emstorage_mail_text_tbl_t **mail_text, int transaction, int *err_code);
917 #endif
918
919 /*
920  * emstorage_get_mail
921  *
922  * description :  get mail from mail table by mail sequence
923  * arguments :
924  *    account_id  :  account id
925  *    mailbox  :  mailbox name
926  *    mail_no  :  mail sequence number (not mail id)
927  *    mail  :  double pointer to hold mail
928  * return  :
929  */
930 INTERNAL_FUNC int emstorage_get_mail_field_by_id(char *multi_user_name, int mail_id, int type, emstorage_mail_tbl_t **mail, int transaction, int *err_code);
931
932 /*
933  * emstorage_get_mail_field_by_multiple_mail_id
934  *
935  * description :
936  * arguments :
937  *    mail_ids  :
938  *    number_of_mails  :
939  *    type  :
940  *    mail  :
941  *    transaction :
942  *    err_code :
943  * return  :
944  */
945 INTERNAL_FUNC int emstorage_get_mail_field_by_multiple_mail_id(char *multi_user_name, int mail_ids[], int number_of_mails, int type, emstorage_mail_tbl_t** mail, int transaction, int *err_code);
946
947 /*
948  * emstorage_query_mail_count
949  *
950  * description :  query mail count
951  */
952 INTERNAL_FUNC int emstorage_query_mail_count(char *multi_user_name, const char *input_conditional_clause, int input_transaction, int *output_total_mail_count, int *output_unseen_mail_count);
953 /*
954  * emstorage_query_mail_list
955  *
956  * description :  query mail id list
957  */
958 INTERNAL_FUNC int emstorage_query_mail_id_list(char *multi_user_name, const char *input_conditional_clause, int input_transaction, int **output_mail_id_list, int *output_mail_id_count);
959
960
961 /*
962  * emstorage_query_mail_list
963  *
964  * description :  query mail list information
965  */
966 INTERNAL_FUNC int emstorage_query_mail_list(char *multi_user_name, const char *conditional_clause, int transaction, email_mail_list_item_t** result_mail_list,  int *result_count,  int *err_code);
967
968
969 /*
970  * emstorage_query_mail_tbl
971  *
972  * description :  query mail table information
973  */
974 INTERNAL_FUNC int emstorage_query_mail_tbl(char *multi_user_name, const char *conditional_clause, int transaction, emstorage_mail_tbl_t** result_mail_tbl, int *result_count, int *err_code);
975
976
977 #ifdef __FEATURE_BODY_SEARCH__
978 /*
979  * emstorage_query_mail_text_tbl
980  *
981  * description :  query mail_text table information
982  */
983 INTERNAL_FUNC int emstorage_query_mail_text_tbl(char *multi_user_name, const char *conditional_clause, int transaction, emstorage_mail_text_tbl_t** result_mail_text_tbl, int *result_count, int *err_code);
984 #endif
985
986 /*
987  * emstorage_query_mailbox_tbl
988  *
989  * description :  query mail box table information
990  */
991 INTERNAL_FUNC int emstorage_query_mailbox_tbl(char *multi_user_name, 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);
992
993 /*
994  * emstorage_get_mail_list
995  *
996  * description :  search mail list information
997  */
998 INTERNAL_FUNC int emstorage_get_mail_list(char *multi_user_name, 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);
999
1000 /*
1001  * emstorage_get_mails
1002  *
1003  * description :  search mail list information
1004  */
1005 INTERNAL_FUNC int emstorage_get_mails(char *multi_user_name, 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);
1006
1007 INTERNAL_FUNC int emstorage_get_searched_mail_list(char *multi_user_name, 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);
1008
1009 INTERNAL_FUNC int emstorage_get_maildata_by_servermailid(char *multi_user_name, int mailbox_id, char *server_mail_id, emstorage_mail_tbl_t **mail, int transaction, int *err_code);
1010
1011 INTERNAL_FUNC int emstorage_get_unread_mailid(char *multi_user_name, int account_id, int vip_mode, int **mail_ids, int *mail_number, int *err_code);
1012
1013 INTERNAL_FUNC int emstorage_update_save_status(char *multi_user_name, int account_id, int *err_code);
1014
1015
1016 /**
1017  * Prepare mail search.
1018  *
1019  * @param[in] search                    Specifies the searching condition.
1020  * @param[in] account_id                Specifies the account id. if 0, all accounts.
1021  * @param[in] mailbox_id                Specifies the mailbox ID. if NULL, all mailboxes.
1022  * @param[in] sorting                   Specifies the sorting condition.
1023  * @param[out] search_handle    the searching handle is saved here.
1024  * @param[out] searched                 the result count is saved here.
1025  * @remarks N/A
1026  * @return This function returns 0 on success or error code on failure.
1027  */
1028 INTERNAL_FUNC int emstorage_mail_search_start(char *multi_user_name, 
1029                                                                                         emstorage_search_filter_t *search, 
1030                                                                                         int account_id, 
1031                                                                                         int mailbox_id, 
1032                                                                                         int sorting, 
1033                                                                                         DB_STMT *search_handle, 
1034                                                                                         int *searched, 
1035                                                                                         int transaction, 
1036                                                                                         int *err_code);
1037
1038 /*
1039  * emstorage_mail_search_result
1040  *
1041  * description :  retrieve mail as searching result
1042  * arguments :
1043  *    search_handle  :  handle to been gotten from emstorage_mail_search_start
1044  *    mail  :  double pointer to hold mail
1045  * return  :
1046  */
1047 INTERNAL_FUNC int emstorage_mail_search_result(DB_STMT search_handle, 
1048                                                                                                 emstorage_mail_field_type_t type, 
1049                                                                                                 void **data, 
1050                                                                                                 int transaction, 
1051                                                                                                 int *err_code);
1052
1053 /*
1054  * emstorage_mail_search_end
1055  *
1056  * description :  finish searching
1057  * arguments :
1058  *    search_handle  :  handle to be finished
1059  * return  :
1060  */
1061 INTERNAL_FUNC int emstorage_mail_search_end(DB_STMT search_handle, int transaction, int *err_code);
1062
1063 /*
1064  * emstorage_set_field_of_mails_with_integer_value
1065  *
1066  * description       :  update a filed of mail
1067  * arguments :
1068  *    account_id                 :  Specifies the account id.
1069  *    mail_ids       :  mail id list to be changed
1070  *    mail_ids_count :  count of mail list
1071  *    field_name     :  specified field name
1072  *    value          :  specified value
1073  * return       :
1074  */
1075 INTERNAL_FUNC int emstorage_set_field_of_mails_with_integer_value(char *multi_user_name, int account_id, int mail_ids[], int mail_ids_count, char *field_name, int value, int transaction, int *err_code);
1076
1077 #ifdef __FEATURE_BODY_SEARCH__
1078 /*
1079  * emstorage_change_mail_text_field
1080  *
1081  * description :  update mail_text data
1082  * arguments :
1083  *    mail_id  :  mail id
1084  *    mail_text  :  mail_text pointer
1085  * return  :
1086  */
1087 INTERNAL_FUNC int emstorage_change_mail_text_field(char *multi_user_name, int mail_id, emstorage_mail_text_tbl_t* mail_text, int transaction, int *err_code);
1088 #endif
1089
1090 /*
1091  * emstorage_change_mail_field
1092  *
1093  * description :  update partial mail data
1094  * arguments :
1095  *    mail_id  :  mail id
1096  *    type  :  changing type
1097  *    mail  :  mail pointer
1098  * return  :
1099  */
1100 INTERNAL_FUNC int emstorage_change_mail_field(char *multi_user_name, int mail_id, email_mail_change_type_t type, emstorage_mail_tbl_t *mail, int transaction, int *err_code);
1101
1102 /*
1103  * emstorage_increase_mail_id
1104  *
1105  * description :  increase unique mail id
1106  * arguments :
1107  *    mail_id  :  pointer to store the unique id
1108  * return  :
1109  */
1110
1111 /*
1112  * emstorage_change_mail
1113  *
1114  * description :  update mail
1115  * arguments :
1116  *    mail_id  :  mail id to be changed
1117  *    mail  :  mail pointer
1118  * return  :
1119  */
1120 INTERNAL_FUNC int emstorage_change_mail(char *multi_user_name, int mail_id, emstorage_mail_tbl_t *mail, int transaction, int *err_code);
1121
1122 INTERNAL_FUNC int emstorage_clean_save_status(char *multi_user_name, int save_status, int  *err_code);
1123
1124 INTERNAL_FUNC int emstorage_update_server_uid(char *multi_user_name, char *old_server_uid, char *new_server_uid, int *err_code);
1125
1126 INTERNAL_FUNC int emstorage_increase_mail_id(char *multi_user_name, int *mail_id, int transaction, int *err_code);
1127
1128 /*
1129  * emstorage_add_mail
1130  *
1131  * description :  add a mail to mail table
1132  * arguments :
1133  *    mail  :  mail pointer to be inserted
1134  *   get_id :  must get uinque id in function
1135  * return  :
1136  */
1137 INTERNAL_FUNC int emstorage_add_mail(char *multi_user_name, emstorage_mail_tbl_t *mail, int get_id, int transaction, int *err_code);
1138
1139 /*
1140  * emstorage_move_multiple_mails_on_db
1141  *
1142  * description :
1143  * arguments :
1144  *    account_id  :
1145  *   input_mailbox_id :
1146  *   mail_ids :
1147  *   number_of_mails :
1148  *   transaction :
1149  *   err_code :
1150  * return  :
1151  */
1152 INTERNAL_FUNC int emstorage_move_multiple_mails_on_db(char *multi_user_name, int account_id, int input_mailbox_id, int mail_ids[], int number_of_mails, int transaction, int *err_code);
1153
1154 /*
1155  * emstorage_delete_mail
1156  *
1157  * description :  delete mail from mail table
1158  * arguments :
1159  *    mail_id  :  mail id to be deleted. if 0, all mail will be deleted.
1160  *    from_server  :  delete mail on server.
1161  * return  :
1162  */
1163 INTERNAL_FUNC int emstorage_delete_mail(char *multi_user_name, int mail_id, int from_server, int transaction, int *err_code);
1164
1165 /*
1166  * emstorage_delete_mail_by_account
1167  *
1168  * description :  delete mail from mail table by account id
1169  * arguments :
1170  *    account_id  :  account id.
1171  * return  :
1172  */
1173 INTERNAL_FUNC int emstorage_delete_mail_by_account(char *multi_user_name, int account_id, int transaction, int *err_code);
1174
1175 /*
1176  * emstorage_delete_mail_by_mailbox
1177  *
1178  * description :  delete mail from mail table
1179  * arguments :
1180  *    mailbox  :  mailbox
1181  * return  :
1182  */
1183 INTERNAL_FUNC int emstorage_delete_mail_by_mailbox(char *multi_user_name, emstorage_mailbox_tbl_t *mailbox, int transaction, int *err_code);
1184
1185 /*
1186  * emstorage_delete_multiple_mails
1187  *
1188  * description :
1189  * arguments :
1190  *    mail_ids  :
1191  *    number_of_mails  :
1192  *    transaction  :
1193  *    err_code  :
1194  * return  :
1195  */
1196 INTERNAL_FUNC int emstorage_delete_multiple_mails(char *multi_user_name, int mail_ids[], int number_of_mails, int transaction, int *err_code);
1197
1198 /*
1199  * emstorage_free_mail
1200  *
1201  * description :  free memory
1202  * arguments :
1203  *    mail_list  :  mail array
1204  *    count  :  the number of array element
1205  * return  :
1206  */
1207 INTERNAL_FUNC int emstorage_free_mail(emstorage_mail_tbl_t **mail_list, int count, int *err_code);
1208
1209 #ifdef __FEATURE_BODY_SEARCH__
1210 /*
1211  * emstorage_free_mail_text
1212  *
1213  * description :  free memory
1214  * arguments :
1215  *    mail_list  :  mail_text array
1216  *    count  :  the number of array element
1217  * return  :
1218  */
1219 INTERNAL_FUNC void emstorage_free_mail_text(emstorage_mail_text_tbl_t** mail_text_list, int count, int *err_code);
1220 #endif
1221
1222 /*
1223  * emstorage_get_attachment
1224  *
1225  * description :  get attachment from attachment table
1226  * arguments :
1227  *    mail_id  :  mail id
1228  *    no  :  attachment sequence
1229  *    attachment  :  double pointer to hold attachment data
1230  * return  :
1231  */
1232 INTERNAL_FUNC int emstorage_get_attachment_count(char *multi_user_name, int mail_id, int *count, int transaction, int *err_code);
1233
1234 /*
1235  * emstorage_get_attachment_list
1236  *
1237  * description :  get attachment list from attachment table
1238  * arguments : 
1239  *    input_mail_id           : mail id
1240  *    input_transaction       : transaction option
1241  *    attachment_list         : result attachment list
1242  *    output_attachment_count : result attachment count
1243  * return  : This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR__XXX) on failure.
1244  *
1245  */
1246 INTERNAL_FUNC int emstorage_get_attachment_list(char *multi_user_name, int input_mail_id, int input_transaction, emstorage_attachment_tbl_t** output_attachment_list, int *output_attachment_count);
1247
1248
1249 /*
1250  * emstorage_get_attachment
1251  *
1252  * description :  get attachment from attachment table
1253  * arguments :
1254  *    attachment_id  :  attachment id
1255  *    attachment  :  double pointer to hold attachment data
1256  * return  :
1257  */
1258 INTERNAL_FUNC int emstorage_get_attachment(char *multi_user_name, int attachment_id, emstorage_attachment_tbl_t **attachment, int transaction, int *err_code);
1259
1260 /*
1261  * emstorage_get_attachment
1262  *
1263  * description :  get nth-attachment from attachment table
1264  * arguments :
1265  *    mail_id  :  mail id
1266  *    nth  :  index of the desired attachment (min : 1)
1267  *    attachment  :  double pointer to hold attachment data
1268  * return  :
1269  */
1270 INTERNAL_FUNC int emstorage_get_attachment_nth(char *multi_user_name, int mail_id, int nth, emstorage_attachment_tbl_t **attachment, int transaction, int *err_code);
1271
1272 /*
1273  * emstorage_get_attachment
1274  *
1275  * description :  get attachment from attachment table
1276  * arguments :
1277  *    attachment_path  :  attachment path
1278  *    attachment       :  double pointer to hold attachment data
1279  * return  :
1280  */
1281 INTERNAL_FUNC int emstorage_get_attachment_by_attachment_path(char *multi_user_name, char *attachment_path, emstorage_attachment_tbl_t **attachment, int transaction, int *err_code);
1282
1283 /*
1284  * emstorage_change_attachment_field
1285  *
1286  * description :  update partial mail attachment data
1287  * arguments :
1288  *    mail_id  :  mail id
1289  *    type  :  changing type
1290  *    mail  :  mail pointer
1291  * return  :
1292  */
1293 INTERNAL_FUNC int emstorage_change_attachment_field(char *multi_user_name, int mail_id, email_mail_change_type_t type, emstorage_attachment_tbl_t *attachment, int transaction, int *err_code);
1294
1295 /* Get new attachment id */
1296 /*
1297  * emstorage_get_new_attachment_no
1298  *
1299  * description :  Get new attachment id
1300  * arguments :
1301  *    attachment_no  :  attachment id pointer
1302  * return  :
1303  */
1304 INTERNAL_FUNC int emstorage_get_new_attachment_no(char *multi_user_name, int *attachment_no, int *err_code);
1305
1306 /* insert attachment to mail attachment table */
1307 /*
1308  * emstorage_add_attachment
1309  *
1310  * description :  insert a attachment to attachment table
1311  * arguments :
1312  *    attachment  :  attachment pointer
1313  * return  :
1314  */
1315 INTERNAL_FUNC int emstorage_add_attachment(char *multi_user_name, emstorage_attachment_tbl_t *attachment, int iscopy, int transaction, int *err_code);
1316
1317 INTERNAL_FUNC int emstorage_update_attachment(char *multi_user_name, emstorage_attachment_tbl_t *attachment, int transaction, int *err_code);
1318
1319 /* delete a mail from mail table */
1320 /*
1321  * emstorage_delete_attachment_on_db
1322  *
1323  * description :  delete attachment from attachment table
1324  * arguments :
1325  *    attachment_id  :  attachment id
1326  * return  :
1327  */
1328 INTERNAL_FUNC int emstorage_delete_attachment_on_db(char *multi_user_name, int attachment_id, int transaction, int *err_code);
1329
1330 INTERNAL_FUNC int emstorage_delete_all_attachments_of_mail(char *multi_user_name, int mail_id, int transaction, int *err_code);
1331
1332 /*
1333  * emstorage_delete_attachment_all_on_db
1334  *
1335  * description :  delete attachment from mail table
1336  * arguments :
1337  *    account_id  :  account id.
1338  *    mailbox  :  mail box
1339  * return  :
1340  */
1341 INTERNAL_FUNC int emstorage_delete_attachment_all_on_db(char *multi_user_name, int account_id, char *mailbox, int transaction, int *err_code);
1342
1343 /*
1344  * emstorage_free_attachment
1345  *
1346  * description :  free memory
1347  * arguments :
1348  *    mail_list  :  mail array
1349  *    count  :  the number of array element
1350  * return  :
1351  */
1352 INTERNAL_FUNC int emstorage_free_attachment(emstorage_attachment_tbl_t **attachment_list, int count, int *err_code);
1353
1354 INTERNAL_FUNC int emstorage_is_mailbox_full(char *multi_user_name, int account_id, email_mailbox_t *mailbox, int *result, int *err_code);
1355
1356 INTERNAL_FUNC int emstorage_get_max_mail_count();
1357
1358 INTERNAL_FUNC int emstorage_mail_get_total_diskspace_usage(unsigned long *total_usage,  int transaction, int *err_code);
1359
1360
1361 /**
1362  * begin a transaction.
1363  *
1364  * @param[in] d1        Reserved.
1365  * @param[in] d2        Reserved.
1366  * @remarks emstorage_commit_transaction or emstorage_commit_transaction must be called after this function.
1367  * @return This function returns 0 on success or error code on failure.
1368  */
1369 INTERNAL_FUNC int emstorage_begin_transaction(char *multi_user_name, void *d1, void *d2, int *err_code);
1370
1371 /**
1372  * commit a transaction.
1373  *
1374  * @param[in] d1        Reserved.
1375  * @param[in] d2        Reserved.
1376  * @remarks N/A
1377  * @return This function returns 0 on success or error code on failure.
1378  */
1379 INTERNAL_FUNC int emstorage_commit_transaction(char *multi_user_name, void *d1, void *d2, int *err_code);
1380
1381 /**
1382  * rollback db.
1383  *
1384  * @param[in] d1        Reserved.
1385  * @param[in] d2        Reserved.
1386  * @remarks N/A
1387  * @return This function returns 0 on success or error code on failure.
1388  */
1389 INTERNAL_FUNC int emstorage_rollback_transaction(char *multi_user_name, void *d1, void *d2, int *err_code);
1390
1391 /**
1392  * clear mail data from db.
1393  *
1394  * @param[in]  transaction
1395  * @param[out] err_code
1396  * @remarks N/A
1397  * @return This function returns 0 on success or error code on failure.
1398  */
1399 INTERNAL_FUNC int emstorage_clear_mail_data(char *multi_user_name, int transaction, int *err_code);
1400
1401
1402 INTERNAL_FUNC char *emstorage_make_directory_path_from_file_path(char *file_name);
1403
1404 /*
1405  * emstorage_get_save_name
1406  *
1407  * description :  get file name for saving data
1408  * arguments :
1409  *    account_id  :  account id
1410  *    mail_id  :  mail id
1411  *    atch_id  :  attachment id
1412  *    fname  :  file name
1413  *    name_buf  :  buffer to hold file name. (MAX : 512Bytes)
1414  * return  :
1415  */
1416 INTERNAL_FUNC int emstorage_get_save_name(char *multi_user_name, int account_id, int mail_id, int atch_id, char *fname, char *move_buf, char *path_buf, int maxlen, int *err_code);
1417
1418 /*
1419  * emstorage_get_dele_name
1420  *
1421  * description :  get a name for deleting contents from file system.
1422  * arguments :
1423  *    account_id  :  account id
1424  *    mail_id  :  mail id
1425  *    atch_id  :  attachment id
1426  *    fname  :  reserved
1427  *    name_buf  :  buffer to hold file name. (MAX : 512Bytes)
1428  * return  :
1429  */
1430 INTERNAL_FUNC int emstorage_get_dele_name(char *multi_user_name, int account_id, int mail_id, int atch_id, char *fname, char *name_buf, int *err_code);
1431
1432 /*
1433  * emstorage_create_dir
1434  *
1435  * description :  create directory
1436  * arguments :
1437  *    name_buf  :  buffer to hold file name. (MAX : 512Bytes)
1438  *    no  :  attachment no.
1439  * return  :
1440  */
1441 INTERNAL_FUNC int emstorage_create_dir(char *multi_user_name, int account_id, int mail_id, int atch_id, int *err_code);
1442
1443 /*
1444  * emstorage_copy_file
1445  *
1446  * description :  copy a attachment file
1447  * arguments :
1448  *    src_file  :  source file
1449  *    dst_file  :  destination file
1450  * return  :
1451  */
1452 INTERNAL_FUNC int emstorage_copy_file(char *src_file, char *dst_file, int sync_file, int *err_code);
1453
1454 /*
1455  * emstorage_move_file
1456  *
1457  * description :  move a file
1458  * arguments :
1459  *    src_file  :  source file
1460  *    dst_file  :  destination file
1461  * return  :
1462  */
1463 INTERNAL_FUNC int emstorage_move_file(char *src_file, char *dst_file, int sync_status, int *err_code);
1464
1465 /*
1466  * emstorage_move_file
1467  *
1468  * description :  delete a file
1469  * arguments :
1470  *    src_file  :  file to be deleted
1471  * return  :
1472  */
1473 INTERNAL_FUNC int emstorage_delete_file(char *src_file, int *err_code);
1474
1475 /*
1476  * emstorage_delete_dir
1477  *
1478  * description :  delete a directory
1479  * arguments :
1480  *    src_dir  :  directory to be deleted
1481  * return  :
1482  */
1483 INTERNAL_FUNC int emstorage_delete_dir(char *src_dir, int *err_code);
1484
1485
1486
1487 INTERNAL_FUNC void emstorage_flush_db_cache();
1488
1489 INTERNAL_FUNC int emstorage_test(char *multi_user_name, int mail_id, int account_id, char *full_address_to, char *full_address_cc, char *full_address_bcc, int *err_code);
1490
1491 INTERNAL_FUNC int emstorage_get_sender_list(char *multi_user_name, int account_id, int mailbox_id, int search_type, const char *search_value, email_sort_type_t sorting, email_sender_list_t** sender_list, int *sender_count,  int *err_code);
1492
1493 INTERNAL_FUNC int emstorage_free_sender_list(email_sender_list_t **sender_list, int count);
1494
1495 /* Handling Thread mail */
1496 INTERNAL_FUNC int emstorage_get_thread_information(char *multi_user_name, int thread_id, emstorage_mail_tbl_t **mail_table_data, int transaction, int *err_code);
1497
1498 INTERNAL_FUNC int emstorage_get_thread_id_of_thread_mails(char *multi_user_name, emstorage_mail_tbl_t *mail_table_data, int *thread_id, int *result_latest_mail_id_in_thread, int *thread_item_count);
1499
1500 INTERNAL_FUNC int emstorage_get_thread_id_by_mail_id(char *multi_user_name, int mail_id, int *thread_id, int *err_code);
1501
1502 INTERNAL_FUNC int emstorage_update_latest_thread_mail(char *multi_user_name, int account_id, int mailbox_id, int thread_id, int *updated_thread_id, int latest_mail_id, int thread_item_count, int noti_type, int transaction, int *err_code);
1503
1504 INTERNAL_FUNC int emstorage_get_thread_id_from_mailbox(char *multi_user_name, int account_id, int mailbox_id, char *mail_subject, int *thread_id, int *thread_item_count);
1505
1506 INTERNAL_FUNC int emstorage_update_thread_id_of_mail(char *multi_user_name, int account_id, int mailbox_id, int mail_id, int thread_id, int thread_item_count, int transaction, int *err_code);
1507
1508 #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
1509
1510 #define BULK_PARTIAL_BODY_DOWNLOAD_COUNT 10
1511 enum
1512 {
1513         ACCOUNT_IDX_MAIL_PARTIAL_BODY_ACTIVITY_TBL = 0,
1514         MAIL_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL,
1515         SERVER_MAIL_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL,
1516         ACTIVITY_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL,
1517         ACTIVITY_TYPE_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL,
1518         MAILBOX_ID_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL,
1519         MAILBOX_NAME_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL,
1520     MULTI_USER_NAME_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL
1521 };
1522
1523 INTERNAL_FUNC int   emstorage_get_pbd_activity_data(char *multi_user_name, int account_id, int input_mailbox_id, email_event_partial_body_thd** event_start, int *count, int transaction, int *err_code);
1524
1525 INTERNAL_FUNC int   emstorage_add_pbd_activity(char *multi_user_name, email_event_partial_body_thd *local_activity, int *activity_id, int transaction, int *err_code);
1526
1527 INTERNAL_FUNC int   emstorage_get_pbd_mailbox_list(char *multi_user_name, int account_id, int **mailbox_list, int *count, int transaction, int *err_code);
1528
1529 INTERNAL_FUNC int   emstorage_get_pbd_account_list(char *multi_user_name, int **account_list, int *count, int transaction, int *err_code);
1530
1531 INTERNAL_FUNC int   emstorage_get_pbd_activity_count(char *multi_user_name, int *activity_id_count, int transaction, int *err_code);
1532
1533 INTERNAL_FUNC int   emstorage_delete_full_pbd_activity_data(char *multi_user_name, int account_id, int transaction, int *err_code);
1534
1535 INTERNAL_FUNC int   emstorage_delete_pbd_activity(char *multi_user_name, int account_id, int mail_id, int activity_id, int transaction, int *err_code);
1536
1537 INTERNAL_FUNC int   emstorage_get_mailbox_pbd_activity_count(char *multi_user_name, int account_id, int input_mailbox_id, int *activity_count, int transaction, int *err_code);
1538
1539 INTERNAL_FUNC int   emstorage_update_pbd_activity(char *multi_user_name, char *old_server_uid, char *new_server_uid, char *mbox_name, int *err_code);
1540
1541 INTERNAL_FUNC int   emstorage_create_file(char *buf, size_t file_size, char *dst_file, int *err_code);
1542
1543 #endif
1544
1545 INTERNAL_FUNC int   emstorage_free_address_info_list(email_address_info_list_t **address_info_list);
1546
1547 INTERNAL_FUNC void  emstorage_create_dir_if_delete();
1548
1549 #ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
1550 INTERNAL_FUNC int emstorage_update_read_mail_uid_by_server_uid(char *multi_user_name, char *old_server_uid, char *new_server_uid, char *mbox_name, int *err_code);
1551
1552 /**
1553  * @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);
1554  * Prepare an array of mail_id and corresponding server mail id.
1555  *
1556  *@author                                       h.gahlaut@samsung.com
1557  * @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)
1558  *                                                      where 88 is the length of fixed keywords including ending null character in the QUERY to be formed
1559  * @param[out] idset                    Returns the array of mail_id and corresponding server_mail_id sorted by server_mail_ids in ascending order
1560  * @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
1561  * @param[out] err_code         Returns the error code.
1562  * @remarks                                     An Example of Query to be exexuted in this API :
1563  *                                                      SELECT local_uid, server_uid from mail_read_mail_uid_tbl where local_uid in (12, 13, 56, 78);
1564  * @return This function returns true on success or false on failure.
1565  */
1566 INTERNAL_FUNC int emstorage_get_id_set_from_mail_ids(char *multi_user_name, char *mail_ids, email_id_set_t **idset, int *id_set_count, int *err_code);
1567
1568 #endif
1569
1570 /**
1571  * @fn emstorage_filter_mails_by_rule(int account_id, int dest_mailbox_id, int dst_mailbox_type, int reset, email_rule_t *rule, int **filtered_mail_id_list, int *count_of_mails, int err_code)
1572  * Move mails by specified rule for spam filtering.
1573  *
1574  * @author                                                              kyuho.jo@samsung.com
1575  * @param[in] account_id                                Account id of the mails and the mailboxes.
1576  * @param[in] dest_mailbox_id                   Mailbox id of spam mailbox.
1577  * @param[in] dest_mailbox_type                 Mailbox id of spam mailbox.
1578  * @param[in] reset                             Tag id reset which when deleting the rule
1579  * @param[in] rule                                              Filtering rule.
1580  * @param[out] filtered_mail_id_list    Mail id list which are filtered by the rule.
1581  * @param[out] count_of_mails                   Count of mails which are filtered by the rule.
1582  * @param[out] err_code                                 Returns the error code.
1583
1584  * @remarks
1585  * @return This function returns true on success or false on failure.
1586  */
1587 INTERNAL_FUNC int emstorage_filter_mails_by_rule(char *multi_user_name, int account_id, int dest_mailbox_id, int dest_mailbox_type, int reset, emstorage_rule_tbl_t *rule, int **filtered_mail_id_list, int *count_of_mails, int *err_code);
1588
1589 INTERNAL_FUNC int emstorage_update_tag_id(char *multi_user_name, int old_filter_id, int new_filter_id, int *err_code);
1590
1591 INTERNAL_FUNC int emstorage_add_meeting_request(char *multi_user_name, int account_id, int input_mailbox_id, email_meeting_request_t *meeting_req, int transaction, int *err_code);
1592
1593 INTERNAL_FUNC int emstorage_query_meeting_request(char *multi_user_name, const char *conditional_clause, email_meeting_request_t **output_meeting_req, int *output_result_count, int transaction);
1594
1595 INTERNAL_FUNC int emstorage_get_meeting_request(char *multi_user_name, int mail_id, email_meeting_request_t **meeting_req, int transaction, int *err_code);
1596
1597 INTERNAL_FUNC int emstorage_update_meeting_request(char *multi_user_name, email_meeting_request_t *meeting_req, int transaction, int *err_code);
1598
1599 INTERNAL_FUNC int emstorage_delete_meeting_request(char *multi_user_name, int account_id, int mail_id, int input_mailbox_id, int transaction, int *err_code);
1600
1601 INTERNAL_FUNC void emstorage_free_meeting_request(email_meeting_request_t *meeting_req);
1602
1603 INTERNAL_FUNC int emstorage_write_conditional_clause_for_getting_mail_list(char *multi_user_name, 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);
1604
1605 INTERNAL_FUNC int emstorage_free_list_filter(email_list_filter_t **input_filter_list, int input_filter_count);
1606
1607 #ifdef __FEATURE_LOCAL_ACTIVITY__
1608 /*
1609 *emstorage_get_next_activity_id
1610 *
1611 *description :  get an activity id for a new activity
1612 */
1613 INTERNAL_FUNC int emstorage_get_next_activity_id(int *activity_id, int *err_code);
1614
1615  /*
1616  *emstorage_get_activity_id_list
1617  *description  :  get the list of activity ids
1618  *arguments  :
1619  *return  :
1620  *
1621  */
1622 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);
1623  /*
1624  * emstorage_add_activity
1625  *
1626  * description :  add an activity to activity table
1627  * arguments :
1628  * return  :
1629  */
1630 INTERNAL_FUNC int emstorage_add_activity(emstorage_activity_tbl_t *local_activity, int transaction, int *err_code);
1631
1632 /**
1633   *     emstorage_get_activity - Get the Local activity from the Mail activity table
1634   *
1635   */
1636 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);
1637
1638 /**
1639  * emstorage_delete_local_activity - Deletes the Local acitivity Generated based on activity_type
1640  * or based on server mail id
1641  *
1642  */
1643 INTERNAL_FUNC int emstorage_delete_local_activity(emstorage_activity_tbl_t *local_activity, int transaction, int *err_code);
1644
1645 /**
1646  * emstorage_free_local_activity - Free the allocated Activity data
1647  *
1648  *
1649  */
1650 INTERNAL_FUNC int emstorage_free_local_activity(emstorage_activity_tbl_t **local_activity_list, int count, int *err_code);
1651
1652 /**
1653  * emstorage_free_activity_id_list - Free the allocated Activity List data
1654  *
1655  *
1656  */
1657 INTERNAL_FUNC int emstorage_free_activity_id_list(int *activity_id_list, int *error_code);
1658
1659 #endif
1660 /* task begin */
1661 INTERNAL_FUNC int emstorage_add_task(char *multi_user_name, 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);
1662
1663 INTERNAL_FUNC int emstorage_delete_task(char *multi_user_name, int task_id, int transaction);
1664
1665 INTERNAL_FUNC int emstorage_update_task_status(char *multi_user_name, int task_id, email_task_status_type_t task_status, int transaction);
1666
1667 INTERNAL_FUNC int emstorage_query_task(char *multi_user_name, const char *input_conditional_clause, const char *input_ordering_clause, email_task_t **output_task_list, int *output_task_count);
1668 /* task end*/
1669
1670 INTERNAL_FUNC int emstorage_check_and_update_server_uid_by_message_id(char *multi_user_name, int account_id, email_mailbox_type_e input_mailbox_type, char *message_id, char *server_uid, int *searched_mail_id);
1671
1672 #ifdef __FEATURE_WIFI_AUTO_DOWNLOAD__
1673 INTERNAL_FUNC int emstorage_add_auto_download_activity(char *multi_user_name, email_event_auto_download *local_activity, int *activity_id, int transaction, int *err_code);
1674 INTERNAL_FUNC int emstorage_delete_auto_download_activity(char *multi_user_name, int account_id, int mail_id, int activity_id, int transaction, int *err_code);
1675 INTERNAL_FUNC int emstorage_delete_all_auto_download_activity(char *multi_user_name, int account_id, int transaction, int *err_code);
1676 INTERNAL_FUNC int emstorage_delete_auto_download_activity_by_mailbox(char *multi_user_name, int account_id, int mailbox_id, int transaction, int *err_code);
1677 INTERNAL_FUNC int emstorage_get_auto_download_activity(char *multi_user_name, int account_id, int input_mailbox_id, email_event_auto_download **event_start, int *count, int transaction, int *err_code);
1678 INTERNAL_FUNC int emstorage_get_auto_download_activity_count(char *multi_user_name, int *activity_count, int transaction, int *err_code);
1679 INTERNAL_FUNC int emstorage_get_auto_download_account_list(char *multi_user_name, int **account_list, int *count, int transaction, int *err_code);
1680 INTERNAL_FUNC int emstorage_get_auto_download_mailbox_list(char *multi_user_name, int account_id, int **mailbox_list, int *count, int transaction, int *err_code);
1681 INTERNAL_FUNC int emstorage_get_auto_download_activity_count_by_mailbox(char *multi_user_name, int account_id, int input_mailbox_id, int *activity_count, int transaction, int *err_code);
1682 INTERNAL_FUNC int emstorage_update_auto_download_activity(char *multi_user_name, char *old_server_uid, char *new_server_uid, char *mailbox_name, int mailbox_id, int *err_code);
1683 #endif
1684
1685 #ifdef __FEATURE_UPDATE_DB_TABLE_SCHEMA__
1686 INTERNAL_FUNC int emstorage_update_db_table_schema(char *multi_user_name);
1687 #endif /* __FEATURE_UPDATE_DB_TABLE_SCHEMA__ */
1688
1689 #ifdef __cplusplus
1690 }
1691 #endif /* __cplusplus */
1692
1693 #endif /* __EMAIL_STORAGE_H__ */
1694 /* EOF */