4 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
23 /******************************************************************************
24 * File : email-core-mailbox_sync.h
25 * Desc : Mail Header Sync Header
30 * 2006.08.16 : created
31 *****************************************************************************/
32 #ifndef __EMAIL_CORE_MAILBOX_SYNC_H__
33 #define __EMAIL_CORE_MAILBOX_SYNC_H__
35 #include "email-types.h"
36 #include "email-storage.h"
42 #endif /* __cplusplus */
44 #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
46 #define IMAGE_DISPLAY_PARTIAL_BODY_COUNT 30
49 char image_file_name[100];
62 } email_partial_buffer;
66 typedef struct emcore_uid_elem {
69 email_mail_flag_t flag;
70 struct emcore_uid_elem *next;
73 int pop3_mail_calc_rfc822_size(MAILSTREAM *stream, int msgno, int *size, int *err_code);
74 int pop3_mailbox_get_uids(MAILSTREAM *stream, emcore_uid_list** uid_list, int *err_code);
76 int imap4_mail_calc_rfc822_size(MAILSTREAM *stream, int msgno, int *size, int *err_code);
77 int imap4_mailbox_get_uids(MAILSTREAM *stream, emcore_uid_list** uid_list, int *err_code);
79 int emcore_check_rule(const char *input_full_address_from, const char *input_subject, emstorage_rule_tbl_t *rule, int rule_len, int *matched, int *err_code);
81 int emcore_make_mail_tbl_data_from_envelope(MAILSTREAM *mail_stream, ENVELOPE *input_envelope, emcore_uid_list *input_uid_elem, emstorage_mail_tbl_t **output_mail_tbl_data, int *err_code);
83 int emcore_add_mail_to_mailbox(emstorage_mailbox_tbl_t *input_maibox_data, emstorage_mail_tbl_t *input_new_mail_tbl_data, int *output_mail_id, int *output_thread_id);
86 * Download unread all headers from mail server.
88 * @param[in] input_mailbox_tbl Specifies the mailbox to contain target mailbox name.
89 * if the mailbox name is NULL, headers are downloaded from all synchronous mailbox.
90 * the mailbox name is unused in POP3 case.
91 * @param[in] input_mailbox_tbl_spam Mailbox information of Spambox for filtering blocked mails.
92 * @param[in] stream_recycle Stream to reuse.
93 * @param[out] err_code Specifies the error code returned.
95 * @return This function returns true on success or false on failure.
97 INTERNAL_FUNC int emcore_sync_header(emstorage_mailbox_tbl_t *input_mailbox_tbl, emstorage_mailbox_tbl_t *input_mailbox_tbl_spam, void *stream_recycle, emcore_uid_list **input_uid_list, int *unread_mail, int *err_code);
101 EM_CORE_GET_UIDS_FOR_NO_DELETE = 0,
102 EM_CORE_GET_UIDS_FOR_DELETE,
103 } emcore_get_uids_for_delete_t;
105 * Download UID list from mail server.
107 * @param[in] mailbox Specifies the mailbox to contain target mailbox name.
108 * the mailbox name is unused in POP3 case.
109 * @param[out] uid_list The returned UID list is saved in a memory. this argument points to the list.
110 * @param[out] total Specifies the count of the uid_list.
111 * @param[in] read_mail_uids Specifies the array of the uids have the seen flag.
112 * @param[in] count Specifies the count of read_mail_uids.
113 * @param[in] for_delete Specifies the flag for deleting. (0 = for downloading or retrieving body, 1 = for deleting message)
114 * @param[out] err_code Specifies the error code returned.
116 * @return This function returns true on success or false on failure.
118 int emcore_download_uid_all(email_internal_mailbox_t *mailbox,
119 emcore_uid_list **uid_list,
121 emstorage_read_mail_uid_tbl_t *read_mail_uids,
123 emcore_get_uids_for_delete_t for_delete,
129 * Search a UID from mail server. this function is supported for only IMAP account.
131 * @param[in] mailbox Specifies the mailbox to contain target mailbox name.
132 * @param[in] uid Specifies the mail uid.
133 * @param[out] msgno The message number to be related to uid is saved here.
134 * @param[out] err_code Specifies the error code returned.
136 * @return This function returns true on success or false on failure.
138 int emcore_download_imap_msgno(email_internal_mailbox_t *mailbox, char *uid, int *msgno, int *err_code);
141 * Get a message number to be related to uid.
143 * @param[in] uid_list Specifies the uid list.
144 * @param[in] uid Specifies the mail uid.
145 * @param[out] msgno The message number to be related to uid is saved here.
146 * @param[out] err_code Specifies the error code returned.
147 * @remarks The uid list must be already saved in fpath before this fucntion is called.
148 * @return This function returns true on success or false on failure.
150 int emcore_get_msgno(emcore_uid_list *uid_list, char *uid, int *msgno, int *err_code);
153 * Get a uid to be related to a message number.
155 * @param[in] uid_list Specifies the uid list.
156 * @param[in] msgno Specifies the message number.
157 * @param[out] uid The message uid is saved here.
158 * @param[out] err_code Specifies the error code returned.
159 * @remarks The uid list must be already saved in fpath before this fucntion is called.
160 * @return This function returns true on success or false on failure.
162 int emcore_get_uid(emcore_uid_list *uid_list, int msgno, char **uid, int *err_code);
167 * @param[in] uid_list Specifies the fetch data.
168 * @param[out] err_code Specifies the error code returned.
169 * @return This function returns true on success or false on failure.
171 int emcore_free_uids(emcore_uid_list *uid_list, int *err_code);
173 INTERNAL_FUNC int emcore_sync_mail_from_client_to_server(int mail_id);
175 #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
176 INTERNAL_FUNC int emcore_download_bulk_partial_mail_body(MAILSTREAM *stream, email_event_partial_body_thd *pbd_event, int count, int *error);
177 #endif /* __FEATURE_PARTIAL_BODY_DOWNLOAD__ */
182 #endif /* __cplusplus */