diff options
author | Kim Kibum <kb0929.kim@samsung.com> | 2012-04-29 17:00:22 +0900 |
---|---|---|
committer | Kim Kibum <kb0929.kim@samsung.com> | 2012-04-29 17:00:22 +0900 |
commit | 328e0f651f27a1c11ca81f19a2ba54b720ef1359 (patch) | |
tree | 13919877947a51a69e6b63c9e04846942e4e480e /email-core/include | |
parent | 0a019153217b1e27bc7ada4a27ef2930cb671191 (diff) | |
download | email-service-328e0f651f27a1c11ca81f19a2ba54b720ef1359.tar.gz email-service-328e0f651f27a1c11ca81f19a2ba54b720ef1359.tar.bz2 email-service-328e0f651f27a1c11ca81f19a2ba54b720ef1359.zip |
upload tizen1.0 source
Diffstat (limited to 'email-core/include')
23 files changed, 864 insertions, 1375 deletions
diff --git a/email-core/include/em-core-account.h b/email-core/include/em-core-account.h deleted file mode 100755 index 4cc92a4..0000000 --- a/email-core/include/em-core-account.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -* email-service -* -* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. -* -* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com> -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*/ - - - -/****************************************************************************** - * File : em-core-account.h - * Desc : Account Management - * * Auth : - * * History : - * 2010.08.25 : created - *****************************************************************************/ -#ifndef _EM_CORE_ACCOUNT_H_ -#define _EM_CORE_ACCOUNT_H_ - -#include "emf-types.h" -#include "em-core-types.h" -#include "em-storage.h" - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -EXPORT_API emf_account_t *em_core_get_account_reference(int account_id); - -EXPORT_API int em_core_account_validate(int account_id, int *err_code); - -EXPORT_API int em_core_account_delete(int account_id, int *err_code); - -EXPORT_API int em_core_account_create(emf_account_t *account, int *err_code); - -EXPORT_API int em_core_init_account_reference(); - -EXPORT_API int em_core_refresh_account_reference(); - -EXPORT_API int em_core_free_account_reference(); - -EXPORT_API int em_core_account_free(emf_account_t **account_list, int count, int *err_code); - -EXPORT_API int em_core_account_get_list_refer(emf_account_t **account_list, int *count, int *err_code); - -EXPORT_API int em_core_account_validate_with_account_info(emf_account_t *account, int *err_code); - -EXPORT_API int em_core_query_server_info(const char* domain_name, emf_server_info_t **result_server_info); - -EXPORT_API int em_core_free_server_info(emf_server_info_t **target_server_info); - -EXPORT_API int em_core_save_default_account_id(int input_account_id); - -EXPORT_API int em_core_load_default_account_id(int *output_account_id); - - -#ifdef __FEATURE_BACKUP_ACCOUNT__ -EXPORT_API int em_core_backup_accounts(const char *file_path, int *error_code); - -EXPORT_API int em_core_restore_accounts(const char *file_path, int *error_code); -#endif /* __FEATURE_BACKUP_ACCOUNT_ */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /*_EM_CORE_ACCOUNT_H_*/ - diff --git a/email-core/include/em-core-api.h b/email-core/include/em-core-api.h deleted file mode 100755 index 5519058..0000000 --- a/email-core/include/em-core-api.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -* email-service -* -* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. -* -* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com> -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*/ - - -/****************************************************************************** - * File : em-core-api.h - * Desc : Mail Engine API Header - * - * Auth : - * - * History : - * 2006.08.16 : created - *****************************************************************************/ -#ifndef _EM_CORE_API_H_ -#define _EM_CORE_API_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - -int em_core_encode_base64(char *src, unsigned long src_len, char **enc, unsigned long* enc_len, int *err_code); - -int em_core_decode_quotedprintable(unsigned char *enc_text, unsigned long enc_len, char **dec_text, unsigned long*dec_len, int *err_code); - -int em_core_decode_base64(unsigned char *enc_text, unsigned long enc_len, char **dec_text, unsigned long* dec_len, int *err_code); - -int em_core_init(int *err_code); - -/* em_core_set_logout_status - Set the logout status */ -EXPORT_API void em_core_set_logout_status(int status); - -/* em_core_get_logout_status - Get the logout status */ -EXPORT_API void em_core_get_logout_status(int *status); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /*_EM_CORE_API_H_*/ diff --git a/email-core/include/em-core-event.h b/email-core/include/em-core-event.h deleted file mode 100755 index a60963c..0000000 --- a/email-core/include/em-core-event.h +++ /dev/null @@ -1,96 +0,0 @@ -/* -* email-service -* -* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. -* -* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com> -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*/ - - -/****************************************************************************** - * File : em-core-event.h - * Desc : Mail Engine Event Header - * - * Auth : - * - * History : - * 2006.08.16 : created - *****************************************************************************/ -#ifndef __EM_CORE_EVNET_H__ -#define __EM_CORE_EVNET_H__ - -#include "emf-types.h" -#include "em-core-types.h" - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - -#if !defined(EXPORT_API) -#define EXPORT_API __attribute__((visibility("default"))) -#endif - -void em_core_execute_event_callback(emf_action_t action, int total, int done, int status, int account_id, int mail_id, int handle, int error); -int em_core_get_active_queue_idx(void); - -EXPORT_API int em_core_get_current_thread_type(); -EXPORT_API int em_core_register_event_callback(emf_action_t action, emf_event_callback callback, void *event_data); -EXPORT_API int em_core_unregister_event_callback(emf_action_t action, emf_event_callback callback); -EXPORT_API int em_core_get_pending_event(emf_action_t action, int account_id, int mail_id, emf_event_status_type_t *status); -EXPORT_API int em_core_event_loop_start(int *err_code); -EXPORT_API int em_core_event_loop_stop(int *err_code); -EXPORT_API int em_core_insert_event(emf_event_t *event_data, int *handle, int *err_code); -EXPORT_API int em_core_cancel_thread(int handle, void *arg, int *err_code); -EXPORT_API int em_core_send_event_loop_start(int *err_code); -EXPORT_API int em_core_send_event_loop_stop(int *err_code); -EXPORT_API int em_core_cancel_send_mail_thread(int handle, void *arg, int *err_code); -EXPORT_API int em_core_check_thread_status(void); -EXPORT_API void em_core_get_event_queue_status(int *on_sending, int *on_receiving); -EXPORT_API int em_core_insert_send_event(emf_event_t *event_data, int *handle, int *err_code); -EXPORT_API int em_core_get_receiving_event_queue(emf_event_t **event_queue, int *event_count, int *err); -EXPORT_API int em_core_cancel_all_threads_of_an_account(int account_id); -EXPORT_API int em_core_free_event(emf_event_t *event_data); - -#ifdef _CONTACT_SUBSCRIBE_CHANGE_ -EXPORT_API int em_core_contact_sync_handler(); -EXPORT_API int em_core_init_last_sync_time(void); -EXPORT_API int em_core_set_last_sync_time(int sync_time); -EXPORT_API int em_core_get_last_sync_time(void); -EXPORT_API int em_core_contact_sync_handler(); -#endif - -#ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__ -/* Please contact -> Himanshu [h.gahlaut@samsung.com] for any explanation in code here under this MACRO */ -EXPORT_API int em_core_insert_partial_body_thread_event(emf_event_partial_body_thd *partial_body_thd_event, int *error_code); -EXPORT_API int em_core_is_partial_body_thd_que_empty(); -EXPORT_API int em_core_is_partial_body_thd_que_full(); -EXPORT_API int em_core_partial_body_thread_loop_start(int *err_code); -EXPORT_API int em_core_clear_partial_body_thd_event_que(int *err_code); -EXPORT_API int em_core_free_partial_body_thd_event(emf_event_partial_body_thd *partial_body_thd_event, int *error_code); -EXPORT_API unsigned int em_core_get_partial_body_thd_id(); -EXPORT_API int em_core_get_pbd_thd_state(); -unsigned int em_core_get_receiving_thd_id(); -#endif - - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif diff --git a/email-core/include/em-core-imap-idle.h b/email-core/include/em-core-imap-idle.h deleted file mode 100755 index 0bce49f..0000000 --- a/email-core/include/em-core-imap-idle.h +++ /dev/null @@ -1,132 +0,0 @@ -/* -* email-service -* -* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. -* -* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com> -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*/ - - -/** - * - * This file contains functinality related to IMAP IDLE. - * @file em-core-imap-idle.h - * @author - * @version 0.1 - * @brief This file contains functionality to provide IMAP IDLE support in email-service. - */ - -#include "emflib.h" - - -/** - - * @open - * @fn em_core_imap_idle_thread_create(int *err_code) - * @brief Creates a thread that listens for IMAP IDLE Notifications. - * - * @param[out] err_code Specifies the error code returned. - * @remarks N/A - * @return This function returns true on success or false on failure. - */ - -EXPORT_API int em_core_imap_idle_thread_create(int accountID, int *err_code); - -/** - - * @open - * @fn em_core_imap_idle_thread_kill(int *err_code) - * @brief Kills IMAP IDLE thread - * - * @param[out] err_code Specifies the error code returned. - * @remarks N/A - * @return This function returns true on success or false on failure. - */ -EXPORT_API int em_core_imap_idle_thread_kill(int *err_code); - - - -/** - - * @open - * @fn em_core_imap_idle_run(int *err_code, int iAccountID) - * @brief Make a list of mailboxes to IDLE on, connect to all mailboxes in list and start idle loop - * - * @param[out] err_code Specifies the error code returned. - * @remarks N/A - * @return This function returns true on success or false on failure. - */ - -static int em_core_imap_idle_run(int iAccountID); - -/** - - * @open - * @fn em_core_imap_idle_loop_start(emf_mailbox_t *mailbox_list, int num, int *err_code) - * @brief starts a loop which waits on select call. Select call monitors all the socket descriptors in the hold_connection fields of mailbox_list - * - * @param[in] mailbox_list list of mailboxes - * @param[in] num Count of mailboxes in list - * @param[out] err_code Specifies the error code returned. - * @remarks N/A - * @return This function returns true on success or false on failure. - */ -static int em_core_imap_idle_loop_start(emf_mailbox_t *mailbox_list, int num, int *err_code); - - - -/** - - * @open - * @fn em_core_imap_idle_loop_start(emf_mailbox_t *mailbox_list, int num, int *err_code) - * @brief Creates and inserts an event in event queue for syncing mailbox - * - * @param[in] mailbox mailbox to be synced. - * @param[out] err_code Specifies the error code returned. - * @remarks N/A - * @return This function returns true on success or false on failure. - */ -static int em_core_imap_idle_insert_sync_event(emf_mailbox_t *mailbox, int *err_code); - - - -/** - - * @open - * @fn em_core_imap_idle_connect_and_idle_on_mailbox(emf_mailbox_t *mailbox, int *err_code) - * @brief Opens connection to mailbox(selects mailbox) and sends IDLE command - * - * @param[in] mailbox mailbox to IDLE on. - * @param[out] err_code Specifies the error code returned. - * @remarks N/A - * @return This function returns true on success or false on failure. - */ -static int em_core_imap_idle_connect_and_idle_on_mailbox(emf_mailbox_t *mailbox, int *err_code); - - - -/** - - * @open - * @fn em_core_imap_idle_parse_response_stream(emf_mailbox_t *mailbox, int *err_code) - * @brief Gets and parsee the IDLE notification coming from network - * - * @param[in] mailbox mailbox that got IDLE notification. - * @param[out] err_code Specifies the error code returned. - * @remarks N/A - * @return This function returns true on success or false on failure. - */ -static int em_core_imap_idle_parse_response_stream(emf_mailbox_t *mailbox, int *err_code); diff --git a/email-core/include/em-core-mailbox.h b/email-core/include/em-core-mailbox.h deleted file mode 100755 index 9c1066d..0000000 --- a/email-core/include/em-core-mailbox.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -* email-service -* -* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. -* -* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com> -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*/ - - - -/****************************************************************************** - * File : em-core-mailbox.h - * Desc : Local Mailbox Management Header - * - * Auth : - * - * History : - * 2006.08.16 : created - *****************************************************************************/ -#ifndef __EM_CORE_MAILBOX_H__ -#define __EM_CORE_MAILBOX_H__ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#include "c-client.h" - -#if !defined(EXPORT_API) -#define EXPORT_API __attribute__((visibility("default"))) -#endif - -typedef enum -{ - EM_CORE_STREAM_TYPE_RECV = 0, - EM_CORE_STREAM_TYPE_SEND, -} em_core_stream_type_t; - -#ifdef __FEATURE_KEEP_CONNECTION__ -EXPORT_API int em_core_remove_connection_info(int account_id); -#endif /* __FEATURE_KEEP_CONNECTION__ */ -/* in SMTP case, path argument must be (ENCODED_PATH_SMTP) */ -/* ex) em_core_mailbox_open(xxx, (char *)ENCODED_PATH_SMTP, xxx, xxx); */ -EXPORT_API int em_core_mailbox_open_with_account_info(emf_account_t *ref_account, char *mailbox, void **mail_stream, int *err_code); -EXPORT_API int em_core_mailbox_open(int account_id, char *mailbox, void **mail_stream, int *err_code); -EXPORT_API int em_core_mailbox_close(int account_id, void *mail_stream); -#ifdef __FEATURE_KEEP_CONNECTION__ -EXPORT_API void em_core_close_receiving_stream(); -EXPORT_API void em_core_close_partial_body_stream(); -EXPORT_API void em_core_reset_streams(); -#endif - -EXPORT_API int em_core_mailbox_get_list_to_be_sync(int account_id, emf_mailbox_t **mailbox_list, int *p_count, int *err_code); -EXPORT_API int em_core_mailbox_get_list(int account_id, emf_mailbox_t **mailbox_list, int *p_count, int *err_code); -EXPORT_API int em_core_mailbox_free(emf_mailbox_t **mailbox_list, int count, int *err_code); -EXPORT_API int em_core_mailbox_get_mail_count(emf_mailbox_t *mailbox, int *total, int *unseen, int *err_code); -EXPORT_API int em_core_mailbox_create(emf_mailbox_t *new_mailbox, int on_server, int *err_code); -EXPORT_API int em_core_mailbox_delete(emf_mailbox_t *mailbox, int on_server, int *err_code); -EXPORT_API int em_core_mailbox_delete_all(emf_mailbox_t *mailbox, int *err_code); -EXPORT_API int em_core_mailbox_update(emf_mailbox_t *old_mailbox, emf_mailbox_t *new_mailbox, int *err_code); -EXPORT_API int em_core_save_local_activity_sync(int account_id, int *err_code); -EXPORT_API void em_core_bind_mailbox_type(emf_mailbox_t *mailbox_list); -EXPORT_API int em_core_send_mail_event(emf_mailbox_t *mailbox, int mail_id , int *err_code); -EXPORT_API int em_core_partial_body_thd_local_activity_sync(int *is_event_inserted, int *err_code); -EXPORT_API int em_core_get_mailbox_by_type(int account_id, emf_mailbox_type_e mailbox_type, emf_mailbox_t *spam_mailbox, int *err_code); - -#ifdef __LOCAL_ACTIVITY__ -EXPORT_API int em_core_local_activity_sync(int account_id, int *err_code); -EXPORT_API int em_core_save_local_activity_sync(int account_id, int *err_code); -#endif - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif diff --git a/email-core/include/em-core-mesg.h b/email-core/include/em-core-mesg.h deleted file mode 100755 index b40949a..0000000 --- a/email-core/include/em-core-mesg.h +++ /dev/null @@ -1,232 +0,0 @@ -/* -* email-service -* -* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. -* -* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com> -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*/ - - -/****************************************************************************** - * File : em-core-mesg.h - * Desc : Mail Operation Header - * - * Auth : - * - * History : - * 2006.08.16 : created - *****************************************************************************/ -#ifndef __EM_CORE_MESSAGE_H__ -#define __EM_CORE_MESSAGE_H__ - -#include "em-storage.h" -#include <contacts-svc.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#if !defined(EXPORT_API) -#define EXPORT_API __attribute__((visibility("default"))) -#endif - -#define HTML_EXTENSION_STRING ".htm" -#define MAX_PATH_HTML 256 - -#ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__ - -#define MAX_SUBSET_STRING_SIZE 260 -#define MAX_IMAP_COMMAND_LENGTH 1000 -#define MAX_TAG_SIZE 16 - - -typedef struct _emf_uid_range_set -{ - char *uid_range; - unsigned long lowest_uid; - unsigned long highest_uid; - - struct _emf_uid_range_set *next; - -} emf_uid_range_set; - -#endif - - -struct _m_content_info -{ - int grab_type; /* 1 : download text and get attachment names (no saving attachment) - #define GRAB_TYPE_TEXT retrieve text and attachment names */ - /* 2 : download attachment - #define GRAB_TYPE_ATTACHMENT retrieve only attachment */ - int file_no; /* attachment no to be download (min : 1) */ - int report; /* 0 : Non 1 : DSN mail 2 : MDN mail 3 : mail to require MDN */ - - struct text_data - { - char *plain; /* body plain text */ - char *plain_charset; /* charset of body text */ - char *html; /* body html text */ - } text; - - struct attachment_info - { - int type; /* 1 : inline 2 : attachment */ - char *name; /* attachment filename */ - int size; /* attachment size */ - char *save; /* content saving filename */ - int drm; /* 0 : none 1 : object 2 : rights 3 : dcf */ - int drm2; /* 0 : none 1 : FL 2 : CD 3 : SSD 4 : SD */ -#ifdef __ATTACHMENT_OPTI__ - int encoding; /* encoding */ - char *section; /* section number */ -#endif - struct attachment_info *next; - } *file; -}; - - -/** - * Download email body from server. - * - * @param[in] mail_stream Specifies the mail_stream. - * @param[in] mailbox Specifies the mailbox to contain account ID. - * @param[in] mail_id Specifies the mail ID. - * @param[in] callback Specifies the callback function for retrieving download status. - * @param[in] with_attach Specifies the flag for downloading attachments. - * @param[in] limited_size Specifies the size to be downloaded. - * @param[out] err_code Specifies the error code returned. - * @remarks In POP3 case, body and attachment are downloaded in this function. - * In IMAP case, body and attachment list are downloaded and - * attachments must be downloaded in em_core_mail_download_attachment. - * @return This function returns true on success or false on failure. - */ - -EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream, int account_id, int mail_id, int verbose, int with_attach, int limited_size, int event_handle , int *err_code); - - -/** - * Download a email nth-attachment from server. - * - * @param[in] mailbox Specifies the mailbox to contain account ID. - * @param[in] mail_id Specifies the mail ID. - * @param[in] nth Specifies the buffer that a attachment number been saved. the minimum number is "1". - * @param[in] callback Specifies the callback function for retrieving download status. - * @param[in] handle Specifies the handle for stopping downloading. - * @param[out] err_code Specifies the error code returned. - * @remarks This function is used for only IMAP mail. - * @return This function returns true on success or false on failure. - */ -EXPORT_API int em_core_mail_download_attachment(int acconut_id, int mail_id, char *nth, int *err_code); - -EXPORT_API int em_core_mail_get_info(int mail_id, emf_mail_info_t **info, int *err_code); -EXPORT_API int em_core_mail_get_header(int mail_id, emf_mail_head_t **head, int *err_code); -EXPORT_API int em_core_mail_get_body(int mail_id, emf_mail_body_t **body, int *err_code); -EXPORT_API int em_core_mail_move(int mail_ids[], int num, char *dst_mailbox_name, int noti_param_1, int noti_param_2, int *err_code); -EXPORT_API int em_core_mail_add_attachment(int mail_id, emf_attachment_info_t *attachment, int *err_code); -EXPORT_API int em_core_mail_delete_attachment(int mail_id, char *attachment_id, int *err_code); -EXPORT_API int em_core_mail_add_attachment_data(int input_mail_id, emf_attachment_data_t *input_attachment_data); - - -#ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__ -EXPORT_API int em_core_insert_pbd_activity(emf_event_partial_body_thd *local_activity, int *activity_id, int *err_code) ; -EXPORT_API int em_core_delete_pbd_activity(int account_id, int mail_id, int activity_id, int *err_code); -#endif - -EXPORT_API int em_core_mail_get_contact_info(emf_mail_contact_info_t *contact_info, char *full_address, int *err_code); -EXPORT_API int em_core_mail_get_contact_info_with_update(emf_mail_contact_info_t *contact_info, char *full_address, int mail_id, int *err_code); -EXPORT_API int em_core_mail_free_contact_info(emf_mail_contact_info_t *contact_info, int *err_code); -EXPORT_API int em_core_mail_contact_sync(int mail_id, int *err_code); -EXPORT_API GList *em_core_get_recipients_list(GList *old_recipients_list, char *full_address, int *err_code); -EXPORT_API int em_core_mail_get_address_info_list(int mail_id, emf_address_info_list_t **address_info_list, int *err_code); -EXPORT_API int em_core_mail_get_display_name(CTSvalue *contact_name_value, char **contact_display_name); -EXPORT_API int em_core_mail_get_mail(int msgno, emf_mail_t **mail, int *err_code); -EXPORT_API int em_core_get_mail_data(int input_mail_id, emf_mail_data_t **output_mail_data); - -EXPORT_API int em_core_mail_update_old(int mail_id, emf_mail_t *src_mail, emf_meeting_request_t *src_meeting_req, int *err_code); -EXPORT_API int em_core_update_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int sync_server); - -EXPORT_API int em_core_fetch_flags(int account_id, int mail_id, emf_mail_flag_t *mail_flag, int *err_code); -EXPORT_API int em_core_mail_delete_from_local(int account_id, int *mail_ids, int num, int noti_param_1, int noti_param_2, int *err_code); -EXPORT_API int em_core_mail_get_msgno_by_uid(emf_account_t *account, emf_mailbox_t *mailbox, char *uid, int *msgno, int *err_code); - -/** - * Delete mails. - * - * @param[in] account_id Specifies the account id. - * @param[in] mail_id Specifies the array for mail id. - * @param[in] num Specifies the number of id. - * @param[in] from_server Specifies whether mails is deleted from server. - * @param[in] callback Specifies the callback function for delivering status during deleting. - * @param[in] noti_param_1 Specifies the first parameter for notification. - * @param[in] noti_param_2 Specifies the second parameter for notification. - * @param[out] err_code Specifies the error code returned. - * @remarks N/A - * @return This function returns true on success or false on failure. - */ -EXPORT_API int em_core_mail_delete(int account_id, int mail_id[], int num, int from_server, int noti_param_1, int noti_param_2, int *err_code); - -/** - * Delete mails. - * - * @param[in] mailbox Specifies the mailbox. this argument is for account id or mailbox name. - * @param[in] with_server Specifies whether mails is also deleted from server. - * @param[in] callback Specifies the callback function for delivering status during deleting. - * @param[out] err_code Specifies the error code returned. - * @remarks N/A - * @return This function returns true on success or false on failure. - */ -EXPORT_API int em_core_mail_delete_all(emf_mailbox_t *mailbox, int with_server, int *err_code); - -EXPORT_API int em_core_mail_info_free(emf_mail_info_t **mail_info_list, int count, int *err_code); -EXPORT_API int em_core_mail_body_free(emf_mail_body_t **mail_body_list, int count, int *err_code); -EXPORT_API int em_core_mail_head_free(emf_mail_head_t **mail_head_list, int count, int *err_code); -EXPORT_API int em_core_mail_free(emf_mail_t **mail_list, int count, int *err_code); -EXPORT_API int em_core_free_mail_data(emf_mail_data_t **mail_list, int count, int *err_code); -EXPORT_API void em_core_mime_free_content_info(struct _m_content_info *cnt_info); -EXPORT_API int em_core_mail_attachment_info_free(emf_attachment_info_t **atch_info, int *err_code); -EXPORT_API int em_core_free_attachment_data(emf_attachment_data_t **attachment_data_list, int attachment_data_count, int *err_code); - -EXPORT_API int em_core_mail_move_from_server(int account_id, char *src_mailbox, int mail_ids[], int num, char *dest_mailbox, int *error_code); -EXPORT_API int em_core_mail_sync_flag_with_server(int mail_id, int *err_code); -EXPORT_API int em_core_mail_sync_seen_flag_with_server(int mail_ids[], int num, int *err_code); -EXPORT_API int em_core_mail_get_attachment(int mail_id, char *attachment_no, emf_attachment_info_t **attachment, int *err_code); -EXPORT_API int em_core_get_attachment_data_list(int input_mail_id, emf_attachment_data_t **output_attachment_data, int *output_attachment_count); -EXPORT_API int em_core_mail_modify_extra_flag(int mail_id, emf_extra_flag_t new_flag, int *err_code); -EXPORT_API int em_core_mail_modify_flag(int mail_id, emf_mail_flag_t new_flag, int sticky_flag, int *err_code); -EXPORT_API int em_core_mail_get_size(int mail_id, int *mail_size, int *err_code); -EXPORT_API int em_core_mail_set_flags_field(int account_id, int mail_ids[], int num, emf_flags_field_type field_type, int value, int *err_code); -EXPORT_API char* em_core_convert_mutf7_to_utf8(char *mailbox_name); -EXPORT_API int em_core_convert_string_to_structure(const char *encoded_string, void **struct_var, emf_convert_struct_type_e type); - -EXPORT_API int em_core_mail_get_info_from_mail_tbl(emf_mail_info_t **pp_mail_info, emf_mail_tbl_t *mail , int *err_code); -EXPORT_API int em_core_mail_get_header_from_mail_tbl(emf_mail_head_t **header, emf_mail_tbl_t *mail , int *err_code); -EXPORT_API int em_core_mail_get_body_from_mail_tbl(emf_mail_body_t **p_body, emf_mail_tbl_t *mail, int *err_code); - - -#ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__ -EXPORT_API int em_core_mail_sync_flags_field_with_server(int mail_ids[], int num, emf_flags_field_type field_type, int value, int *err_code); -EXPORT_API int em_core_mail_move_from_server_ex(int account_id, char *src_mailbox, int mail_ids[], int num, char *dest_mailbox, int *error_code); -#endif - -#ifdef __ATTACHMENT_OPTI__ -EXPORT_API int em_core_mail_download_attachment_bulk(/*emf_mailbox_t *mailbox, */ int account_id, int mail_id, char *nth, int *err_code); -#endif -EXPORT_API int em_core_mail_filter_by_rule(emf_rule_t *filter_info, int *err_code); -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif -/* EOF */ diff --git a/email-core/include/em-core-mime.h b/email-core/include/em-core-mime.h deleted file mode 100755 index f95fd42..0000000 --- a/email-core/include/em-core-mime.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -* email-service -* -* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. -* -* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com> -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*/ - - -/****************************************************************************** - * File : em-core-mime.h - * Desc : MIME Operation Header - * - * Auth : - * - * History : - * 2011.04.14 : created - *****************************************************************************/ -#ifndef __EM_CORE_MIME_H__ -#define __EM_CORE_MIME_H__ - -#include "em-core-types.h" -#include "c-client.h" -#include "em-storage.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -char *em_core_mime_get_line_from_file(void *stream, char *buf, int size, int *err_code); -int em_core_mime_parse_mime(void *stream, int is_file, struct _m_content_info *cnt_info, int *err_code); -EXPORT_API int em_core_get_attribute_value_of_body_part(PARAMETER *input_param, char *atribute_name, char *output_value, int output_buffer_length, int with_rfc2047_text, int *err_code); -EXPORT_API int em_core_get_body_part_list_full(MAILSTREAM *stream, int msg_uid, int account_id, int mail_id, BODY *body, struct _m_content_info *cnt_info, int *err_code, PARTLIST * section_list, int event_handle); -EXPORT_API int em_core_get_body(MAILSTREAM *stream, int account_id, int mail_id, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code); -EXPORT_API int em_core_get_body_structure(MAILSTREAM *stream, int msg_uid, BODY **body, int *err_code); -EXPORT_API char *em_core_decode_rfc2047_text(char *rfc2047_text, int *err_code); -EXPORT_API int em_core_decode_body_text(char *enc_buf, int enc_len, int enc_type, int *dec_len, int *err_code); -EXPORT_API int em_core_set_fetch_body_section(BODY *body, int enable_inline_list, int *total_mail_size, int *err_code); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif -/* EOF */ diff --git a/email-core/include/em-core-types.h b/email-core/include/em-core-types.h deleted file mode 100755 index a115cc5..0000000 --- a/email-core/include/em-core-types.h +++ /dev/null @@ -1,320 +0,0 @@ -/* -* email-service -* -* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. -* -* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com> -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*/ - - -/****************************************************************************** - * File : em-core-types.h - * Desc : defines data structures and macros - * - * Auth : - * - * History : - * 2011.04.05 : created - *****************************************************************************/ -#ifndef __EM_CORE_TYPES_H__ -#define __EM_CORE_TYPES_H__ - -#include <pthread.h> -#include "emf-types.h" - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplu */ - -#if !defined(EXPORT_API) -#define EXPORT_API __attribute__((visibility("default"))) -#endif - -/* ----------------------------------------------------------------------------- */ -/* Feature definitions */ -#define __FEATURE_USING_MY_ACCOUNT__ -#define __FEATURE_BACKUP_ACCOUNT__ -#define __FEATURE_MOVE_TO_OUTBOX_FIRST__ -/* #define __FEATURE_PARTIAL_BODY_FOR_POP3__ */ -/* #define __FEATURE_KEEP_CONNECTION__ */ -#define __FEATURE_DRM__ -#define __FEATURE_PARTIAL_BODY_DOWNLOAD__ -#define __FEATURE_HEADER_OPTIMIZATION__ -#define __FEATURE_SEND_OPTMIZATION__ -#define __FEATURE_DOWNLOAD_BODY_ATTACHMENT_OPTIMIZATION__ -#define __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__ -#define __FEATURE_SYNC_CLIENT_TO_SERVER__ -#define __FEATURE_PROGRESS_IN_OUTBOX__ -#define __FEATURE_AUTO_POLLING__ -#define __FEATURE_DEBUG_LOG__ -#define __FEATURE_USE_PTHREAD__ -#define __FEATURE_USE_SHARED_MUTEX_FOR_GENERATING_MAIL_ID__ -/* #define __FEATURE_USE_SHARED_MUTEX_FOR_PROTECTED_FUNC_CALL__ */ -#define __FEATURE_SUPPORT_ACTIVE_SYNC__ - -#define __HEADER_OPTIMIZATION__ /* Will be removed */ -#define __DOWNLOAD_BODY_ATTACHMENT_OPTIMIZATION__ /* Will be removed */ - -/* ----------------------------------------------------------------------------- */ -/* Macro */ -#ifndef NULL -#define NULL (char *)0 -#endif - -#define SESSION_MAX 5 -#define IMAP_2004_LOG 1 -#define TEXT_SIZE 161 -#define MAILBOX_COUNT 6 -#define PARTIAL_DOWNLOAD_SIZE 1024 -#define PARTIAL_BODY_SIZE_IN_BYTES 15360 /* Partial Body download - 15K */ -#define NO_LIMITATION 0 -#define MAX_MAILBOX_TYPE 100 -#define EMF_SYNC_ALL_MAILBOX 1 -#define EMF_ATTACHMENT_MAX_COUNT 512 -#define DOWNLOAD_MAX_BUFFER_SIZE 8000 -#define LOCAL_MAX_BUFFER_SIZE 1000000 -#define IMAP_MAX_COMMAND_LENGTH 1000 -#define DOWNLOAD_NOTI_INTERVAL_PERCENT 5 /* notify every 5% */ -#define DOWNLOAD_NOTI_INTERVAL_SIZE 51200 /* notify every 50k */ -#define MAX_PATH 4096 /* /usr/src/linux-2.4.20-8/include/linux/limits.h */ -#define DATETIME_LENGTH 16 -#define MAIL_ID_STRING_LENGTH 10 - -#define DIR_SEPERATOR "/" - -#define DATA_PATH "/opt/data" -#define DB_PATH "/opt/dbspace" -#define EMAIL_SERVICE_DB_FILE_PATH "/opt/dbspace/.email-service.db" - -#define VCONF_KEY_LAST_SYNC_TIME "db/email/last_sync_time" -#define VCONF_KEY_DEFAULT_SLOT_SIZE "db/email/slot_size" -#define VCONF_KEY_LATEST_MAIL_ID "db/email/latest_mail_id" -#define VCONF_KEY_DEFAULT_ACCOUNT_ID "db/email/defaultaccount" -#define VCONF_KEY_UNREAD_MAIL_COUNT "db/badge/com.samsung.email" - -#define MIME_SUBTYPE_DRM_OBJECT "vnd.oma.drm.message" -#define MIME_SUBTYPE_DRM_RIGHTS "vnd.oma.drm.rights+xml" -#define MIME_SUBTYPE_DRM_DCF "vnd.oma.drm.dcf" - -#define SHM_FILE_FOR_DB_LOCK "/.email_shm_db_lock" - -#ifdef __FEATURE_USE_SHARED_MUTEX_FOR_GENERATING_MAIL_ID__ -#define SHM_FILE_FOR_MAIL_ID_LOCK "/.email_shm_mail_id_lock" -#endif /* __FEATURE_USE_SHARED_MUTEX_FOR_GENERATING_MAIL_ID__ */ - -#define CR '\r' -#define LF '\n' -#define SPACE ' ' -#define TAB '\t' -#define NULL_CHAR '\0' -#define TAB_STRING "\t" -#define CR_STRING "\r" -#define LF_STRING "\n" -#define CRLF_STRING "\r\n" - -#define SYNC_STATUS_FINISHED 0 /* BIN 00000000 */ -#define SYNC_STATUS_SYNCING 1 /* BIN 00000001 */ -#define SYNC_STATUS_HAVE_NEW_MAILS 2 /* BIN 00000010 */ - -#define GRAB_TYPE_TEXT 1 /* retrieve text and attachment list */ -#define GRAB_TYPE_ATTACHMENT 2 /* retrieve attachment */ - -#define SAVE_TYPE_SIZE 1 /* only get content size */ -#define SAVE_TYPE_BUFFER 2 /* save content to buffer */ -#define SAVE_TYPE_FILE 3 /* save content to temporary file */ - -#define FINISH_OFF_IF_CANCELED if (!em_core_check_thread_status()) { err = EMF_ERROR_CANCELLED; goto FINISH_OFF; } -#define CHECK_JOB_CANCELED() {if (!em_core_check_thread_status()) goto JOB_CANCEL; } - -#define SNPRINTF(buff, size, format, args...) snprintf(buff, size, format, ##args) -#define SNPRINTF_OFFSET(base_buf, offset, base_size, format, args...) \ - ({\ - int _offset = offset;\ - snprintf(base_buf + _offset, base_size - _offset - 1, format, ##args);\ - }) - -#ifdef __FEATURE_USE_PTHREAD__ -#define THREAD_CREATE(tv, func, param, err) { EM_DEBUG_LOG("THREAD_CREATE "#tv); err = pthread_create(&tv, NULL, func, param); } -#define THREAD_CREATE_JOINABLE(tv, func, err) { pthread_attr_t attr; EM_DEBUG_LOG("THREAD_CREATE_JOINABLE "#tv); \ - pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);\ - err = pthread_create(&tv, &attr, func, NULL); pthread_attr_destroy(&attr); } -#define THREAD_JOIN(tv) {EM_DEBUG_LOG("THREAD_JOIN "#tv); pthread_join(tv, NULL); } -#define THREAD_SELF() pthread_self() -#define THREAD_DETACH(tv) pthread_detach(tv) -#define INITIALIZE_CRITICAL_SECTION(cs) {EM_DEBUG_LOG("INITIALIZE_CRITICAL_SECTION "#cs); pthread_mutex_init(&cs, NULL); } -#define ENTER_CRITICAL_SECTION(cs) {EM_DEBUG_LOG("ENTER_CRITICAL_SECTION "#cs); pthread_mutex_lock(&cs); } -#define TRY_ENTER_CRITICAL_SECTION(cs) {EM_DEBUG_LOG("TRY_ENTER_CRITICAL_SECTION "#cs); pthread_mutex_trylock(&cs); } -#define LEAVE_CRITICAL_SECTION(cs) {EM_DEBUG_LOG("LEAVE_CRITICAL_SECTION "#cs); pthread_mutex_unlock(&cs); } -#define DELETE_CRITICAL_SECTION(cs) {EM_DEBUG_LOG("DELETE_CRITICAL_SECTION "#cs); pthread_mutex_destroy(&cs); } - -#define INITIALIZE_CONDITION_VARIABLE(cv) {EM_DEBUG_LOG("INITIALIZE_CONDITION_VARIABLE "#cv); pthread_cond_init(&cv, NULL); } -#define SLEEP_CONDITION_VARIABLE(cv, cs) {EM_DEBUG_LOG("SLEEP_CONDITION_VARIABLE "#cv); pthread_cond_wait(&cv, &cs); } -#define WAKE_CONDITION_VARIABLE(cv) {EM_DEBUG_LOG("WAKE_CONDITION_VARIABLE "#cv); pthread_cond_signal(&cv); } -#define DELETE_CONDITION_VARIABLE(cv) {EM_DEBUG_LOG("DELETE_CONDITION_VARIABLE "#cv); pthread_cond_destroy(&cv); } - -#define INITIALIZE_RECURSIVE_CRITICAL_SECTION(cs) { EM_DEBUG_LOG("INITIALIZE_RECURSIVE_CRITICAL_SECTION "#cs); \ - if (cs == NULL) {pthread_mutex_lock(&_send_event_available_lock); pthread_mutexattr_t attr; cs = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t));\ - pthread_mutexattr_init(&attr); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);\ - pthread_mutex_init(cs, &attr);pthread_mutexattr_destroy(&attr); pthread_mutex_unlock(&_send_event_available_lock);}} -#define ENTER_RECURSIVE_CRITICAL_SECTION(cs) {EM_DEBUG_LOG("ENTER_RECURSIVE_CRITICAL_SECTION "#cs); if(cs) pthread_mutex_lock(cs);} -#define TRY_ENTER_RECURSIVE_CRITICAL_SECTION(cs) {EM_DEBUG_LOG("TRY_ENTER_RECURSIVE_CRITICAL_SECTION "#cs); if(cs) pthread_mutex_trylock(cs);} -#define LEAVE_RECURSIVE_CRITICAL_SECTION(cs) {EM_DEBUG_LOG("LEAVE_RECURSIVE_CRITICAL_SECTION "#cs); if(cs) pthread_mutex_unlock(cs);} -#define DELETE_RECURSIVE_CRITICAL_SECTION(cs) {EM_DEBUG_LOG("DELETE_RECURSIVE_CRITICAL_SECTION "#cs); if(cs) pthread_mutex_destroy(cs);} -typedef pthread_t thread_t; -#else /* __FEATURE_USE_PTHREAD__ */ -#define THREAD_CREATE(tv, func, param, err) {EM_DEBUG_LOG("THREAD_CREATE "#tv); tv = g_thread_create(func, param, FALSE, NULL); if (tv == NULL) err = -1; else err = 0; } -#define THREAD_CREATE_JOINABLE(tv, func, err) {EM_DEBUG_LOG("THREAD_CREATE_JOINABLE "#tv); tv = g_thread_create(func, NULL, TRUE, NULL); if (tv == NULL) err = -1; else err = 0; } -#define THREAD_JOIN(tv) {EM_DEBUG_LOG("THREAD_JOIN "#tv); g_thread_join(tv); } -#define THREAD_SELF() g_thread_self() -#define INITIALIZE_CRITICAL_SECTION(cs) {EM_DEBUG_LOG("INITIALIZE_CRITICAL_SECTION "#cs); if (cs == NULL) cs = g_mutex_new(); } -#define ENTER_CRITICAL_SECTION(cs) {EM_DEBUG_LOG("ENTER_CRITICAL_SECTION "#cs); if (cs) g_mutex_lock(cs); } -#define TRY_ENTER_CRITICAL_SECTION(cs) {EM_DEBUG_LOG("TRY_ENTER_CRITICAL_SECTION "#cs); if (cs) g_mutex_trylock(cs); } -#define LEAVE_CRITICAL_SECTION(cs) {EM_DEBUG_LOG("LEAVE_CRITICAL_SECTION "#cs); if (cs) g_mutex_unlock(cs); } -#define DELETE_CRITICAL_SECTION(cs) {EM_DEBUG_LOG("DELETE_CRITICAL_SECTION "#cs); if (cs) g_mutex_free(cs); cs = NULL; } - -#define INITIALIZE_CONDITION_VARIABLE(cv) {EM_DEBUG_LOG("INITIALIZE_CONDITION_VARIABLE "#cv); if (cv == NULL) cv = g_cond_new(); } -#define SLEEP_CONDITION_VARIABLE(cv, cs) {EM_DEBUG_LOG("SLEEP_CONDITION_VARIABLE "#cv); if (cv) g_cond_wait(cv, cs); } -#define WAKE_CONDITION_VARIABLE(cv) {EM_DEBUG_LOG("WAKE_CONDITION_VARIABLE "#cv); if (cv) g_cond_signal(cv); } -#define DELETE_CONDITION_VARIABLE(cv) {EM_DEBUG_LOG("DELETE_CONDITION_VARIABLE "#cv); if (cv) g_cond_free(cv); cv = NULL; } - -#define INITIALIZE_RECURSIVE_CRITICAL_SECTION(cs) {EM_DEBUG_LOG("INITIALIZE_RECURSIVE_CRITICAL_SECTION "#cs); g_static_rec_mutex_init(&cs); } -#define ENTER_RECURSIVE_CRITICAL_SECTION(cs) {EM_DEBUG_LOG("ENTER_RECURSIVE_CRITICAL_SECTION "#cs); g_static_rec_mutex_lock(&cs); } -#define TRY_ENTER_RECURSIVE_CRITICAL_SECTION(cs) {EM_DEBUG_LOG("TRY_ENTER_RECURSIVE_CRITICAL_SECTION "#cs); g_static_rec_mutex_trylock(&cs); } -#define LEAVE_RECURSIVE_CRITICAL_SECTION(cs) {EM_DEBUG_LOG("LEAVE_RECURSIVE_CRITICAL_SECTION "#cs); g_static_rec_mutex_unlock(&cs); } -#define DELETE_RECURSIVE_CRITICAL_SECTION(cs) {EM_DEBUG_LOG("DELETE_RECURSIVE_CRITICAL_SECTION "#cs); g_static_rec_mutex_free(&cs); } -typedef GThread* thread_t; -#endif /* __FEATURE_USE_PTHREAD__ */ - -#define SMTP_RESPONSE_OK 250 -#define SMTP_RESPONSE_READY 354 -#define SMTP_RESPONSE_WANT_AUTH 505 -#define SMTP_RESPONSE_WANT_AUTH2 530 -#define SMTP_RESPONSE_UNAVAIL 550 -/* ----------------------------------------------------------------------------- */ -/* Type */ -typedef enum -{ - _SERVICE_THREAD_TYPE_NONE = 0, - _SERVICE_THREAD_TYPE_RECEIVING = 1, - _SERVICE_THREAD_TYPE_SENDING = 2, -#ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__ - _SERVICE_THREAD_TYPE_PBD = 3, -#endif /* __FEATURE_PARTIAL_BODY_DOWNLOAD__ */ -} emf_service_thread_type; - - -typedef enum -{ - EMF_PROTOCOL_POP3 = 1, - EMF_PROTOCOL_IMAP, - EMF_PROTOCOL_SMTP, - EMF_PROTOCOL_NONE = 0, -} emf_protocol_type_t; - -#ifdef __FEATURE_KEEP_CONNECTION__ -enum -{ - EMF_STREAM_STATUS_DISCONNECTED = 0, - EMF_STREAM_STATUS_CONNECTED = 1 -} ; -#endif /* __FEATURE_KEEP_CONNECTION__ */ - -/* event information */ -typedef struct -{ - int account_id; /* in general, account id */ - emf_event_type_t type; - emf_event_status_type_t status; - char *event_param_data_1; /* in general, mailbox name (exception in em_core_mail_send, em_core_mail_send_saved it is emf_option_t **/ - char *event_param_data_2; - char *event_param_data_3; - int event_param_data_4; - int event_param_data_5; - int event_param_data_6; /* in general, notification parameter #1 */ - int event_param_data_7; /* in general, notification parameter #2 */ -} emf_event_t; - - -typedef struct -{ - int num; - void *data; -} emf_callback_holder_t; - - -typedef struct emf_search_key_t emf_search_key_t; -struct emf_search_key_t -{ - int type; - char *value; - emf_search_key_t *next; -}; - -typedef struct -{ - int tid; - emf_protocol_type_t protocol; - void *stream; - int auth; - int network; - int error; - int status; -} emf_session_t; - -#ifdef __FEATURE_KEEP_CONNECTION__ - -typedef struct emf_connection_info -{ - int account_id; - int sending_server_stream_status; - void *sending_server_stream; - int receiving_server_stream_status; - void *receiving_server_stream; - struct emf_connection_info *next; -} emf_connection_info_t; -#endif /* __FEATURE_KEEP_CONNECTION__ */ - -typedef void (*emf_event_callback)(int total, int done, int status, int account_id, int mail_id, int handle, void *user_data, int error); - -/* ----------------------------------------------------------------------------- */ -/* Please contact Himanshu [h.gahlaut@samsung.com] for any explanation in code here under __FEATURE_PARTIAL_BODY_DOWNLOAD__ MACRO */ -#ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__ -typedef enum -{ - ACTIVITY_PARTIAL_BODY_DOWNLOAD_IMAP4 = 1, - ACTIVITY_PARTIAL_BODY_DOWNLOAD_POP3_WAIT, - ACTIVITY_PARTIAL_BODY_DOWNLOAD_POP3_ACTIVE -} emf_pdb_activity_type_e; - -typedef struct -{ - int account_id; - int mail_id; - unsigned long server_mail_id; - int activity_id; - char *mailbox_name; - emf_event_type_t event_type; /* Event Type Null means event is created from local activitys */ - int activity_type; /* Activity Type Null means event is created from event queue */ - -} emf_event_partial_body_thd; -#endif /* __FEATURE_PARTIAL_BODY_DOWNLOAD__ */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __EM_CORE_TYPES_H_ */ diff --git a/email-core/include/em-core-utils.h b/email-core/include/em-core-utils.h deleted file mode 100755 index 1dda87f..0000000 --- a/email-core/include/em-core-utils.h +++ /dev/null @@ -1,217 +0,0 @@ -/* -* email-service -* -* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. -* -* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com> -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -*/ - - -/****************************************************************************** - * File : em-core-utils.h - * Desc : Mail Utils Header - * - * Auth : - * - * History : - * 2006.08.16 : created - *****************************************************************************/ -#ifndef __EM_CORE_UTILS_H__ -#define __EM_CORE_UTILS_H__ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#include "emf-types.h" -#include "em-storage.h" -#include "em-core-global.h" -#include "em-core-mesg.h" -#ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__ -#include "em-core-mesg.h" -#endif - -#if !defined(EXPORT_API) -#define EXPORT_API __attribute__((visibility("default"))) -#endif - -/* This is used for em_core_get_long_encoded_path */ -#define ENCODED_PATH_SMTP "UHDF_ENCODED_PATH_SMTP_EKJD" - -typedef int (*emf_get_unread_email_count_cb)(int unread, int *err_code); - -/* parse the Full mailbox Path and get the Alias Name of the Mailbox */ -char *em_core_get_alias_of_mailbox(const char *mailbox_path); - -/* Parse the Mailbox Path and get the Account Email address */ -EXPORT_API emf_option_t *em_core_get_option(int *err_code); -EXPORT_API int em_core_set_option(emf_option_t *opt, int *err_code); -int em_core_upper_path(char *path); -int em_core_upper_string(char *str); -int em_core_get_temp_file_name(char **filename, int *err_code); -int em_core_get_long_encoded_path(int account_id, char *path, int delimiter, char **long_enc_path, int *err_code); -int em_core_get_encoded_mailbox_name(char *name, char **enc_name, int *err_code); -int em_core_get_file_name(char *path, char **filename, int *err_code); -int em_core_get_file_size(char *path, int *size, int *err_code); -int em_core_get_mail_size(emf_mail_t *mail_src, int *error_code); -int em_core_calc_mail_size(emf_mail_data_t *mail_data_src, emf_attachment_data_t *attachment_data_src, int attachment_count, int *error_code); -int em_core_get_actual_mail_size(char *pBodyPlane, char *pBodyHtml, struct attachment_info *pAttachment, int *error_code); -int em_core_get_address_count(char *addr_str, int *to_num, int *err_code); - -void em_core_skip_whitespace(char *addr_str , char **pAddr); -EXPORT_API char *em_core_skip_whitespace_without_strdup(char *source_string); -EXPORT_API char* em_core_replace_string(char *source_string, char *old_string, char *new_string); -EXPORT_API int em_core_set_network_error(int err_code); -EXPORT_API int em_core_check_unread_mail(); -int em_core_is_storage_full(int *error); -int em_core_show_popup(int id, emf_action_t action, int error); -int em_core_get_long_encoded_path_with_account_info(emf_account_t *account, char *path, int delimiter, char **long_enc_path, int *err_code); -EXPORT_API int em_storage_get_emf_error_from_em_storage_error(int error); -EXPORT_API int em_core_open_contact_db_library(void); -EXPORT_API void em_core_close_contact_db_library(); -EXPORT_API void em_core_flush_memory(); -EXPORT_API int em_core_get_server_time(void *mail_stream , int account_id, char *uid, int msgno, time_t *log_time, int *err_code); -EXPORT_API void em_core_fill_address_information_of_mail_tbl(emf_mail_tbl_t *mail_data); -EXPORT_API int em_core_add_transaction_info(int mail_id , int handle , int *err_code); -EXPORT_API int em_core_get_handle_by_mailId_from_transaction_info(int mail_id , int *pHandle); -EXPORT_API int em_core_delete_transaction_info_by_mailId(int mail_id); -EXPORT_API int em_core_get_preview_text_from_file(const char *input_plain_path, const char *input_html_path, int input_preview_buffer_length, char **output_preview_buffer); -EXPORT_API int em_core_strip_HTML(char *source_string); -EXPORT_API int em_core_send_noti_for_new_mail(int account_id, char *mailbox_name, char *subject, char *from, char *uid, char *datetime); -EXPORT_API int em_core_find_pos_stripped_subject_for_thread_view(char *subject, char *stripped_subject); -EXPORT_API int em_core_find_tag_for_thread_view(char *subject, int *result); -EXPORT_API int em_core_check_send_mail_thread_status(); -EXPORT_API int em_core_make_attachment_file_name_with_extension(char *source_file_name, char *sub_type, char *result_file_name, int result_file_name_buffer_length, int *err_code); -EXPORT_API char *em_core_get_extension_from_file_path(char *source_file_path, int *err_code); -EXPORT_API int em_core_get_encoding_type_from_file_path(const char *input_file_path, char **output_encoding_type); -EXPORT_API int em_core_get_content_type(const char *extension_string, int *err_code); -EXPORT_API char* em_core_get_current_time_string(int *err_code); - - -/* Session Handling */ -EXPORT_API int em_core_get_empty_session(emf_session_t **session); -EXPORT_API int em_core_clear_session(emf_session_t *session); -EXPORT_API int em_core_get_current_session(emf_session_t **session); - -/* For notification */ -EXPORT_API int em_core_update_notification_for_unread_mail(int account_id); -EXPORT_API int em_core_clear_all_notifications(); -EXPORT_API int em_core_add_notification_for_unread_mail_by_mail_header(int account_id, int mail_id, emf_mail_head_t *mail_header); -EXPORT_API int em_core_add_notification_for_unread_mail(emf_mail_data_t *input_mail_data); -EXPORT_API int em_core_delete_notification_for_read_mail(int mail_id); -EXPORT_API int em_core_delete_notification_by_account(int account_id); -EXPORT_API int em_core_finalize_sync(int account_id, int *error); - -EXPORT_API int em_core_verify_email_address(char *address, int without_bracket, int *err_code); -EXPORT_API int em_core_verify_email_address_of_mail_header(emf_mail_head_t *mail_header, int without_bracket, int *err_code); -EXPORT_API int em_core_verify_email_address_of_mail_data(emf_mail_data_t *mail_data, int without_bracket, int *err_code); - - -#ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__ - -/** - * @fn em_core_convert_to_uid_range_set(emf_id_set_t *id_set, int id_set_count, emf_uid_range_set **uid_range_set, int range_len, int *err_code) - * Prepare a linked list of uid ranges with each node having a uid_range and lowest and highest uid in it. - * - *@author h.gahlaut@samsung.com - * @param[in] id_set Specifies the array of mail_id and corresponding server_mail_id sorted by server_mail_ids in ascending order - * @param[in] id_set_count Specifies the no. of cells in id_set array i.e. no. of sets of mail_ids and server_mail_ids - * @param[in] range_len Specifies the maximum length of string of range allowed. - * @param[out] uid_range_set Returns the uid_ranges formed in the form of a linked list with head stored in uid_range_set pointer - * @param[out] err_code Returns the error code. - * @remarks An example of a uid_range formed is 2 : 6, 8, 10, 14 : 15, 89, - * While using it the caller should remove the ending , (comma) - * @return This function returns true on success or false on failure. - */ - -EXPORT_API int em_core_convert_to_uid_range_set(emf_id_set_t *id_set, int id_set_count, emf_uid_range_set **uid_range_set, int range_len, int *err_code); - -/** - * void em_core_free_uid_range_set(emf_uid_range_set **uid_range_head) - * Frees the linked list of uid ranges - * - * @author h.gahlaut@samsung.com - * @param[in] uid_range_head Head pointer of linked list of uid ranges - * @remarks - * @return This function does not return anything. - */ -EXPORT_API void em_core_free_uid_range_set(emf_uid_range_set **uid_range_set); - -/** - * @fn em_core_append_subset_string_to_uid_range(char *subset_string, emf_uid_range_set **uid_range_set, int range_len, unsigned long luid, unsigned long huid) - * Appends the subset_string to uid range if the uid range has not exceeded maximum length(range_len), otherwise creates a new node in linked list of uid range set - * and stores the subset_string in its uid_range. Also sets the lowest and highest uids for the corresponsing uid_range - * - * @author h.gahlaut@samsung.com - * @param[in] subset_string Specifies the subset string to be appended. A subset string can be like X : Y or X where X and Y are uids. - * @param[in] range_len Specifies the maximum length of range string allowed. - * @param[in] luid Specifies the lowest uid in subset string - * @param[in] huid Specifies the highest uid in subset string - * @param[out] uid_range_set Returns the uid_ranges formed in the form of a linked list with head stored in uid_range_set pointer - * @param[out] err_code Returns the error code. - * @remarks - * @return This function returns true on success or false on failure. - */ - -int em_core_append_subset_string_to_uid_range(char *subset_string, emf_uid_range_set **current_node_adr, emf_uid_range_set **uid_range_set, int range_len, unsigned long luid, unsigned long huid); - -/** - * @fn em_core_form_comma_separated_strings(int numbers[], int num_count, int max_string_len, char ***strings, int *string_count, int *err_code) - * Forms comma separated strings of a give max_string_len from an array of numbers - * - * @author h.gahlaut@samsung.com - * @param[in] numbers Specifies the array of numbers to be converted into comma separated strings. - * @param[in] num_count Specifies the count of numbers in numbers array. - * @param[in] max_string_len Specifies the maximum length of comma separated strings that are to be formed. - * @param[out] strings Returns the base address of a double dimension array which stores the strings. - * @param[out] string_count Returns the number of strings formed. - * @param[out] err_code Returns the error code. - * @remarks If Input to the function is five numbers like 2755 2754 2748 2749 2750 and a given max_string_len is 20. - * Then this function will form two comma separated strings as follows - - * "2755, 2754, 2748" - * "2749, 2750" - * @return This function returns true on success or false on failure. - */ -EXPORT_API int em_core_form_comma_separated_strings(int numbers[], int num_count, int max_string_len, char ***strings, int *string_count, int *err_code); - -/** - * @fn em_core_free_comma_separated_strings(char ***string_list, int *string_count) - * Frees the double dimensional array of strings. - * - * @author h.gahlaut@samsung.com - * @param[in] uid_range_head Address of base address of double dimensional array of strings. - * @param[in] string_count Address of variable holding the count of strings. - * @remarks - * @return This function does not return anything. - */ - -EXPORT_API void em_core_free_comma_separated_strings(char ***string_list, int *string_count); - -#endif - -#ifdef __LOCAL_ACTIVITY__ -/* Added to get next activity id sequence */ -EXPORT_API int em_core_get_next_activity_id(int *activity_id, int *err_code); -EXPORT_API int em_core_activity_add(emf_activity_tbl_t *new_activity, int *err_code); -EXPORT_API int em_core_activity_delete(emf_activity_tbl_t *activity, int *err_code); -#endif /* __LOCAL_ACTIVITY__ */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __EM_CORE_UTILS_H__ */ diff --git a/email-core/include/email-core-account.h b/email-core/include/email-core-account.h new file mode 100755 index 0000000..4eba963 --- /dev/null +++ b/email-core/include/email-core-account.h @@ -0,0 +1,83 @@ +/* +* email-service +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + + + +/****************************************************************************** + * File : email-core-account.h + * Desc : Account Management + * * Auth : + * * History : + * 2010.08.25 : created + *****************************************************************************/ +#ifndef _EMAIL_CORE_ACCOUNT_H_ +#define _EMAIL_CORE_ACCOUNT_H_ + +#include "email-types.h" +#include "email-internal-types.h" +#include "email-storage.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +INTERNAL_FUNC int emcore_validate_account(int account_id, int *err_code); + +INTERNAL_FUNC int emcore_validate_account_with_account_info(emf_account_t *account, int *err_code); + +INTERNAL_FUNC int emcore_create_account(emf_account_t *account, int *err_code); + +INTERNAL_FUNC int emcore_delete_account_(int account_id, int *err_code); + +INTERNAL_FUNC int emcore_free_account(emf_account_t **account_list, int count, int *err_code); + +INTERNAL_FUNC int emcore_init_account_reference(); + +INTERNAL_FUNC int emcore_refresh_account_reference(); + +INTERNAL_FUNC int emcore_free_account_reference(); + +INTERNAL_FUNC emf_account_t *emcore_get_account_reference(int account_id); + +INTERNAL_FUNC int emcore_get_account_reference_list(emf_account_t **account_list, int *count, int *err_code); + +INTERNAL_FUNC int emcore_query_server_info(const char* domain_name, emf_server_info_t **result_server_info); + +INTERNAL_FUNC int emcore_free_server_info(emf_server_info_t **target_server_info); + +INTERNAL_FUNC int emcore_save_default_account_id(int input_account_id); + +INTERNAL_FUNC int emcore_load_default_account_id(int *output_account_id); + + +#ifdef __FEATURE_BACKUP_ACCOUNT__ +INTERNAL_FUNC int emcore_backup_accounts(const char *file_path, int *error_code); + +INTERNAL_FUNC int emcore_restore_accounts(const char *file_path, int *error_code); +#endif /* __FEATURE_BACKUP_ACCOUNT_ */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /*_EMAIL_CORE_ACCOUNT_H_*/ + diff --git a/email-core/include/em-core-sound-conflict.h b/email-core/include/email-core-api.h index a56ea74..3937b26 100755 --- a/email-core/include/em-core-sound-conflict.h +++ b/email-core/include/email-core-api.h @@ -18,3 +18,29 @@ * limitations under the License. * */ + + +/****************************************************************************** + * File : email-core-api.h + * Desc : email-core-api Header + * + * Auth : + * + * History : + * 2006.08.16 : created + *****************************************************************************/ +#ifndef __EMAIL_CORE_API_H__ +#define __EMAIL_CORE_API_H__ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +int emcore_init(int *err_code); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /*__EMAIL_CORE_API_H__*/ diff --git a/email-core/include/email-core-event.h b/email-core/include/email-core-event.h new file mode 100755 index 0000000..6ee7a28 --- /dev/null +++ b/email-core/include/email-core-event.h @@ -0,0 +1,82 @@ +/* +* email-service +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + + +/****************************************************************************** + * File : email-core-event.h + * Desc : Mail Engine Event Header + * + * Auth : + * + * History : + * 2006.08.16 : created + *****************************************************************************/ +#ifndef __EMAIL_CORE_EVNET_H__ +#define __EMAIL_CORE_EVNET_H__ + +#include "email-types.h" +#include "email-internal-types.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +void emcore_execute_event_callback(emf_action_t action, int total, int done, int status, int account_id, int mail_id, int handle, int error); +int emcore_get_active_queue_idx(void); +int emcore_check_send_mail_thread_status(); + +INTERNAL_FUNC int emcore_get_current_thread_type(); +INTERNAL_FUNC int emcore_register_event_callback(emf_action_t action, emf_event_callback callback, void *event_data); +INTERNAL_FUNC int emcore_unregister_event_callback(emf_action_t action, emf_event_callback callback); +INTERNAL_FUNC int emcore_get_pending_event(emf_action_t action, int account_id, int mail_id, emf_event_status_type_t *status); +INTERNAL_FUNC int emcore_start_event_loop(int *err_code); +INTERNAL_FUNC int emcore_stop_event_loop(int *err_code); +INTERNAL_FUNC int emcore_insert_event(emf_event_t *event_data, int *handle, int *err_code); +INTERNAL_FUNC int emcore_cancel_thread(int handle, void *arg, int *err_code); +INTERNAL_FUNC int emcore_send_event_loop_start(int *err_code); +INTERNAL_FUNC int emcore_send_event_loop_stop(int *err_code); +INTERNAL_FUNC int emcore_cancel_send_mail_thread(int handle, void *arg, int *err_code); +INTERNAL_FUNC int emcore_check_thread_status(void); +INTERNAL_FUNC void emcore_get_event_queue_status(int *on_sending, int *on_receiving); +INTERNAL_FUNC int emcore_insert_send_event(emf_event_t *event_data, int *handle, int *err_code); +INTERNAL_FUNC int emcore_get_receiving_event_queue(emf_event_t **event_queue, int *event_count, int *err); +INTERNAL_FUNC int emcore_cancel_all_threads_of_an_account(int account_id); +INTERNAL_FUNC int emcore_free_event(emf_event_t *event_data); + +#ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__ +/* Please contact -> Himanshu [h.gahlaut@samsung.com] for any explanation in code here under this MACRO */ +INTERNAL_FUNC int emcore_insert_partial_body_thread_event(emf_event_partial_body_thd *partial_body_thd_event, int *error_code); +INTERNAL_FUNC int emcore_is_partial_body_thd_que_empty(); +INTERNAL_FUNC int emcore_is_partial_body_thd_que_full(); +INTERNAL_FUNC int emcore_partial_body_thread_loop_start(int *err_code); +INTERNAL_FUNC int emcore_clear_partial_body_thd_event_que(int *err_code); +INTERNAL_FUNC int emcore_free_partial_body_thd_event(emf_event_partial_body_thd *partial_body_thd_event, int *error_code); +INTERNAL_FUNC unsigned int emcore_get_partial_body_thd_id(); +INTERNAL_FUNC int emcore_get_pbd_thd_state(); +unsigned int emcore_get_receiving_thd_id(); +#endif + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif diff --git a/email-core/include/em-core-global.h b/email-core/include/email-core-global.h index c401a25..2588aad 100755 --- a/email-core/include/em-core-global.h +++ b/email-core/include/email-core-global.h @@ -20,34 +20,29 @@ */ /****************************************************************************** - * File : em-core-global.h - * Desc : Mail Engine Global Header + * File : email-core-global.h + * Desc : email-core-global Header * * Auth : * * History : * 2006.08.01 : created *****************************************************************************/ -#ifndef __EM_CORE_GLOBAL_H__ -#define __EM_CORE_GLOBAL_H__ +#ifndef __EMAIL_CORE_GLOBAL_H__ +#define __EMAIL_CORE_GLOBAL_H__ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include <glib.h> -#include "vconf-keys.h" -#include "emf-types.h" +#include "email-internal-types.h" extern emf_account_list_t *g_account_list; extern int g_account_num; extern int g_account_retrieved; -EXPORT_API emf_account_t *em_core_account_get_new_account_ref(); -extern char *strcasestr (__const char *__haystack, __const char *__needle) __THROW __attribute_pure__ __nonnull ((1, 2)); - -extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind) __THROW __nonnull ((1)); +INTERNAL_FUNC emf_account_t *emcore_get_new_account_reference(); #ifdef __cplusplus } diff --git a/email-core/include/email-core-imap-idle.h b/email-core/include/email-core-imap-idle.h new file mode 100755 index 0000000..6e81798 --- /dev/null +++ b/email-core/include/email-core-imap-idle.h @@ -0,0 +1,57 @@ +/* +* email-service +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + + +/** + * + * This file contains functinality related to IMAP IDLE. + * @file email-core-imap-idle.h + * @author + * @version 0.1 + * @brief This file contains functionality to provide IMAP IDLE support in email-service. + */ + +#include "email-internal-types.h" + +/** + + * @open + * @fn emcore_create_imap_idle_thread(int *err_code) + * @brief Creates a thread that listens for IMAP IDLE Notifications. + * + * @param[out] err_code Specifies the error code returned. + * @remarks N/A + * @return This function returns true on success or false on failure. + */ + +INTERNAL_FUNC int emcore_create_imap_idle_thread(int accountID, int *err_code); + +/** + + * @open + * @fn emcore_kill_imap_idle_thread(int *err_code) + * @brief Kills IMAP IDLE thread + * + * @param[out] err_code Specifies the error code returned. + * @remarks N/A + * @return This function returns true on success or false on failure. + */ +INTERNAL_FUNC int emcore_kill_imap_idle_thread(int *err_code); diff --git a/email-core/include/em-core-imap-mailbox.h b/email-core/include/email-core-imap-mailbox.h index c566c92..e643e38 100755 --- a/email-core/include/em-core-imap-mailbox.h +++ b/email-core/include/email-core-imap-mailbox.h @@ -22,7 +22,7 @@ /****************************************************************************** - * File : em-core-imap-mailbox.h + * File : email-core-imap-mailbox.h * Desc : Mail IMAP mailbox Header * * Auth : @@ -30,8 +30,8 @@ * History : * 2006.08.01 : created *****************************************************************************/ -#ifndef __EM_CORE_IMAP_MAILBOX_H__ -#define __EM_CORE_IMAP_MAILBOX_H__ +#ifndef __EMAIL_CORE_IMAP_MAILBOX_H__ +#define __EMAIL_CORE_IMAP_MAILBOX_H__ #ifdef __cplusplus @@ -39,7 +39,7 @@ extern "C" { #endif /* __cplusplus */ -EXPORT_API int em_core_mailbox_check_sync_imap_mailbox(emf_mailbox_t *mailbox, int *synchronous, int *err_code); +INTERNAL_FUNC int emcore_check_sync_imap_mailbox(emf_mailbox_t *mailbox, int *synchronous, int *err_code); /** * Get mailbox list from imap server. * @@ -50,7 +50,7 @@ EXPORT_API int em_core_mailbox_check_sync_imap_mailbox(emf_mailbox_t *mailbox, i * @remarks N/A * @return This function returns true on success or false on failure. */ -EXPORT_API int em_core_mailbox_sync_mailbox_list(int account_id, char *mailbox, int *err_code); +INTERNAL_FUNC int emcore_sync_mailbox_list(int account_id, char *mailbox, int *err_code); /** * Download mailbox list from imap server. @@ -63,14 +63,14 @@ EXPORT_API int em_core_mailbox_sync_mailbox_list(int account_id, char *mailbox, * @remarks N/A * @return This function returns true on success or false on failure. */ -EXPORT_API int em_core_mailbox_download_mailbox_list(void *mail_stream, char *mailbox, emf_mailbox_t **mailbox_list, int *count, int *err_code); -EXPORT_API int em_core_mailbox_delete_imap_mailbox(emf_mailbox_t *mailbox, int *err_code); -EXPORT_API int em_core_mailbox_create_imap_mailbox(emf_mailbox_t *mailbox, int *err_code); -EXPORT_API int em_core_mailbox_modify_imap_mailbox(emf_mailbox_t *old_mailbox, emf_mailbox_t *new_mailbox, int *err_code); -int em_core_mailbox_set_sync_imap_mailbox(emf_mailbox_t *mailbox, int synchronous, int *err_code); -EXPORT_API int em_core_mailbox_set_mail_slot_size(int account_id, char *mailbox_name, int new_slot_size, int *err_code); -EXPORT_API int em_core_mailbox_remove_overflowed_mails(emf_mailbox_tbl_t *intput_mailbox_tbl, int *err_code); -EXPORT_API int em_core_mailbox_get_default_mail_slot_count(int *output_count, int *err_code); +INTERNAL_FUNC int emcore_download_mailbox_list(void *mail_stream, char *mailbox, emf_mailbox_t **mailbox_list, int *count, int *err_code); +INTERNAL_FUNC int emcore_delete_imap_mailbox(emf_mailbox_t *mailbox, int *err_code); +INTERNAL_FUNC int emcore_create_imap_mailbox(emf_mailbox_t *mailbox, int *err_code); +INTERNAL_FUNC int emcore_modify_imap_mailbox(emf_mailbox_t *old_mailbox, emf_mailbox_t *new_mailbox, int *err_code); +INTERNAL_FUNC int emcore_set_sync_imap_mailbox(emf_mailbox_t *mailbox, int synchronous, int *err_code); +INTERNAL_FUNC int emcore_set_mail_slot_size(int account_id, char *mailbox_name, int new_slot_size, int *err_code); +INTERNAL_FUNC int emcore_remove_overflowed_mails(emstorage_mailbox_tbl_t *intput_mailbox_tbl, int *err_code); +INTERNAL_FUNC int emcore_get_default_mail_slot_count(int *output_count, int *err_code); #ifdef __cplusplus } diff --git a/email-core/include/email-core-mail.h b/email-core/include/email-core-mail.h new file mode 100755 index 0000000..af5760c --- /dev/null +++ b/email-core/include/email-core-mail.h @@ -0,0 +1,209 @@ +/* +* email-service +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + + +/****************************************************************************** + * File : email-core-mail.h + * Desc : Mail Operation Header + * + * Auth : + * + * History : + * 2006.08.16 : created + *****************************************************************************/ +#ifndef __EMAIL_CORE_MESSAGE_H__ +#define __EMAIL_CORE_MESSAGE_H__ + +#include "email-storage.h" +#include <contacts-svc.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__ + +#define MAX_SUBSET_STRING_SIZE 260 +#define MAX_IMAP_COMMAND_LENGTH 1000 +#define MAX_TAG_SIZE 16 + + +typedef struct _emf_uid_range_set +{ + char *uid_range; + unsigned long lowest_uid; + unsigned long highest_uid; + + struct _emf_uid_range_set *next; + +} emf_uid_range_set; + +#endif + + +struct _m_content_info +{ + int grab_type; /* 1 : download text and get attachment names (no saving attachment) - #define GRAB_TYPE_TEXT retrieve text and attachment names */ + /* 2 : download attachment - #define GRAB_TYPE_ATTACHMENT retrieve only attachment */ + int file_no; /* attachment no to be download (min : 1) */ + int report; /* 0 : Non 1 : DSN mail 2 : MDN mail 3 : mail to require MDN */ + + struct text_data + { + char *plain; /* body plain text */ + char *plain_charset; /* charset of body text */ + char *html; /* body html text */ + } text; + + struct attachment_info + { + int type; /* 1 : inline 2 : attachment */ + char *name; /* attachment filename */ + int size; /* attachment size */ + char *save; /* content saving filename */ + int drm; /* 0 : none 1 : object 2 : rights 3 : dcf */ + int drm2; /* 0 : none 1 : FL 2 : CD 3 : SSD 4 : SD */ + char *attachment_mime_type; /* attachment mime type */ +#ifdef __ATTACHMENT_OPTI__ + int encoding; /* encoding */ + char *section; /* section number */ +#endif + struct attachment_info *next; + } *file; +}; + +/** + * Download email body from server. + * + * @param[in] mail_stream Specifies the mail_stream. + * @param[in] mailbox Specifies the mailbox to contain account ID. + * @param[in] mail_id Specifies the mail ID. + * @param[in] callback Specifies the callback function for retrieving download status. + * @param[in] with_attach Specifies the flag for downloading attachments. + * @param[in] limited_size Specifies the size to be downloaded. + * @param[out] err_code Specifies the error code returned. + * @remarks In POP3 case, body and attachment are downloaded in this function. + * In IMAP case, body and attachment list are downloaded and + * attachments must be downloaded in emcore_download_attachment. + * @return This function returns true on success or false on failure. + */ + +INTERNAL_FUNC int emcore_download_body_multi_sections_bulk(void *mail_stream, int account_id, int mail_id, int verbose, int with_attach, int limited_size, int event_handle , int *err_code); + + +/** + * Download a email nth-attachment from server. + * + * @param[in] mailbox Specifies the mailbox to contain account ID. + * @param[in] mail_id Specifies the mail ID. + * @param[in] nth Specifies the buffer that a attachment number been saved. the minimum number is "1". + * @param[in] callback Specifies the callback function for retrieving download status. + * @param[in] handle Specifies the handle for stopping downloading. + * @param[out] err_code Specifies the error code returned. + * @remarks This function is used for only IMAP mail. + * @return This function returns true on success or false on failure. + */ +INTERNAL_FUNC int emcore_download_attachment(int acconut_id, int mail_id, char *nth, int *err_code); + +INTERNAL_FUNC int emcore_mail_move(int mail_ids[], int num, char *dst_mailbox_name, int noti_param_1, int noti_param_2, int *err_code); +INTERNAL_FUNC int emcore_mail_add_attachment(int mail_id, emf_attachment_info_t *attachment, int *err_code); +INTERNAL_FUNC int emcore_delete_mail_attachment(int mail_id, char *attachment_id, int *err_code); +INTERNAL_FUNC int emcore_mail_add_attachment_data(int input_mail_id, emf_attachment_data_t *input_attachment_data); + +#ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__ +INTERNAL_FUNC int emcore_insert_pbd_activity(emf_event_partial_body_thd *local_activity, int *activity_id, int *err_code) ; +INTERNAL_FUNC int emcore_delete_pbd_activity(int account_id, int mail_id, int activity_id, int *err_code); +#endif + +INTERNAL_FUNC int emcore_get_mail_contact_info(emf_mail_contact_info_t *contact_info, char *full_address, int *err_code); +INTERNAL_FUNC int emcore_get_mail_contact_info_with_update(emf_mail_contact_info_t *contact_info, char *full_address, int mail_id, int *err_code); +INTERNAL_FUNC int emcore_free_contact_info(emf_mail_contact_info_t *contact_info, int *err_code); +INTERNAL_FUNC int emcore_sync_contact_info(int mail_id, int *err_code); +INTERNAL_FUNC GList *emcore_get_recipients_list(GList *old_recipients_list, char *full_address, int *err_code); +INTERNAL_FUNC int emcore_get_mail_address_info_list(int mail_id, emf_address_info_list_t **address_info_list, int *err_code); +INTERNAL_FUNC int emcore_get_mail_display_name(CTSvalue *contact_name_value, char **contact_display_name); +INTERNAL_FUNC int emcore_get_mail_data(int input_mail_id, emf_mail_data_t **output_mail_data); + +INTERNAL_FUNC int emcore_update_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int sync_server); + +INTERNAL_FUNC int emcore_fetch_flags(int account_id, int mail_id, emf_mail_flag_t *mail_flag, int *err_code); +INTERNAL_FUNC int emcore_delete_mail_from_local_storage(int account_id, int *mail_ids, int num, int noti_param_1, int noti_param_2, int *err_code); +INTERNAL_FUNC int emcore_get_mail_msgno_by_uid(emf_account_t *account, emf_mailbox_t *mailbox, char *uid, int *msgno, int *err_code); + +/** + * Delete mails. + * + * @param[in] account_id Specifies the account id. + * @param[in] mail_id Specifies the array for mail id. + * @param[in] num Specifies the number of id. + * @param[in] from_server Specifies whether mails is deleted from server. + * @param[in] callback Specifies the callback function for delivering status during deleting. + * @param[in] noti_param_1 Specifies the first parameter for notification. + * @param[in] noti_param_2 Specifies the second parameter for notification. + * @param[out] err_code Specifies the error code returned. + * @remarks N/A + * @return This function returns true on success or false on failure. + */ +INTERNAL_FUNC int emcore_delete_mail(int account_id, int mail_id[], int num, int from_server, int noti_param_1, int noti_param_2, int *err_code); + +/** + * Delete mails. + * + * @param[in] mailbox Specifies the mailbox. this argument is for account id or mailbox name. + * @param[in] with_server Specifies whether mails is also deleted from server. + * @param[in] callback Specifies the callback function for delivering status during deleting. + * @param[out] err_code Specifies the error code returned. + * @remarks N/A + * @return This function returns true on success or false on failure. + */ +INTERNAL_FUNC int emcore_delete_mail_all(emf_mailbox_t *mailbox, int with_server, int *err_code); + +INTERNAL_FUNC int emcore_free_mail_data(emf_mail_data_t **mail_list, int count, int *err_code); +INTERNAL_FUNC void emcore_free_content_info(struct _m_content_info *cnt_info); +INTERNAL_FUNC int emcore_free_attachment_info(emf_attachment_info_t **atch_info, int *err_code); +INTERNAL_FUNC int emcore_free_attachment_data(emf_attachment_data_t **attachment_data_list, int attachment_data_count, int *err_code); + +INTERNAL_FUNC int emcore_move_mail_on_server(int account_id, char *src_mailbox, int mail_ids[], int num, char *dest_mailbox, int *error_code); +INTERNAL_FUNC int emcore_sync_flag_with_server(int mail_id, int *err_code); +INTERNAL_FUNC int emcore_sync_seen_flag_with_server(int mail_ids[], int num, int *err_code); +INTERNAL_FUNC int emcore_get_attachment_info(int mail_id, char *attachment_no, emf_attachment_info_t **attachment, int *err_code); +INTERNAL_FUNC int emcore_get_attachment_data_list(int input_mail_id, emf_attachment_data_t **output_attachment_data, int *output_attachment_count); +INTERNAL_FUNC int emcore_modify_extra_flag(int mail_id, emf_extra_flag_t new_flag, int *err_code); +INTERNAL_FUNC int emcore_modify_flag(int mail_id, emf_mail_flag_t new_flag, int sticky_flag, int *err_code); +INTERNAL_FUNC int emcore_set_flags_field(int account_id, int mail_ids[], int num, emf_flags_field_type field_type, int value, int *err_code); +INTERNAL_FUNC char* emcore_convert_mutf7_to_utf8(char *mailbox_name); +INTERNAL_FUNC int emcore_convert_string_to_structure(const char *encoded_string, void **struct_var, emf_convert_struct_type_e type); + +#ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__ +INTERNAL_FUNC int emcore_sync_flags_field_with_server(int mail_ids[], int num, emf_flags_field_type field_type, int value, int *err_code); +INTERNAL_FUNC int emcore_move_mail_on_server_ex(int account_id, char *src_mailbox, int mail_ids[], int num, char *dest_mailbox, int *error_code); +#endif + +#ifdef __ATTACHMENT_OPTI__ +INTERNAL_FUNC int emcore_download_attachment_bulk(/*emf_mailbox_t *mailbox, */ int account_id, int mail_id, char *nth, int *err_code); +#endif +INTERNAL_FUNC int emcore_mail_filter_by_rule(emf_rule_t *filter_info, int *err_code); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif +/* EOF */ diff --git a/email-core/include/em-core-mailbox-sync.h b/email-core/include/email-core-mailbox-sync.h index 69625e8..d0858ca 100755 --- a/email-core/include/em-core-mailbox-sync.h +++ b/email-core/include/email-core-mailbox-sync.h @@ -21,7 +21,7 @@ /****************************************************************************** - * File : em-core-mailbox_sync.h + * File : email-core-mailbox_sync.h * Desc : Mail Header Sync Header * * Auth : @@ -29,21 +29,17 @@ * History : * 2006.08.16 : created *****************************************************************************/ -#ifndef __EM_CORE_MAILBOX_SYNC_H__ -#define __EM_CORE_MAILBOX_SYNC_H__ +#ifndef __EMAIL_CORE_MAILBOX_SYNC_H__ +#define __EMAIL_CORE_MAILBOX_SYNC_H__ -#include "emf-types.h" -#include "em-storage.h" +#include "email-types.h" +#include "email-storage.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#if !defined(EXPORT_API) -#define EXPORT_API __attribute__((visibility("default"))) -#endif - #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__ #define IMAGE_DISPLAY_PARTIAL_BODY_COUNT 30 @@ -53,6 +49,7 @@ typedef struct char *text_image; char *content_id; int dec_len; + char *mime_type; } emf_image_data; typedef struct @@ -63,18 +60,20 @@ typedef struct #endif -typedef struct em_core_uid_elem { +typedef struct emcore_uid_elem { int msgno; char *uid; emf_mail_flag_t flag; - struct em_core_uid_elem *next; -} em_core_uid_list; + struct emcore_uid_elem *next; +} emcore_uid_list; int pop3_mail_calc_rfc822_size(MAILSTREAM *stream, int msgno, int *size, int *err_code); -int pop3_mailbox_get_uids(MAILSTREAM *stream, em_core_uid_list** uid_list, int *err_code); +int pop3_mailbox_get_uids(MAILSTREAM *stream, emcore_uid_list** uid_list, int *err_code); int imap4_mail_calc_rfc822_size(MAILSTREAM *stream, int msgno, int *size, int *err_code); -int imap4_mailbox_get_uids(MAILSTREAM *stream, em_core_uid_list** uid_list, int *err_code); +int imap4_mailbox_get_uids(MAILSTREAM *stream, emcore_uid_list** uid_list, int *err_code); + +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); /** * Download unread all headers from mail server. @@ -88,13 +87,13 @@ int imap4_mailbox_get_uids(MAILSTREAM *stream, em_core_uid_list** uid_list, int * @remarks N/A * @return This function returns true on success or false on failure. */ -EXPORT_API int em_core_mailbox_sync_header(emf_mailbox_tbl_t *input_mailbox_tbl, emf_mailbox_tbl_t *input_mailbox_tbl_spam, void *stream_recycle, em_core_uid_list **input_uid_list, int *unread_mail, int *err_code); +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); typedef enum { EM_CORE_GET_UIDS_FOR_NO_DELETE = 0, EM_CORE_GET_UIDS_FOR_DELETE, -} em_core_get_uids_for_delete_t; +} emcore_get_uids_for_delete_t; /** * Download UID list from mail server. * @@ -109,12 +108,12 @@ typedef enum * @remarks N/A * @return This function returns true on success or false on failure. */ -int em_core_mailbox_download_uid_all(emf_mailbox_t *mailbox, - em_core_uid_list **uid_list, +int emcore_download_uid_all(emf_mailbox_t *mailbox, + emcore_uid_list **uid_list, int *total, - emf_mail_read_mail_uid_tbl_t *read_mail_uids, + emstorage_read_mail_uid_tbl_t *read_mail_uids, int count, - em_core_get_uids_for_delete_t for_delete, + emcore_get_uids_for_delete_t for_delete, int *err_code); @@ -129,7 +128,7 @@ int em_core_mailbox_download_uid_all(emf_mailbox_t *mailbox, * @remarks N/A * @return This function returns true on success or false on failure. */ -int em_core_mailbox_download_imap_msgno(emf_mailbox_t *mailbox, char *uid, int *msgno, int *err_code); +int emcore_download_imap_msgno(emf_mailbox_t *mailbox, char *uid, int *msgno, int *err_code); /** * Get a message number to be related to uid. @@ -141,7 +140,7 @@ int em_core_mailbox_download_imap_msgno(emf_mailbox_t *mailbox, char *uid, int * * @remarks The uid list must be already saved in fpath before this fucntion is called. * @return This function returns true on success or false on failure. */ -int em_core_mailbox_get_msgno(em_core_uid_list *uid_list, char *uid, int *msgno, int *err_code); +int emcore_get_msgno(emcore_uid_list *uid_list, char *uid, int *msgno, int *err_code); /** * Get a uid to be related to a message number. @@ -153,7 +152,7 @@ int em_core_mailbox_get_msgno(em_core_uid_list *uid_list, char *uid, int *msgno, * @remarks The uid list must be already saved in fpath before this fucntion is called. * @return This function returns true on success or false on failure. */ -int em_core_mailbox_get_uid(em_core_uid_list *uid_list, int msgno, char **uid, int *err_code); +int emcore_get_uid(emcore_uid_list *uid_list, int msgno, char **uid, int *err_code); /** * free fetch list. @@ -162,13 +161,12 @@ int em_core_mailbox_get_uid(em_core_uid_list *uid_list, int msgno, char **uid, i * @param[out] err_code Specifies the error code returned. * @return This function returns true on success or false on failure. */ -int em_core_mailbox_free_uids(em_core_uid_list *uid_list, int *err_code); +int emcore_free_uids(emcore_uid_list *uid_list, int *err_code); -EXPORT_API int em_core_mail_sync_from_client_to_server(int account_id, int mail_id, int *err_code); -EXPORT_API int em_core_mail_check_rule(emf_mail_head_t *head, emf_mail_rule_tbl_t *rule, int rule_len, int *matched, int *err_code); +INTERNAL_FUNC int emcore_sync_mail_from_client_to_server(int account_id, int mail_id, int *err_code); #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__ -EXPORT_API int em_core_bulk_partial_mailbody_download(MAILSTREAM *stream, emf_event_partial_body_thd *pbd_event, int count, int *error); +INTERNAL_FUNC int emcore_download_bulk_partial_mail_body(MAILSTREAM *stream, emf_event_partial_body_thd *pbd_event, int count, int *error); #endif /* __FEATURE_PARTIAL_BODY_DOWNLOAD__ */ diff --git a/email-core/include/email-core-mailbox.h b/email-core/include/email-core-mailbox.h new file mode 100755 index 0000000..7be9255 --- /dev/null +++ b/email-core/include/email-core-mailbox.h @@ -0,0 +1,89 @@ +/* +* email-service +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + + + +/****************************************************************************** + * File : email-core-mailbox.h + * Desc : Local Mailbox Management Header + * + * Auth : + * + * History : + * 2006.08.16 : created + *****************************************************************************/ +#ifndef __EMAIL_CORE_MAILBOX_H__ +#define __EMAIL_CORE_MAILBOX_H__ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#include "c-client.h" +#include "email-types.h" +#include "email-internal-types.h" + +typedef enum +{ + EM_CORE_STREAM_TYPE_RECV = 0, + EM_CORE_STREAM_TYPE_SEND, +} emcore_stream_type_t; + +#ifdef __FEATURE_KEEP_CONNECTION__ +INTERNAL_FUNC int emcore_remove_connection_info(int account_id); +#endif /* __FEATURE_KEEP_CONNECTION__ */ +/* in SMTP case, path argument must be (ENCODED_PATH_SMTP) */ +/* ex) emcore_connect_to_remote_mailbox(xxx, (char *)ENCODED_PATH_SMTP, xxx, xxx); */ +INTERNAL_FUNC int emcore_connect_to_remote_mailbox_with_account_info(emf_account_t *ref_account, char *mailbox, void **mail_stream, int *err_code); +INTERNAL_FUNC int emcore_connect_to_remote_mailbox(int account_id, char *mailbox, void **mail_stream, int *err_code); +INTERNAL_FUNC int emcore_close_mailbox(int account_id, void *mail_stream); +#ifdef __FEATURE_KEEP_CONNECTION__ +INTERNAL_FUNC void emcore_close_mailbox_receiving_stream(); +INTERNAL_FUNC void emcore_close_mailbox_partial_body_stream(); +INTERNAL_FUNC void emcore_reset_streams(); +#endif + +INTERNAL_FUNC int emcore_get_list_to_be_sync(int account_id, emf_mailbox_t **mailbox_list, int *p_count, int *err_code); +INTERNAL_FUNC int emcore_get_list(int account_id, emf_mailbox_t **mailbox_list, int *p_count, int *err_code); +INTERNAL_FUNC int emcore_free_mailbox(emf_mailbox_t **mailbox_list, int count, int *err_code); +INTERNAL_FUNC int emcore_get_mail_count(emf_mailbox_t *mailbox, int *total, int *unseen, int *err_code); +INTERNAL_FUNC int emcore_create_mailbox(emf_mailbox_t *new_mailbox, int on_server, int *err_code); +INTERNAL_FUNC int emcore_delete_mailbox(emf_mailbox_t *mailbox, int on_server, int *err_code); +INTERNAL_FUNC int emcore_delete_mailbox_all(emf_mailbox_t *mailbox, int *err_code); +INTERNAL_FUNC int emcore_update_mailbox(emf_mailbox_t *old_mailbox, emf_mailbox_t *new_mailbox, int *err_code); +INTERNAL_FUNC int emcore_save_local_activity_sync(int account_id, int *err_code); +INTERNAL_FUNC void emcore_bind_mailbox_type(emf_mailbox_t *mailbox_list); +INTERNAL_FUNC int emcore_send_mail_event(emf_mailbox_t *mailbox, int mail_id , int *err_code); +INTERNAL_FUNC int emcore_partial_body_thd_local_activity_sync(int *is_event_inserted, int *err_code); +INTERNAL_FUNC int emcore_get_mailbox_by_type(int account_id, emf_mailbox_type_e mailbox_type, emf_mailbox_t *spam_mailbox, int *err_code); + +#ifdef __FEATURE_LOCAL_ACTIVITY__ +INTERNAL_FUNC int emcore_local_activity_sync(int account_id, int *err_code); +INTERNAL_FUNC int emcore_save_local_activity_sync(int account_id, int *err_code); +#endif + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif diff --git a/email-core/include/email-core-mime.h b/email-core/include/email-core-mime.h new file mode 100755 index 0000000..726c7f6 --- /dev/null +++ b/email-core/include/email-core-mime.h @@ -0,0 +1,60 @@ +/* +* email-service +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + + +/****************************************************************************** + * File : email-core-mime.h + * Desc : MIME Operation Header + * + * Auth : + * + * History : + * 2011.04.14 : created + *****************************************************************************/ +#ifndef __EMAIL_CORE_MIME_H__ +#define __EMAIL_CORE_MIME_H__ + +#include "email-internal-types.h" +#include "c-client.h" +#include "email-storage.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +char *emcore_get_line_from_file(void *stream, char *buf, int size, int *err_code); +int emcore_parse_mime(void *stream, int is_file, struct _m_content_info *cnt_info, int *err_code); +INTERNAL_FUNC int emcore_get_content_type_from_mime_string(char *input_mime_string, char **output_content_type); +INTERNAL_FUNC int emcore_get_content_type_from_mail_bodystruct(BODY *input_body, int input_buffer_length, char *output_content_type); +INTERNAL_FUNC int emcore_get_attribute_value_of_body_part(PARAMETER *input_param, char *atribute_name, char *output_value, int output_buffer_length, int with_rfc2047_text, int *err_code); +INTERNAL_FUNC int emcore_get_body_part_list_full(MAILSTREAM *stream, int msg_uid, int account_id, int mail_id, BODY *body, struct _m_content_info *cnt_info, int *err_code, PARTLIST * section_list, int event_handle); +INTERNAL_FUNC int emcore_get_body(MAILSTREAM *stream, int account_id, int mail_id, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code); +INTERNAL_FUNC int emcore_get_body_structure(MAILSTREAM *stream, int msg_uid, BODY **body, int *err_code); +INTERNAL_FUNC char *emcore_decode_rfc2047_text(char *rfc2047_text, int *err_code); +INTERNAL_FUNC int emcore_decode_body_text(char *enc_buf, int enc_len, int enc_type, int *dec_len, int *err_code); +INTERNAL_FUNC int emcore_set_fetch_body_section(BODY *body, int enable_inline_list, int *total_mail_size, int *err_code); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif +/* EOF */ diff --git a/email-core/include/em-core-smtp.h b/email-core/include/email-core-smtp.h index e968a77..1c71665 100755 --- a/email-core/include/em-core-smtp.h +++ b/email-core/include/email-core-smtp.h @@ -22,7 +22,7 @@ /****************************************************************************** - * File : em-core-smtp.h + * File : email-core-smtp.h * Desc : Mail SMTP Header * * Auth : @@ -30,34 +30,29 @@ * History : * 2006.08.16 : created *****************************************************************************/ -#ifndef __EM_CORE_SMTP_H__ -#define __EM_CORE_SMTP_H__ +#ifndef __EMAIL_CORE_SMTP_H__ +#define __EMAIL_CORE_SMTP_H__ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -/* /#include "emflib.h" */ #include <stdio.h> #include "c-client.h" +#include "email-internal-types.h" -#if !defined(EXPORT_API) -#define EXPORT_API __attribute__((visibility("default"))) -#endif - - -EXPORT_API int em_core_mail_send(int account_id, char *mailbox, int mail_id, emf_option_t *sending_option, int *err_code); +INTERNAL_FUNC int emcore_send_mail(int account_id, char *mailbox, int mail_id, emf_option_t *sending_option, int *err_code); -EXPORT_API int em_core_mail_send_saved(int account_id, char *mailbox, emf_option_t *sending_option, int *err_code); +INTERNAL_FUNC int emcore_send_saved_mail(int account_id, char *mailbox, emf_option_t *sending_option, int *err_code); -EXPORT_API int em_core_mail_get_rfc822(emf_mail_t *mail, ENVELOPE **env, char **file_path, emf_option_t *sending_option, int *err_code); +INTERNAL_FUNC int emcore_make_rfc822_file_from_mail(emstorage_mail_tbl_t *input_mail_tbl_data, emstorage_attachment_tbl_t *input_attachment_tbl_t, int input_attachment_count, ENVELOPE **env, char **file_path, emf_option_t *sending_option, int *err_code); -EXPORT_API int em_core_mail_save(int account_id, char *mailbox_name, emf_mail_t *mail_src, emf_meeting_request_t *meeting_req, int from_composer, int *err_code); +INTERNAL_FUNC int emcore_add_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t *input_meeting_request, int input_from_eas); -EXPORT_API int em_core_add_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t *input_meeting_request, int input_sync_server); +INTERNAL_FUNC int emcore_add_read_receipt(int input_read_mail_id, int *output_receipt_mail_id); -EXPORT_API int em_core_mail_add_meeting_request(int account_id, char *mailbox_name, emf_meeting_request_t *meeting_req, int *err_code); +INTERNAL_FUNC int emcore_add_meeting_request(int account_id, char *mailbox_name, emf_meeting_request_t *meeting_req, int *err_code); #ifdef __cplusplus } diff --git a/email-core/include/em-core-sound.h b/email-core/include/email-core-sound.h index 34fbe1c..a0dea59 100755 --- a/email-core/include/em-core-sound.h +++ b/email-core/include/email-core-sound.h @@ -28,23 +28,6 @@ #include <devman_haptic.h> #include <alarm.h> -#define MAX_LENGTH 255 -#define TIMER 7000 -#define HAPTIC_TEST_ITERATION 1 - -void em_core_set_repetition_alarm(int repetition); -int em_core_vibration_destory(); -int em_core_vibration_stop(); -int em_core_sound_mp_player_stop(); -bool em_core_sound_mp_player_destory(); -void *start_alert_thread(void *arg); -EXPORT_API int em_core_alert_loop_start(int *err_code); -EXPORT_API void start_alert(); - -#ifdef Min -#undef Min -#endif - typedef enum { EMAIL_SOUND_STATUS, @@ -69,3 +52,10 @@ typedef enum EMAIL_GCONF_VALUE_REPEAT_5MINS, EMAIL_GCONF_VALUE_REPEAT_10MINS, } EMAIL_ALERT_REPEAT_ALARM; + +#ifdef Min +#undef Min +#endif + +INTERNAL_FUNC int emcore_start_alert_thread(int *err_code); +INTERNAL_FUNC void emcore_start_alert(); diff --git a/email-core/include/em-core-timer.h b/email-core/include/email-core-timer.h index e64cdbe..4bf4fe3 100755 --- a/email-core/include/em-core-timer.h +++ b/email-core/include/email-core-timer.h @@ -19,7 +19,7 @@ * */ - +#include "email-internal-types.h" typedef void (*EMF_TIMER_CALLBACK)(void *a_pData); @@ -29,7 +29,7 @@ typedef void (*EMF_TIMER_CALLBACK)(void *a_pData); * @param[in] a_pData Specifies the data passed to callback. * @return This function returns true for repeat alerts or false for mail resend. */ -EXPORT_API int em_core_timer_ex_callback(void *a_pData); +INTERNAL_FUNC int emcore_timer_ex_callback(void *a_pData); /** * Set timer @@ -40,7 +40,7 @@ EXPORT_API int em_core_timer_ex_callback(void *a_pData); * @remarks N/A * @return This function returns the timer id. */ -EXPORT_API int em_core_set_timer_ex(long a_nSetTimeValue, EMF_TIMER_CALLBACK a_pCallBack, void *a_pData); +INTERNAL_FUNC int emcore_set_timer_ex(long a_nSetTimeValue, EMF_TIMER_CALLBACK a_pCallBack, void *a_pData); /** * Kill timer. @@ -49,4 +49,4 @@ EXPORT_API int em_core_set_timer_ex(long a_nSetTimeValue, EMF_TIMER_CALLBACK a_p * @remarks N/A * @return This function returns void. */ -EXPORT_API void em_core_kill_timer_ex(int a_nTimerID); +INTERNAL_FUNC void emcore_kill_timer_ex(int a_nTimerID); diff --git a/email-core/include/email-core-utils.h b/email-core/include/email-core-utils.h new file mode 100755 index 0000000..62f2ce3 --- /dev/null +++ b/email-core/include/email-core-utils.h @@ -0,0 +1,193 @@ +/* +* email-service +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + + +/****************************************************************************** + * File : email-core-utils.h + * Desc : Mail Utils Header + * + * Auth : + * + * History : + * 2006.08.16 : created + *****************************************************************************/ +#ifndef __EMAIL_CORE_UTILS_H__ +#define __EMAIL_CORE_UTILS_H__ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#include "email-types.h" +#include "email-internal-types.h" +#include "email-storage.h" +#include "email-core-global.h" +#include "email-core-mail.h" + +/* This is used for emcore_get_long_encoded_path */ +#define ENCODED_PATH_SMTP "UHDF_ENCODED_PATH_SMTP_EKJD" + +typedef int (*emf_get_unread_email_count_cb)(int unread, int *err_code); + +/* parse the Full mailbox Path and get the Alias Name of the Mailbox */ +char* emcore_get_alias_of_mailbox(const char *mailbox_path); + +/* Parse the Mailbox Path and get the Account Email address */ +int emcore_get_temp_file_name(char **filename, int *err_code); +int emcore_get_long_encoded_path(int account_id, char *path, int delimiter, char **long_enc_path, int *err_code); +int emcore_get_encoded_mailbox_name(char *name, char **enc_name, int *err_code); +int emcore_get_file_name(char *path, char **filename, int *err_code); +int emcore_get_file_size(char *path, int *size, int *err_code); +int emcore_get_actual_mail_size(char *pBodyPlane, char *pBodyHtml, struct attachment_info *pAttachment, int *error_code); +int emcore_calc_mail_size(emf_mail_data_t *mail_data_src, emf_attachment_data_t *attachment_data_src, int attachment_count, int *error_code); +int emcore_get_address_count(char *addr_str, int *to_num, int *err_code); +int emcore_is_storage_full(int *error); +int emcore_show_popup(int id, emf_action_t action, int error); +int emcore_get_long_encoded_path_with_account_info(emf_account_t *account, char *path, int delimiter, char **long_enc_path, int *err_code); +void emcore_fill_address_information_of_mail_tbl(emstorage_mail_tbl_t *mail_data); + + +int emcore_get_preview_text_from_file(const char *input_plain_path, const char *input_html_path, int input_preview_buffer_length, char **output_preview_buffer); +int emcore_strip_HTML(char *source_string); +int emcore_send_noti_for_new_mail(int account_id, char *mailbox_name, char *subject, char *from, char *uid, char *datetime); +int emcore_make_attachment_file_name_with_extension(char *source_file_name, char *sub_type, char *result_file_name, int result_file_name_buffer_length, int *err_code); + +/* Session Handling */ +int emcore_get_empty_session(emf_session_t **session); +int emcore_clear_session(emf_session_t *session); +int emcore_get_current_session(emf_session_t **session); + +INTERNAL_FUNC emf_option_t *emcore_get_option(int *err_code); +INTERNAL_FUNC int emcore_set_option(emf_option_t *opt, int *err_code); + +INTERNAL_FUNC int emcore_check_unread_mail(); +INTERNAL_FUNC int emcore_set_network_error(int err_code); + +/* Transaction Handling */ +INTERNAL_FUNC int emcore_add_transaction_info(int mail_id , int handle , int *err_code); +INTERNAL_FUNC int emcore_get_handle_by_mailId_from_transaction_info(int mail_id , int *pHandle); +INTERNAL_FUNC int emcore_delete_transaction_info_by_mailId(int mail_id); + +/* For notification bar */ +INTERNAL_FUNC int emcore_update_notification_for_unread_mail(int account_id); +INTERNAL_FUNC int emcore_clear_all_notifications(); +INTERNAL_FUNC int emcore_add_notification_for_unread_mail(emstorage_mail_tbl_t *input_mail_tbl_data); +INTERNAL_FUNC int emcore_delete_notification_for_read_mail(int mail_id); +INTERNAL_FUNC int emcore_delete_notification_by_account(int account_id); +INTERNAL_FUNC int emcore_finalize_sync(int account_id, int *error); + + + +#ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__ + +/** + * @fn emcore_convert_to_uid_range_set(emf_id_set_t *id_set, int id_set_count, emf_uid_range_set **uid_range_set, int range_len, int *err_code) + * Prepare a linked list of uid ranges with each node having a uid_range and lowest and highest uid in it. + * + *@author h.gahlaut@samsung.com + * @param[in] id_set Specifies the array of mail_id and corresponding server_mail_id sorted by server_mail_ids in ascending order + * @param[in] id_set_count Specifies the no. of cells in id_set array i.e. no. of sets of mail_ids and server_mail_ids + * @param[in] range_len Specifies the maximum length of string of range allowed. + * @param[out] uid_range_set Returns the uid_ranges formed in the form of a linked list with head stored in uid_range_set pointer + * @param[out] err_code Returns the error code. + * @remarks An example of a uid_range formed is 2 : 6, 8, 10, 14 : 15, 89, + * While using it the caller should remove the ending , (comma) + * @return This function returns true on success or false on failure. + */ + +INTERNAL_FUNC int emcore_convert_to_uid_range_set(emf_id_set_t *id_set, int id_set_count, emf_uid_range_set **uid_range_set, int range_len, int *err_code); + +/** + * void emcore_free_uid_range_set(emf_uid_range_set **uid_range_head) + * Frees the linked list of uid ranges + * + * @author h.gahlaut@samsung.com + * @param[in] uid_range_head Head pointer of linked list of uid ranges + * @remarks + * @return This function does not return anything. + */ +INTERNAL_FUNC void emcore_free_uid_range_set(emf_uid_range_set **uid_range_set); + +/** + * @fn emcore_append_subset_string_to_uid_range(char *subset_string, emf_uid_range_set **uid_range_set, int range_len, unsigned long luid, unsigned long huid) + * Appends the subset_string to uid range if the uid range has not exceeded maximum length(range_len), otherwise creates a new node in linked list of uid range set + * and stores the subset_string in its uid_range. Also sets the lowest and highest uids for the corresponsing uid_range + * + * @author h.gahlaut@samsung.com + * @param[in] subset_string Specifies the subset string to be appended. A subset string can be like X : Y or X where X and Y are uids. + * @param[in] range_len Specifies the maximum length of range string allowed. + * @param[in] luid Specifies the lowest uid in subset string + * @param[in] huid Specifies the highest uid in subset string + * @param[out] uid_range_set Returns the uid_ranges formed in the form of a linked list with head stored in uid_range_set pointer + * @param[out] err_code Returns the error code. + * @remarks + * @return This function returns true on success or false on failure. + */ + +int emcore_append_subset_string_to_uid_range(char *subset_string, emf_uid_range_set **current_node_adr, emf_uid_range_set **uid_range_set, int range_len, unsigned long luid, unsigned long huid); + +/** + * @fn emcore_form_comma_separated_strings(int numbers[], int num_count, int max_string_len, char ***strings, int *string_count, int *err_code) + * Forms comma separated strings of a give max_string_len from an array of numbers + * + * @author h.gahlaut@samsung.com + * @param[in] numbers Specifies the array of numbers to be converted into comma separated strings. + * @param[in] num_count Specifies the count of numbers in numbers array. + * @param[in] max_string_len Specifies the maximum length of comma separated strings that are to be formed. + * @param[out] strings Returns the base address of a double dimension array which stores the strings. + * @param[out] string_count Returns the number of strings formed. + * @param[out] err_code Returns the error code. + * @remarks If Input to the function is five numbers like 2755 2754 2748 2749 2750 and a given max_string_len is 20. + * Then this function will form two comma separated strings as follows - + * "2755, 2754, 2748" + * "2749, 2750" + * @return This function returns true on success or false on failure. + */ +INTERNAL_FUNC int emcore_form_comma_separated_strings(int numbers[], int num_count, int max_string_len, char ***strings, int *string_count, int *err_code); + +/** + * @fn emcore_free_comma_separated_strings(char ***string_list, int *string_count) + * Frees the double dimensional array of strings. + * + * @author h.gahlaut@samsung.com + * @param[in] uid_range_head Address of base address of double dimensional array of strings. + * @param[in] string_count Address of variable holding the count of strings. + * @remarks + * @return This function does not return anything. + */ + +INTERNAL_FUNC void emcore_free_comma_separated_strings(char ***string_list, int *string_count); + +#endif + +#ifdef __FEATURE_LOCAL_ACTIVITY__ +/* Added to get next activity id sequence */ +INTERNAL_FUNC int emcore_get_next_activity_id(int *activity_id, int *err_code); +INTERNAL_FUNC int emcore_add_activity(emstorage_activity_tbl_t *new_activity, int *err_code); +INTERNAL_FUNC int emcore_delete_activity(emstorage_activity_tbl_t *activity, int *err_code); +#endif /* __FEATURE_LOCAL_ACTIVITY__ */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __EMAIL_CORE_UTILS_H__ */ |