Tizen 2.0 Release
[platform/core/messaging/email-service.git] / email-core / include / email-core-event.h
1 /*
2 *  email-service
3 *
4 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5 *
6 * Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>
7
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 *
20 */
21
22
23 /******************************************************************************
24  * File :  email-core-event.h
25  * Desc :  Mail Engine Event Header
26  *
27  * Auth : 
28  *
29  * History : 
30  *    2006.08.16  :  created
31  *****************************************************************************/
32 #ifndef __EMAIL_CORE_EVNET_H__
33 #define __EMAIL_CORE_EVNET_H__
34
35 #include "email-types.h"
36 #include "email-internal-types.h"
37
38 #ifdef __cplusplus
39 extern "C"
40 {
41 #endif /* __cplusplus */
42
43 void emcore_execute_event_callback(email_action_t action, int total, int done, int status, int account_id, int mail_id, int handle, int error);
44 int  emcore_get_active_queue_idx(void);
45 int  emcore_check_send_mail_thread_status();
46
47 INTERNAL_FUNC int          emcore_get_current_thread_type();
48 INTERNAL_FUNC int          emcore_register_event_callback(email_action_t action, email_event_callback callback, void *event_data);
49 INTERNAL_FUNC int          emcore_unregister_event_callback(email_action_t action, email_event_callback callback);
50 INTERNAL_FUNC int          emcore_get_pending_event(email_action_t action, int account_id, int mail_id, email_event_status_type_t *status);
51 INTERNAL_FUNC int          emcore_start_event_loop(int *err_code);
52 INTERNAL_FUNC int          emcore_stop_event_loop(int *err_code);
53 INTERNAL_FUNC int          emcore_insert_event(email_event_t *event_data, int *handle, int *err_code);
54 INTERNAL_FUNC int          emcore_cancel_thread(int handle, void *arg, int *err_code);
55 INTERNAL_FUNC int          emcore_start_event_loop_for_sending_mails(int *err_code);
56 INTERNAL_FUNC int          emcore_send_event_loop_stop(int *err_code);
57 INTERNAL_FUNC int          emcore_cancel_send_mail_thread(int handle, void *arg, int *err_code);
58 INTERNAL_FUNC int          emcore_check_thread_status(void);
59 INTERNAL_FUNC void         emcore_get_event_queue_status(int *on_sending, int *on_receiving);
60 INTERNAL_FUNC int          emcore_insert_event_for_sending_mails(email_event_t *event_data, int *handle, int *err_code);
61 INTERNAL_FUNC int          emcore_get_receiving_event_queue(email_event_t **event_queue, int *event_count, int *err);
62 INTERNAL_FUNC int          emcore_cancel_all_threads_of_an_account(int account_id);
63 INTERNAL_FUNC int          emcore_free_event(email_event_t *event_data);
64
65 #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
66 /*  Please contact -> Himanshu [h.gahlaut@samsung.com] for any explanation in code here under this MACRO */
67 INTERNAL_FUNC int          emcore_insert_partial_body_thread_event(email_event_partial_body_thd *partial_body_thd_event, int *error_code);
68 INTERNAL_FUNC int          emcore_is_partial_body_thd_que_empty();
69 INTERNAL_FUNC int          emcore_is_partial_body_thd_que_full();
70 INTERNAL_FUNC int          emcore_start_thread_for_downloading_partial_body(int *err_code);
71 INTERNAL_FUNC int          emcore_clear_partial_body_thd_event_que(int *err_code);
72 INTERNAL_FUNC int          emcore_free_partial_body_thd_event(email_event_partial_body_thd *partial_body_thd_event, int *error_code);
73 INTERNAL_FUNC unsigned int emcore_get_partial_body_thd_id();
74 INTERNAL_FUNC int          emcore_get_pbd_thd_state();
75 unsigned int emcore_get_receiving_thd_id();
76 #endif
77
78 #ifdef __cplusplus
79 }
80 #endif /* __cplusplus */
81
82 #endif