diff options
Diffstat (limited to 'email-api')
-rwxr-xr-x | email-api/CMakeLists.txt | 8 | ||||
-rwxr-xr-x | email-api/doc/email-service_doc.h | 85 | ||||
-rwxr-xr-x | email-api/email-api-account.c | 171 | ||||
-rwxr-xr-x | email-api/email-api-etc.c | 80 | ||||
-rwxr-xr-x | email-api/email-api-init.c | 30 | ||||
-rwxr-xr-x | email-api/email-api-mail.c | 139 | ||||
-rwxr-xr-x | email-api/email-api-mailbox.c | 47 | ||||
-rwxr-xr-x | email-api/email-api-network.c | 179 | ||||
-rwxr-xr-x | email-api/email-api-rule.c | 23 | ||||
-rwxr-xr-x | email-api/email-api-smime.c | 161 | ||||
-rwxr-xr-x | email-api/include/email-api-account.h | 608 | ||||
-rwxr-xr-x | email-api/include/email-api-etc.h | 150 | ||||
-rwxr-xr-x | email-api/include/email-api-init.h | 189 | ||||
-rwxr-xr-x | email-api/include/email-api-mail.h | 2318 | ||||
-rwxr-xr-x | email-api/include/email-api-mailbox.h | 654 | ||||
-rwxr-xr-x | email-api/include/email-api-network.h | 555 | ||||
-rwxr-xr-x | email-api/include/email-api-rule.h | 310 | ||||
-rwxr-xr-x | email-api/include/email-api-smime.h | 238 | ||||
-rwxr-xr-x | email-api/include/email-api.h | 24 |
19 files changed, 3091 insertions, 2878 deletions
diff --git a/email-api/CMakeLists.txt b/email-api/CMakeLists.txt index eea919f..9ea8f18 100755 --- a/email-api/CMakeLists.txt +++ b/email-api/CMakeLists.txt @@ -14,6 +14,7 @@ MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}") SET(VISIBILITY "-DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\"") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--gc-sections") ########################################################## # Define Email API @@ -35,13 +36,14 @@ INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/email-api/include ${CMAKE_SOURCE_DIR}/email-api/socket/include ${CMAKE_SOURCE_DIR}/email-ipc/include + ${CMAKE_SOURCE_DIR}/email-ipc/email-activation/include ${CMAKE_SOURCE_DIR}/email-core/include ${CMAKE_SOURCE_DIR}/email-core/email-storage/include ${CMAKE_SOURCE_DIR}/email-common-use/include ) INCLUDE(FindPkgConfig) -pkg_check_modules(api_pkgs REQUIRED glib-2.0 dlog dbus-1 vconf db-util contacts-service2 uw-imap-toolkit) +pkg_check_modules(api_pkgs REQUIRED glib-2.0 dlog dbus-1 vconf contacts-service2 uw-imap-toolkit gmime-2.6) FOREACH(flag ${api_pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") @@ -59,7 +61,7 @@ TARGET_LINK_LIBRARIES(${API-LIB} ${api_pkgs_LDFLAGS} email-ipc email-storage ema SET_TARGET_PROPERTIES(${API-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR}) SET_TARGET_PROPERTIES(${API-LIB} PROPERTIES VERSION ${VERSION}) -INSTALL(TARGETS ${API-LIB} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) +INSTALL(TARGETS ${API-LIB} DESTINATION lib COMPONENT RuntimeLibraries) SET(EMAIL-API-HEADERS ${CMAKE_SOURCE_DIR}/email-api/include/email-api.h @@ -107,7 +109,7 @@ TARGET_LINK_LIBRARIES(${SMIME-API-LIB} ${api_pkgs_LDFLAGS} email-ipc email-stora SET_TARGET_PROPERTIES(${SMIME-API-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR}) SET_TARGET_PROPERTIES(${SMIME-API-LIB} PROPERTIES VERSION ${VERSION}) -INSTALL(TARGETS ${SMIME-API-LIB} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) +INSTALL(TARGETS ${SMIME-API-LIB} DESTINATION lib COMPONENT RuntimeLibraries) SET(SMIME-EMAIL-API-HEADERS ${CMAKE_SOURCE_DIR}/email-api/include/email-api-smime.h diff --git a/email-api/doc/email-service_doc.h b/email-api/doc/email-service_doc.h new file mode 100755 index 0000000..0625199 --- /dev/null +++ b/email-api/doc/email-service_doc.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * 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. + */ + + +#ifndef __TIZEN_EMAIL_SERVICE_DOC_H__ +#define __TIZEN_EMAIL_SERVICE_DOC_H__ + +/** + * @internal + * @ingroup CAPI_MESSAGING_FRAMEWORK + * @defgroup EMAIL_SERVICE_FRAMEWORK email-service + * @brief The Platform API for email functionalities. + * @internal + * + * @addtogroup EMAIL_SERVICE_FRAMEWORK + * + * @section EMAIL_SERVICE_FRAMEWORK_HEADER Required Header + * \#include <email-api.h> + * + * @section EMAIL_SERVICE_FRAMEWORK_OVERVIEW Overview + * Electronic mail, most commonly abbreviated email or e-mail, is a method of exchanging digital messages. + * E-mail systems are based on a store-and-forward model in which e-mail server computer systems accept, + * forward, deliver and store messages on behalf of users, who only need to connect to the e-mail infrastructure, + * typically an e-mail server, with a network-enabled device for the duration of message submission or retrieval. + * The email-service API is implemented to provide functionalities to applications that make use of email service. + * The email-service API can be utilized by any component in the application layer which facilitates the end user + * to perform the email realted operations such as save, send, download email message and others. + * For Example, the email-service API’s shall be invoked by 1) Multimedia when user opts to send media file through email + * 2) Email application when user tries to send an email message etc. + * + * <table> + * <tr> + * <th>Feature</th> + * <th>Description</th> + * </tr> + * <tr> + * <td>Account API</td> + * <td>Account API is a set of operations to manage email accounts like add, update, delete or get account related details.</td> + * </tr> + * <tr> + * <td>Other API</td> + * <td>Various API set for initializing and MIME operations and verifying email address. </td> + * </tr> + * <tr> + * <td>Mail API</td> + * <td>Mail API is a set of operations to manage mail like add, update, delete or get mail related details.</td> + * </tr> + * <tr> + * <td>Mailbox API</td> + * <td>Mailbox API is a set of operations to manage email mailboxes like add, update, delete or get mailbox related details.</td> + * </tr> + * <tr> + * <td>Network API</td> + * <td>Network API is a set of operations to manage email send, receive and cancel related details.</td> + * </tr> + * <tr> + * <td>Rule API</td> + * <td>Rule API is a set of operations to manage email rules like add, get, delete or update rule related details.</td> + * </tr> + * <tr> + * <td>SMIME API</td> + * <td>SMIME API is a set of operations to handle SMIME data for secured email. </td> + * </tr> + * </table> + */ + +#endif /* __TIZEN_EMAIL_SERVICE_DOC_H__ */ + + + + + diff --git a/email-api/email-api-account.c b/email-api/email-api-account.c index 5bc0ebc..08702c3 100755 --- a/email-api/email-api-account.c +++ b/email-api/email-api-account.c @@ -39,6 +39,7 @@ #include "email-core-utils.h" #include "email-utilities.h" #include "email-ipc.h" +#include "email-dbus-activation.h" /* API - Adds the Email Account */ EXPORT_API int email_add_account(email_account_t* account) @@ -133,9 +134,11 @@ EXPORT_API int email_free_account(email_account_t** account_list, int count) EM_SAFE_FREE(p[i].return_address); EM_SAFE_FREE(p[i].logo_icon_path); EM_SAFE_FREE(p[i].user_data); + EM_SAFE_FREE(p[i].certificate_path); p[i].user_data_length = 0; EM_SAFE_FREE(p[i].options.display_name_from); EM_SAFE_FREE(p[i].options.signature); + EM_SAFE_FREE(p[i].options.alert_ringtone_path); } free(p); *account_list = NULL; } @@ -191,7 +194,6 @@ EXPORT_API int email_update_account(int account_id, email_account_t* new_account { EM_DEBUG_API_BEGIN ("account_id[%d] new_account[%p]", account_id, new_account); - int ret = 0; int size = 0; int err = EMAIL_ERROR_NONE; int with_validation = false; @@ -231,18 +233,14 @@ EXPORT_API int email_update_account(int account_id, email_account_t* new_account EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); } - emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &ret); - if(ret != EMAIL_ERROR_NONE) { - /* get error code */ - emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &err); - } + emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); FINISH_OFF: emipc_destroy_email_api(hAPI); hAPI = NULL; - EM_DEBUG_API_END ("ret[%d] err[%d]", ret, err); + EM_DEBUG_API_END ("err[%d]", err); return err; } @@ -251,7 +249,6 @@ EXPORT_API int email_update_account_with_validation(int account_id, email_accoun { EM_DEBUG_API_BEGIN ("account_id[%d] new_account[%p]", account_id, new_account); - int ret = 0; int size = 0; int err = EMAIL_ERROR_NONE; int with_validation = true; @@ -293,15 +290,12 @@ EXPORT_API int email_update_account_with_validation(int account_id, email_accoun EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); } - emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &ret); - if(ret != EMAIL_ERROR_NONE) { /* get error code */ - emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &err); - } + emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); emipc_destroy_email_api(hAPI); hAPI = NULL; - EM_DEBUG_API_END ("ret[%d] err[%d]", ret, err); + EM_DEBUG_API_END ("err[%d]", err); return err; } @@ -310,20 +304,12 @@ EXPORT_API int email_update_account_with_validation(int account_id, email_accoun EXPORT_API int email_get_account(int account_id, int pulloption, email_account_t** account) { EM_DEBUG_FUNC_BEGIN ("account_id[%d] pulloption[%d]", account_id, pulloption); - int ret = 0; int err = EMAIL_ERROR_NONE; emstorage_account_tbl_t *account_tbl = NULL; EM_IF_NULL_RETURN_VALUE(account_id, EMAIL_ERROR_INVALID_PARAM); EM_IF_NULL_RETURN_VALUE(account, EMAIL_ERROR_INVALID_PARAM); -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - goto FINISH_OFF; - } -#endif if (pulloption == GET_FULL_DATA) pulloption = EMAIL_ACC_GET_OPT_FULL_DATA; @@ -353,9 +339,6 @@ EXPORT_API int email_get_account(int account_id, int pulloption, email_account_t memset((void*)*account, 0, sizeof(email_account_t)); em_convert_account_tbl_to_account(account_tbl, *account); - - ret = true; - FINISH_OFF: if (account_tbl) emstorage_free_account(&account_tbl, 1, NULL); @@ -374,13 +357,6 @@ EXPORT_API int email_get_account_list(email_account_t** account_list, int* count EM_IF_NULL_RETURN_VALUE(account_list, EMAIL_ERROR_INVALID_PARAM); EM_IF_NULL_RETURN_VALUE(count, EMAIL_ERROR_INVALID_PARAM); -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - goto FINISH_OFF; - } -#endif if (!emstorage_get_account_list(count, &temp_account_tbl , true, false, &err)) { EM_DEBUG_EXCEPTION("emstorage_get_account_list failed [%d]", err); @@ -596,30 +572,26 @@ EXPORT_API int email_restore_accounts_from_secure_storage(const char * file_name int ret = 0; int err = EMAIL_ERROR_NONE; - if (!file_name) { - EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM"); - err = EMAIL_ERROR_INVALID_PARAM; - return err; - } - HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_RESTORE_ACCOUNTS); EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE); /* file_name */ - if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)file_name, EM_SAFE_STRLEN(file_name)+1)) { - EM_DEBUG_EXCEPTION(" emipc_add_parameter account_id failed "); - EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); + if (file_name) { + if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)file_name, EM_SAFE_STRLEN(file_name)+1)) { + EM_DEBUG_EXCEPTION(" emipc_add_parameter account_id failed "); + EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); + } } - if(emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { + if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { EM_DEBUG_EXCEPTION(" emipc_execute_proxy_api failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &ret); - if(0==ret) { /* get error code */ + if (0 == ret) { /* get error code */ emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &err); } @@ -630,12 +602,11 @@ EXPORT_API int email_restore_accounts_from_secure_storage(const char * file_name return err; } -EXPORT_API int email_get_password_length_of_account(const int account_id, int *password_length) +EXPORT_API int email_get_password_length_of_account(int account_id, email_get_password_length_type password_type, int *password_length) { EM_DEBUG_API_BEGIN ("account_id[%d] password_length[%p]", account_id, password_length); int ret = 0; int err = EMAIL_ERROR_NONE; - int password_type = 1; if (account_id <= 0 || password_length == NULL) { EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM"); @@ -675,48 +646,11 @@ EXPORT_API int email_get_password_length_of_account(const int account_id, int *p return err; } -EXPORT_API int email_query_server_info(const char* domain_name, email_server_info_t **result_server_info) -{ - EM_DEBUG_API_BEGIN ("domain_name[%p] result_server_info[%p]", domain_name, result_server_info); - int err = EMAIL_ERROR_NONE; - - if (!domain_name || !result_server_info) { - EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM"); - err = EMAIL_ERROR_INVALID_PARAM; - return err; - } - - err = emcore_query_server_info(domain_name, result_server_info); - - EM_DEBUG_API_END ("err[%d]", err); - return err; -} - - -EXPORT_API int email_free_server_info(email_server_info_t **result_server_info) +EXPORT_API int email_update_notification_bar(int account_id, int total_mail_count, int unread_mail_count, int input_from_eas) { - EM_DEBUG_API_BEGIN ("result_server_info[%p]", result_server_info); + EM_DEBUG_API_BEGIN ("account_id[%d] total_mail_count[%d] unread_mail_count[%d]", account_id, total_mail_count, unread_mail_count); int err = EMAIL_ERROR_NONE; - if (!result_server_info) { - EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM"); - err = EMAIL_ERROR_INVALID_PARAM; - return err; - } - - err = emcore_free_server_info(result_server_info); - - EM_DEBUG_API_END ("ret[%d]", err); - return err; -} - -EXPORT_API int email_update_notification_bar(int account_id) -{ - EM_DEBUG_API_BEGIN("account_id [%d]", account_id); - int err = EMAIL_ERROR_NONE; - int total_mail_count = 0; - int unread_mail_count = 0; - if (account_id == 0) { EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM"); err = EMAIL_ERROR_INVALID_PARAM; @@ -744,6 +678,14 @@ EXPORT_API int email_update_notification_bar(int account_id) EM_DEBUG_EXCEPTION(" emipc_add_parameter account_id failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); } + + /* input_from_eas */ + if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&input_from_eas, sizeof(int))) { + EM_DEBUG_EXCEPTION(" emipc_add_parameter account_id failed"); + EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); + } + + if(emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { EM_DEBUG_EXCEPTION(" emipc_execute_proxy_api failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); @@ -757,15 +699,65 @@ EXPORT_API int email_update_notification_bar(int account_id) return err; } - EXPORT_API int email_clear_all_notification_bar() { - EM_DEBUG_FUNC_BEGIN (); + EM_DEBUG_API_BEGIN (); int err = EMAIL_ERROR_NONE; + int account_id = ALL_ACCOUNT; - err = emcore_clear_all_notifications(); + HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_CLEAR_NOTIFICATION_BAR); - EM_DEBUG_FUNC_END ("ret[%d]", err); + EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE); + + /* account_id */ + if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) { + EM_DEBUG_EXCEPTION(" emipc_add_parameter account_id failed"); + EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); + } + + if(emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { + EM_DEBUG_EXCEPTION(" emipc_execute_proxy_api failed "); + EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); + } + + emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); + emipc_destroy_email_api(hAPI); + + hAPI = NULL; + EM_DEBUG_API_END ("ret[%d]", err); + return err; +} + +EXPORT_API int email_clear_notification_bar(int account_id) +{ + EM_DEBUG_API_BEGIN (); + int err = EMAIL_ERROR_NONE; + + if (account_id < ALL_ACCOUNT) { + EM_DEBUG_EXCEPTION ("EMAIL_ERROR_INVALID_PARAM"); + return EMAIL_ERROR_INVALID_PARAM; + } + + HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_CLEAR_NOTIFICATION_BAR); + + EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE); + + /* account_id */ + if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) { + EM_DEBUG_EXCEPTION(" emipc_add_parameter account_id failed"); + EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); + } + + if(emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { + EM_DEBUG_EXCEPTION(" emipc_execute_proxy_api failed "); + EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); + } + + emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); + emipc_destroy_email_api(hAPI); + + hAPI = NULL; + EM_DEBUG_API_END ("ret[%d]", err); return err; } @@ -774,6 +766,11 @@ EXPORT_API int email_save_default_account_id(int input_account_id) EM_DEBUG_API_BEGIN ("input_account_id [%d]", input_account_id); int err = EMAIL_ERROR_NONE; + if (input_account_id < ALL_ACCOUNT) { + EM_DEBUG_EXCEPTION ("EMAIL_ERROR_INVALID_PARAM"); + return EMAIL_ERROR_INVALID_PARAM; + } + err = emcore_save_default_account_id(input_account_id); EM_DEBUG_API_END ("ret[%d]", err); diff --git a/email-api/email-api-etc.c b/email-api/email-api-etc.c index 4c5a1cd..c46a559 100755 --- a/email-api/email-api-etc.c +++ b/email-api/email-api-etc.c @@ -100,12 +100,8 @@ EXPORT_API int email_write_mime_file(email_mail_data_t *input_mail_data, email_a { EM_DEBUG_API_BEGIN ("input_mail_data[%p] input_attachment_data[%p] input_attachment_count[%d]", input_mail_data, input_attachment_data, input_attachment_count); - int err = EMAIL_ERROR_NONE; - int size = 0; - int *ret_nth_value = 0; - char *p_output_file_path = NULL; - char *mail_data_stream = NULL; - char *attachment_data_list_stream = NULL; + int err = EMAIL_ERROR_NONE; + int *ret_nth_value = NULL; HIPC_API hAPI = NULL; EM_IF_NULL_RETURN_VALUE(input_mail_data, EMAIL_ERROR_INVALID_PARAM); @@ -118,75 +114,27 @@ EXPORT_API int email_write_mime_file(email_mail_data_t *input_mail_data, email_a goto FINISH_OFF; } - mail_data_stream = em_convert_mail_data_to_byte_stream(input_mail_data, &size); - if (!mail_data_stream) { - EM_DEBUG_EXCEPTION("em_convert_mail_data_to_byte_stream failed"); - err = EMAIL_ERROR_NULL_VALUE; - goto FINISH_OFF; - } - - if (!emipc_add_dynamic_parameter(hAPI, ePARAMETER_IN, mail_data_stream, size)) { - EM_DEBUG_EXCEPTION("emipc_add_dynamic_parameter failed"); - err = EMAIL_ERROR_OUT_OF_MEMORY; - goto FINISH_OFF; - } - - attachment_data_list_stream = em_convert_attachment_data_to_byte_stream(input_attachment_data, input_attachment_count, &size); - if ((size > 0) && !emipc_add_dynamic_parameter(hAPI, ePARAMETER_IN, attachment_data_list_stream, size)) { - EM_DEBUG_EXCEPTION("emipc_add_dynamic_parameter failed"); - err = EMAIL_ERROR_OUT_OF_MEMORY; - goto FINISH_OFF; - } - - if (*output_file_path && (size = EM_SAFE_STRLEN(*output_file_path)) > 0) { - EM_DEBUG_LOG_SEC("output_file_path : [%s] size : [%d]", *output_file_path, size); - size = size + 1; - } else { - size = 0; - } - - if (!emipc_add_parameter(hAPI, ePARAMETER_IN, *output_file_path, size)) { - EM_DEBUG_EXCEPTION("emipc_add_dynamic_parameter failed"); - err = EMAIL_ERROR_OUT_OF_MEMORY; - goto FINISH_OFF; - } - if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); err = EMAIL_ERROR_IPC_SOCKET_FAILURE; goto FINISH_OFF; } - if ((ret_nth_value = (int*)emipc_get_nth_parameter_data(hAPI, ePARAMETER_OUT, 0))) { + if (*(ret_nth_value = (int*)emipc_get_nth_parameter_data(hAPI, ePARAMETER_OUT, 0)) != EMAIL_ERROR_NONE) { + EM_DEBUG_EXCEPTION("email_write_mime_file failed:[%d]", *ret_nth_value); err = *ret_nth_value; - - if (err == EMAIL_ERROR_NONE) { - size = emipc_get_parameter_length(hAPI, ePARAMETER_OUT, 1); - if (size > 0) { - p_output_file_path = (char *)em_malloc(size); - if (p_output_file_path == NULL) { - err = EMAIL_ERROR_OUT_OF_MEMORY; - goto FINISH_OFF; - } - - if ((err = emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, size, p_output_file_path)) != EMAIL_ERROR_NONE) { - EM_DEBUG_EXCEPTION("emipc_get_parameter failed : [%d]", err); - goto FINISH_OFF; - } - } - } + goto FINISH_OFF; } - EM_SAFE_FREE(*output_file_path); - *output_file_path = EM_SAFE_STRDUP(p_output_file_path); + if (!emcore_make_rfc822_file(input_mail_data, input_attachment_data, input_attachment_count, false, output_file_path, &err)) { + EM_DEBUG_EXCEPTION("emcore_make_rfc822_file failed : [%d]", err); + } FINISH_OFF: if (hAPI) emipc_destroy_email_api(hAPI); - EM_SAFE_FREE(p_output_file_path); - EM_DEBUG_API_END ("err[%d]", err); return err; } @@ -219,4 +167,16 @@ EXPORT_API int email_get_mime_entity(char *mime_path, char **mime_entity) return err; } +EXPORT_API int email_verify_email_address(char *input_email_address) +{ + EM_DEBUG_API_BEGIN ("input_email_address[%p]", input_email_address); + int err = EMAIL_ERROR_NONE; + + EM_IF_NULL_RETURN_VALUE(input_email_address, EMAIL_ERROR_INVALID_PARAM); + if ((err = em_verify_email_address (input_email_address)) != EMAIL_ERROR_NONE) + EM_DEBUG_EXCEPTION("em_verify_email_address failed [%d]", err); + + EM_DEBUG_API_END("err [%d]", err); + return err; +} diff --git a/email-api/email-api-init.c b/email-api/email-api-init.c index cfb2aa9..8068824 100755 --- a/email-api/email-api-init.c +++ b/email-api/email-api-init.c @@ -36,23 +36,17 @@ #include "email-storage.h" #include "email-ipc.h" #include "email-core-task-manager.h" +#include "email-core-account.h" #include "email-utilities.h" +#include "email-dbus-activation.h" #include <sqlite3.h> - +#include <gio/gio.h> EXPORT_API int email_open_db(void) { EM_DEBUG_API_BEGIN (); int error = EMAIL_ERROR_NONE; -#ifdef __FEATURE_ACCESS_CONTROL__ - error = em_check_db_privilege_by_pid(getpid()); - if (error == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_EXCEPTION ("permission denied"); - return error; - } -#endif - if (emstorage_db_open(&error) == NULL) EM_DEBUG_EXCEPTION("emstorage_db_open failed [%d]", error); @@ -89,12 +83,18 @@ EXPORT_API int email_service_begin(void) return ret; } +extern GCancellable *cancel; EXPORT_API int email_service_end(void) { EM_DEBUG_API_BEGIN (); int ret = -1; - + + if (cancel) { + g_cancellable_cancel (cancel); + while (cancel) usleep(1000000); + } + ret = emipc_finalize_proxy(); EM_DEBUG_API_END ("err[%d]", ret); @@ -109,16 +109,8 @@ EXPORT_API int email_init_storage(void) { EM_DEBUG_API_BEGIN (); int error = EMAIL_ERROR_NONE; - -#ifdef __FEATURE_ACCESS_CONTROL__ - error = em_check_db_privilege_by_pid(getpid()); - if (error == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - return error; - } -#endif - if (!emstorage_create_table(EMAIL_CREATE_DB_CHECK, &error)) { + if (!emstorage_create_table(EMAIL_CREATE_DB_NORMAL, &error)) { EM_DEBUG_EXCEPTION("emstorage_create_table failed [%d]", error); } diff --git a/email-api/email-api-mail.c b/email-api/email-api-mail.c index 579f082..46477c0 100755 --- a/email-api/email-api-mail.c +++ b/email-api/email-api-mail.c @@ -46,7 +46,6 @@ #include "email-core-signal.h" #include "email-utilities.h" #include "email-core-smime.h" -#include "db-util.h" #define DIR_SEPERATOR_CH '/' @@ -78,12 +77,12 @@ EXPORT_API int email_add_mail(email_mail_data_t *input_mail_data, email_attachme if(input_from_eas == 0) { /* native emails */ if ((input_mail_data->smime_type != EMAIL_SMIME_NONE) && (input_mail_data->mailbox_type != EMAIL_MAILBOX_TYPE_DRAFT)) { - if (!emcore_make_rfc822_file(input_mail_data, input_attachment_data_list, input_attachment_count, &rfc822_file, &err)) { + if (!emcore_make_rfc822_file(input_mail_data, input_attachment_data_list, input_attachment_count, true, &rfc822_file, &err)) { EM_DEBUG_EXCEPTION("emcore_make_rfc822_file failed [%d]", err); goto FINISH_OFF; } - input_mail_data->file_path_mime_entity = EM_SAFE_STRDUP(emcore_set_mime_entity(rfc822_file)); + input_mail_data->file_path_mime_entity = emcore_set_mime_entity(rfc822_file); emstorage_delete_file(rfc822_file, NULL); EM_SAFE_FREE(rfc822_file); @@ -244,10 +243,9 @@ int email_create_db_full() goto FINISH_OFF; } - body_file = fopen(TMP_BODY_PATH, "w"); - if (body_file == NULL) { - EM_DEBUG_EXCEPTION("fopen failed"); - err = EMAIL_ERROR_SYSTEM_FAILURE; + err = em_fopen(TMP_BODY_PATH, "w", &body_file); + if (err != EMAIL_ERROR_NONE) { + EM_DEBUG_EXCEPTION("em_fopen failed : [%s][%d]", TMP_BODY_PATH, err); goto FINISH_OFF; } @@ -296,6 +294,7 @@ FINISH_OFF: EM_SAFE_FREE(mail_table_data.subject); EM_SAFE_FREE(mail_table_data.full_address_from); EM_SAFE_FREE(mail_table_data.full_address_to); + EM_SAFE_FREE(mail_table_data.file_path_plain); return err; } @@ -485,13 +484,6 @@ EXPORT_API int email_count_mail(email_list_filter_t *input_filter_list, int inpu EM_IF_NULL_RETURN_VALUE(output_total_mail_count, EMAIL_ERROR_INVALID_PARAM); EM_IF_NULL_RETURN_VALUE(output_unseen_mail_count, EMAIL_ERROR_INVALID_PARAM); -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - goto FINISH_OFF; - } -#endif if( (err = emstorage_write_conditional_clause_for_getting_mail_list(input_filter_list, input_filter_count, NULL, 0, -1, -1, &conditional_clause_string)) != EMAIL_ERROR_NONE) { EM_DEBUG_EXCEPTION("emstorage_write_conditional_clause_for_getting_mail_list failed[%d]", err); @@ -507,7 +499,7 @@ EXPORT_API int email_count_mail(email_list_filter_t *input_filter_list, int inpu *output_unseen_mail_count = unread; FINISH_OFF: - + EM_SAFE_FREE (conditional_clause_string); /* detected by valgrind */ EM_DEBUG_API_END ("err[%d]", err); return err; } @@ -756,13 +748,6 @@ EXPORT_API int email_query_mails(char *conditional_clause_string, email_mail_dat EM_IF_NULL_RETURN_VALUE(result_count, EMAIL_ERROR_INVALID_PARAM); EM_IF_NULL_RETURN_VALUE(conditional_clause_string, EMAIL_ERROR_INVALID_PARAM); -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - goto FINISH_OFF; - } -#endif if (!emstorage_query_mail_tbl(conditional_clause_string, true, &result_mail_tbl, result_count, &err)) { EM_DEBUG_EXCEPTION("emstorage_query_mail_list failed [%d]", err); @@ -792,13 +777,6 @@ EXPORT_API int email_query_mail_list(char *input_conditional_clause_string, emai EM_IF_NULL_RETURN_VALUE(input_conditional_clause_string, EMAIL_ERROR_INVALID_PARAM); EM_IF_NULL_RETURN_VALUE(output_result_count, EMAIL_ERROR_INVALID_PARAM); -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - goto FINISH_OFF; - } -#endif if (!emstorage_query_mail_list(input_conditional_clause_string, true, output_mail_list, output_result_count, &err)) { EM_DEBUG_EXCEPTION("emstorage_query_mail_list failed [%d]", err); @@ -887,14 +865,6 @@ EXPORT_API int email_get_attachment_data_list(int input_mail_id, email_attachmen { EM_DEBUG_API_BEGIN ("input_mail_id[%d] output_attachment_data[%p] output_attachment_count[%p]", input_mail_id, output_attachment_data, output_attachment_count); int err = EMAIL_ERROR_NONE; - -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - return err; - } -#endif if((err = emcore_get_attachment_data_list(input_mail_id, output_attachment_data, output_attachment_count)) != EMAIL_ERROR_NONE) { EM_DEBUG_EXCEPTION("emcore_get_attachment_data_list failed [%d]", err); @@ -926,13 +896,6 @@ EXPORT_API int email_get_mail_list_ex(email_list_filter_t *input_filter_list, in EM_IF_NULL_RETURN_VALUE(output_mail_list, EMAIL_ERROR_INVALID_PARAM); EM_IF_NULL_RETURN_VALUE(output_result_count, EMAIL_ERROR_INVALID_PARAM); -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - goto FINISH_OFF; - } -#endif if( (err = emstorage_write_conditional_clause_for_getting_mail_list(input_filter_list, input_filter_count, input_sorting_rule_list, input_sorting_rule_count, input_start_index, input_limit_count, &conditional_clause_string)) != EMAIL_ERROR_NONE) { EM_DEBUG_EXCEPTION("emstorage_write_conditional_clause_for_getting_mail_list failed[%d]", err); @@ -981,13 +944,6 @@ EXPORT_API int email_get_mails(int account_id , int mailbox_id, int thread_id, i goto FINISH_OFF; } -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - goto FINISH_OFF; - } -#endif if (!emstorage_get_mails(account_id, mailbox_id, NULL, thread_id, start_index, limit_count, sorting, true, &mail_tbl_list, result_count, &err)) { EM_DEBUG_EXCEPTION("emstorage_get_mails failed [%d]", err); @@ -1021,13 +977,6 @@ EXPORT_API int email_get_mail_list(int account_id , int mailbox_id, int thread_i return EMAIL_ERROR_INVALID_PARAM; } -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - goto FINISH_OFF; - } -#endif if (!emstorage_get_mail_list(account_id, mailbox_id, NULL, thread_id, start_index, limit_count, 0, NULL, sorting, true, mail_list, result_count, &err)) { EM_DEBUG_EXCEPTION("emstorage_get_mail_list failed [%d]", err); @@ -1057,13 +1006,6 @@ EXPORT_API int email_get_mail_by_address(int account_id , int mailbox_id, email_ return err; } -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - goto FINISH_OFF; - } -#endif if (!emstorage_get_mail_list(account_id, mailbox_id, addr_list, EMAIL_LIST_TYPE_NORMAL, start_index, limit_count, search_type, search_value, sorting, true, &mail_list_item, result_count, &err)) { EM_DEBUG_EXCEPTION("emstorage_get_mail_list failed [%d]", err); @@ -1086,13 +1028,6 @@ EXPORT_API int email_get_thread_information_by_thread_id(int thread_id, email_ma EM_IF_NULL_RETURN_VALUE(thread_info, EMAIL_ERROR_INVALID_PARAM); -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - goto FINISH_OFF; - } -#endif if (!emstorage_get_thread_information(thread_id, &mail_table_data , true, &err)) { EM_DEBUG_EXCEPTION("emstorage_get_thread_information failed [%d]", err); @@ -1122,13 +1057,6 @@ EXPORT_API int email_get_thread_information_ex(int thread_id, email_mail_list_it EM_IF_NULL_RETURN_VALUE(thread_info, EMAIL_ERROR_INVALID_PARAM); -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - goto FINISH_OFF; - } -#endif if (!emstorage_get_thread_information(thread_id, &mail_table_data , true, &err)) { EM_DEBUG_EXCEPTION("emstorage_get_thread_information -- failed [%d]", err); @@ -1181,14 +1109,6 @@ EXPORT_API int email_get_mail_data(int input_mail_id, email_mail_data_t **output EM_DEBUG_API_BEGIN ("input_mail_id[%d]", input_mail_id); int err = EMAIL_ERROR_NONE; -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - return err; - } -#endif - if ( ((err = emcore_get_mail_data(input_mail_id, output_mail_data)) != EMAIL_ERROR_NONE) || !output_mail_data) EM_DEBUG_EXCEPTION("emcore_get_mail_data failed [%d]", err); @@ -1444,6 +1364,9 @@ EXPORT_API int email_free_mail_data(email_mail_data_t** mail_list, int count) { EM_DEBUG_FUNC_BEGIN ("mail_list[%p] count[%d]", mail_list, count); int err = EMAIL_ERROR_NONE; + + EM_IF_NULL_RETURN_VALUE(mail_list, EMAIL_ERROR_INVALID_PARAM); + emcore_free_mail_data_list(mail_list, count); EM_DEBUG_FUNC_END ("err[%d]", err); return err; @@ -1644,13 +1567,6 @@ EXPORT_API int email_get_address_info_list(int mail_id, email_address_info_list_ return err; } -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - goto FINISH_OFF; - } -#endif if ( !emcore_get_mail_address_info_list(mail_id, &temp_address_info_list, &err) ) { EM_DEBUG_EXCEPTION("emcore_get_mail_address_info_list failed [%d]", err); @@ -1683,13 +1599,6 @@ EXPORT_API int email_free_address_info_list(email_address_info_list_t **address_ return err; } -EXPORT_API int email_get_structure(const char*encoded_string, void **struct_var, email_convert_struct_type_e type) -{ - EM_DEBUG_API_BEGIN ("encoded_string[%s] struct_var[%p] type[%d]", encoded_string, struct_var, type); - EM_DEBUG_API_END ("err[%d]", EMAIL_ERROR_NOT_IMPLEMENTED); - return EMAIL_ERROR_NOT_IMPLEMENTED; -} - EXPORT_API int email_query_meeting_request(char *input_conditional_clause_string, email_meeting_request_t **output_meeting_req, int *output_count) { EM_DEBUG_API_BEGIN ("input_conditional_clause_string[%s] output_meeting_req[%p] output_count[%p]", input_conditional_clause_string, output_meeting_req, output_count); @@ -1698,14 +1607,6 @@ EXPORT_API int email_query_meeting_request(char *input_conditional_clause_string EM_IF_NULL_RETURN_VALUE(input_conditional_clause_string, EMAIL_ERROR_INVALID_PARAM); EM_IF_NULL_RETURN_VALUE(output_count, EMAIL_ERROR_INVALID_PARAM); -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - return err; - } -#endif - if ((err = emstorage_query_meeting_request(input_conditional_clause_string, output_meeting_req, output_count, true)) != EMAIL_ERROR_NONE) { EM_DEBUG_EXCEPTION("emstorage_query_meeting_request failed [%d]", err); } @@ -1729,13 +1630,6 @@ EXPORT_API int email_get_meeting_request(int mail_id, email_meeting_request_t ** return err; } -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - goto FINISH_OFF; - } -#endif if ( !emstorage_get_meeting_request(mail_id, &temp_meeting_req, 1, &err) ) { EM_DEBUG_EXCEPTION("emstorage_get_meeting_request failed[%d]", err); @@ -1828,6 +1722,12 @@ EXPORT_API int email_delete_thread(int thread_id, int delete_always_flag) EM_DEBUG_API_BEGIN ("thread_id[%d] delete_always_flag[%d]", thread_id, delete_always_flag); int err = EMAIL_ERROR_NONE; + if (thread_id <= 0) { + EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM"); + err = EMAIL_ERROR_INVALID_PARAM; + return err; + } + HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_DELETE_THREAD); if(!hAPI) { @@ -1871,6 +1771,13 @@ EXPORT_API int email_modify_seen_flag_of_thread(int thread_id, int seen_flag, in { EM_DEBUG_API_BEGIN ("thread_id[%d] seen_flag[%d] on_server[%d]", thread_id, seen_flag, on_server); int err = EMAIL_ERROR_NONE; + + if (thread_id <= 0) { + EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM"); + err = EMAIL_ERROR_INVALID_PARAM; + return err; + } + HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_MODIFY_SEEN_FLAG_OF_THREAD); if(!hAPI) { diff --git a/email-api/email-api-mailbox.c b/email-api/email-api-mailbox.c index ccd01cf..070fb5b 100755 --- a/email-api/email-api-mailbox.c +++ b/email-api/email-api-mailbox.c @@ -38,7 +38,6 @@ #include "email-core-signal.h" #include "email-utilities.h" #include "email-ipc.h" -#include "db-util.h" /* API - Create a mailbox */ @@ -611,13 +610,6 @@ EXPORT_API int email_get_mailbox_list(int account_id, int mailbox_sync_type, ema EM_IF_ACCOUNT_ID_NULL(account_id, EMAIL_ERROR_INVALID_PARAM); EM_IF_NULL_RETURN_VALUE(count, EMAIL_ERROR_INVALID_PARAM); -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - goto FINISH_OFF; - } -#endif if (!emstorage_get_mailbox_list(account_id, mailbox_sync_type, EMAIL_MAILBOX_SORT_BY_NAME_ASC, &mailbox_count, &mailbox_tbl_list, true, &err)) { EM_DEBUG_EXCEPTION("emstorage_get_mailbox failed [%d]", err); @@ -663,13 +655,6 @@ EXPORT_API int email_get_mailbox_list_ex(int account_id, int mailbox_sync_type, EM_IF_ACCOUNT_ID_NULL(account_id, EMAIL_ERROR_INVALID_PARAM); EM_IF_NULL_RETURN_VALUE(count, EMAIL_ERROR_INVALID_PARAM); -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - goto FINISH_OFF; - } -#endif if (!emstorage_get_mailbox_list_ex(account_id, mailbox_sync_type, with_count, &mailbox_count, &mailbox_tbl_list, true, &err)) { EM_DEBUG_EXCEPTION("emstorage_get_mailbox_list_ex failed [%d]", err); @@ -714,13 +699,6 @@ EXPORT_API int email_get_mailbox_list_by_keyword(int account_id, char *keyword, EM_IF_NULL_RETURN_VALUE(mailbox_list, EMAIL_ERROR_INVALID_PARAM); EM_IF_NULL_RETURN_VALUE(count, EMAIL_ERROR_INVALID_PARAM); -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - goto FINISH_OFF; - } -#endif if (!emstorage_get_mailbox_by_keyword(account_id, keyword, &mailbox_tbl_list, &mailbox_count, true, &err)) { EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_keyword failed [%d]", err); @@ -765,13 +743,6 @@ EXPORT_API int email_get_mailbox_by_mailbox_type(int account_id, email_mailbox_t if(mailbox_type < EMAIL_MAILBOX_TYPE_INBOX || mailbox_type > EMAIL_MAILBOX_TYPE_USER_DEFINED) return EMAIL_ERROR_INVALID_PARAM; -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - goto FINISH_OFF; - } -#endif if (!emstorage_get_mailbox_by_mailbox_type(account_id, mailbox_type, &local_mailbox, true, &err)) { EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_mailbox_type failed [%d]", err); @@ -803,14 +774,6 @@ EXPORT_API int email_get_mailbox_by_mailbox_id(int input_mailbox_id, email_mailb EM_IF_NULL_RETURN_VALUE(output_mailbox, EMAIL_ERROR_INVALID_PARAM); -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - return err; - } -#endif - if ( (err = emstorage_get_mailbox_by_id(input_mailbox_id, &local_mailbox)) != EMAIL_ERROR_NONE) { EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_id failed [%d]", err); return err; @@ -889,14 +852,6 @@ EXPORT_API int email_stamp_sync_time_of_mailbox(int input_mailbox_id) EM_IF_NULL_RETURN_VALUE(input_mailbox_id, EMAIL_ERROR_INVALID_PARAM); -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - return err; - } -#endif - err = emstorage_stamp_last_sync_time_of_mailbox(input_mailbox_id, 1); EM_DEBUG_API_END ("err[%d]", err); @@ -909,6 +864,8 @@ EXPORT_API int email_free_mailbox(email_mailbox_t** mailbox_list, int count) int err = EMAIL_ERROR_NONE; if (count <= 0 || !mailbox_list || !*mailbox_list) { + EM_DEBUG_LOG("EMAIL_ERROR_INVALID_PARAM"); + err = EMAIL_ERROR_INVALID_PARAM; goto FINISH_OFF; } diff --git a/email-api/email-api-network.c b/email-api/email-api-network.c index 1054660..a02556c 100755 --- a/email-api/email-api-network.c +++ b/email-api/email-api-network.c @@ -921,6 +921,9 @@ EXPORT_API int email_get_task_information(email_task_information_t **output_task } } + if (err == EMAIL_ERROR_DATA_NOT_FOUND) + err = EMAIL_ERROR_NONE; + FINISH_OFF: if(hAPI) emipc_destroy_email_api(hAPI); @@ -964,182 +967,6 @@ EXPORT_API int email_sync_imap_mailbox_list(int account_id, int *handle) return err; } -EXPORT_API int email_search_mail_on_server(int input_account_id, int input_mailbox_id, email_search_filter_t *input_search_filter_list, int input_search_filter_count, int *output_handle) -{ - EM_DEBUG_API_BEGIN ("input_account_id[%d] input_mailbox_id[%d] input_search_filter_list[%p] input_search_filter_count[%d] output_handle[%p]", input_account_id, input_mailbox_id, input_search_filter_list, input_search_filter_count, output_handle); - - int err = EMAIL_ERROR_NONE; - int return_value = 0; - int stream_size_for_search_filter_list = 0; - char *stream_for_search_filter_list = NULL; - HIPC_API hAPI = NULL; - email_account_server_t account_server_type = EMAIL_SERVER_TYPE_NONE; - ASNotiData as_noti_data; - - EM_IF_NULL_RETURN_VALUE(input_account_id, EMAIL_ERROR_INVALID_PARAM); - EM_IF_NULL_RETURN_VALUE(input_mailbox_id, EMAIL_ERROR_INVALID_PARAM); - EM_IF_NULL_RETURN_VALUE(input_search_filter_list, EMAIL_ERROR_INVALID_PARAM); - - memset(&as_noti_data, 0, sizeof(ASNotiData)); /* initialization of union members */ - - if ( em_get_account_server_type_by_account_id(input_account_id, &account_server_type, true, &err) == false ) { - EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err); - goto FINISH_OFF; - } - - if ( account_server_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC ) { - int as_handle = 0; - - if ( em_get_handle_for_activesync(&as_handle, &err) == false ) { - EM_DEBUG_EXCEPTION("em_get_handle_for_activesync failed[%d].", err); - goto FINISH_OFF; - } - - /* noti to active sync */ - as_noti_data.search_mail_on_server.handle = as_handle; - as_noti_data.search_mail_on_server.account_id = input_account_id; - as_noti_data.search_mail_on_server.mailbox_id = input_mailbox_id; - as_noti_data.search_mail_on_server.search_filter_list = input_search_filter_list; - as_noti_data.search_mail_on_server.search_filter_count = input_search_filter_count; - - return_value = em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_SEARCH_ON_SERVER, &as_noti_data); - - if ( return_value == false ) { - EM_DEBUG_EXCEPTION("em_send_notification_to_active_sync_engine failed."); - err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; - goto FINISH_OFF; - } - - if(output_handle) - *output_handle = as_handle; - } - else - { - hAPI = emipc_create_email_api(_EMAIL_API_SEARCH_MAIL_ON_SERVER); - - EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE); - - if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (void*)&input_account_id, sizeof(int))) { - EM_DEBUG_EXCEPTION("emipc_add_parameter failed "); - err = EMAIL_ERROR_IPC_PROTOCOL_FAILURE; - goto FINISH_OFF; - } - - if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (void*)&input_mailbox_id, sizeof(int))){ - EM_DEBUG_EXCEPTION("emipc_add_parameter failed "); - err = EMAIL_ERROR_IPC_PROTOCOL_FAILURE; - goto FINISH_OFF; - } - - stream_for_search_filter_list = em_convert_search_filter_to_byte_stream(input_search_filter_list, input_search_filter_count, &stream_size_for_search_filter_list); - - EM_PROXY_IF_NULL_RETURN_VALUE(stream_for_search_filter_list, hAPI, EMAIL_ERROR_NULL_VALUE); - - if(!emipc_add_dynamic_parameter(hAPI, ePARAMETER_IN, stream_for_search_filter_list, stream_size_for_search_filter_list)) { /*prevent 18950*/ - EM_DEBUG_EXCEPTION("emipc_add_parameter failed "); - err = EMAIL_ERROR_IPC_PROTOCOL_FAILURE; - goto FINISH_OFF; - } - - if(emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); - EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - } - - emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); - - if (err != EMAIL_ERROR_NONE) { - EM_DEBUG_EXCEPTION("_EMAIL_API_SEARCH_MAIL_ON_SERVER failed [%d]", err); - goto FINISH_OFF; - } - - if(output_handle) - emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), output_handle); - } - -FINISH_OFF: - if(hAPI) { - emipc_destroy_email_api(hAPI); - hAPI = NULL; - } - - EM_DEBUG_API_END ("err[%d]", err); - return err; -} - -EXPORT_API int email_clear_result_of_search_mail_on_server(int input_account_id) -{ - EM_DEBUG_API_BEGIN ("input_account_id[%d]", input_account_id); - - int err = EMAIL_ERROR_NONE; - int return_value = 0; - HIPC_API hAPI = NULL; - email_account_server_t account_server_type = EMAIL_SERVER_TYPE_NONE; - ASNotiData as_noti_data; - - EM_IF_NULL_RETURN_VALUE(input_account_id, EMAIL_ERROR_INVALID_PARAM); - - memset(&as_noti_data, 0, sizeof(ASNotiData)); /* initialization of union members */ - - if ( em_get_account_server_type_by_account_id(input_account_id, &account_server_type, true, &err) == false ) { - EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err); - goto FINISH_OFF; - } - - if ( account_server_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC ) { - int as_handle = 0; - - if ( em_get_handle_for_activesync(&as_handle, &err) == false ) { - EM_DEBUG_EXCEPTION("em_get_handle_for_activesync failed[%d].", err); - goto FINISH_OFF; - } - - /* noti to active sync */ - as_noti_data.clear_result_of_search_mail_on_server.handle = as_handle; - as_noti_data.clear_result_of_search_mail_on_server.account_id = input_account_id; - - return_value = em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_CLEAR_RESULT_OF_SEARCH_ON_SERVER, &as_noti_data); - - if ( return_value == false ) { - EM_DEBUG_EXCEPTION("em_send_notification_to_active_sync_engine failed."); - err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; - goto FINISH_OFF; - } - } - else { - hAPI = emipc_create_email_api(_EMAIL_API_CLEAR_RESULT_OF_SEARCH_MAIL_ON_SERVER); - - EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE); - - if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (void*)&input_account_id, sizeof(int))) { - EM_DEBUG_EXCEPTION("emipc_add_parameter failed "); - err = EMAIL_ERROR_IPC_PROTOCOL_FAILURE; - goto FINISH_OFF; - } - - if(emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); - EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - } - - emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); - - if (err != EMAIL_ERROR_NONE) { - EM_DEBUG_EXCEPTION("_EMAIL_API_CLEAR_RESULT_OF_SEARCH_MAIL_ON_SERVER failed [%d]", err); - goto FINISH_OFF; - } - } - -FINISH_OFF: - if(hAPI) { - emipc_destroy_email_api(hAPI); - hAPI = NULL; - } - - EM_DEBUG_API_END ("err[%d]", err); - return err; -} - EXPORT_API int email_query_smtp_mail_size_limit(int account_id, int *handle) { EM_DEBUG_API_BEGIN ("account_id[%d] handle[%p]", account_id, handle); diff --git a/email-api/email-api-rule.c b/email-api/email-api-rule.c index 34a61f7..3290150 100755 --- a/email-api/email-api-rule.c +++ b/email-api/email-api-rule.c @@ -36,6 +36,7 @@ #include "email-storage.h" #include "email-utilities.h" #include "email-ipc.h" +#include "email-core-utils.h" EXPORT_API int email_get_rule(int filter_id, email_rule_t** filtering_set) { @@ -46,13 +47,6 @@ EXPORT_API int email_get_rule(int filter_id, email_rule_t** filtering_set) EM_IF_NULL_RETURN_VALUE(filtering_set, EMAIL_ERROR_INVALID_PARAM); EM_IF_NULL_RETURN_VALUE(filter_id, EMAIL_ERROR_INVALID_PARAM); -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - goto FINISH_OFF; - } -#endif if (!emstorage_get_rule_by_id(filter_id, (emstorage_rule_tbl_t**)filtering_set, true, &err)) { EM_DEBUG_EXCEPTION("emstorage_get_rule_by_id failed [%d]", err); @@ -77,13 +71,6 @@ EXPORT_API int email_get_rule_list(email_rule_t** filtering_set, int* count) EM_IF_NULL_RETURN_VALUE(filtering_set, EMAIL_ERROR_INVALID_PARAM); EM_IF_NULL_RETURN_VALUE(count, EMAIL_ERROR_INVALID_PARAM); -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - goto FINISH_OFF; - } -#endif *count = 1000; @@ -245,11 +232,11 @@ EXPORT_API int email_free_rule (email_rule_t** filtering_set, int count) if (count > 0) { email_rule_t* p = *filtering_set; - for (i = 0; i < count; i++) { - EM_SAFE_FREE(p[i].value); - } + for (i = 0; i < count; i++) + emcore_free_rule(p + i); - EM_SAFE_FREE(p); *filtering_set = NULL; + EM_SAFE_FREE(p); + *filtering_set = NULL; } EM_DEBUG_FUNC_END ("err[%d]", err); diff --git a/email-api/email-api-smime.c b/email-api/email-api-smime.c index 96708dc..c84890b 100755 --- a/email-api/email-api-smime.c +++ b/email-api/email-api-smime.c @@ -41,6 +41,7 @@ #include "email-core-account.h" #include "email-core-cert.h" #include "email-core-smime.h" +#include "email-core-pgp.h" #include "email-core-signal.h" #include "email-ipc.h" @@ -154,14 +155,6 @@ EXPORT_API int email_get_certificate(char *email_address, email_certificate_t ** EM_IF_NULL_RETURN_VALUE(email_address, EMAIL_ERROR_INVALID_PARAM); EM_IF_NULL_RETURN_VALUE(certificate, EMAIL_ERROR_INVALID_PARAM); -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - return err; - } -#endif - SNPRINTF(temp_email_address, sizeof(temp_email_address), "<%s>", email_address); if (!emstorage_get_certificate_by_email_address(temp_email_address, &cert, false, 0, &err)) { @@ -184,6 +177,7 @@ EXPORT_API int email_get_decrypt_message(int mail_id, email_mail_data_t **output int err = EMAIL_ERROR_NONE; int p_output_attachment_count = 0; int i = 0; + int verify = 0; char *decrypt_filepath = NULL; char *search = NULL; email_mail_data_t *p_output_mail_data = NULL; @@ -198,14 +192,6 @@ EXPORT_API int email_get_decrypt_message(int mail_id, email_mail_data_t **output goto FINISH_OFF; } -#ifdef __FEATURE_ACCESS_CONTROL__ - err = em_check_db_privilege_by_pid(getpid()); - if (err == EMAIL_ERROR_PERMISSION_DENIED) { - EM_DEBUG_LOG("permission denied"); - goto FINISH_OFF; - } -#endif - if ((err = emcore_get_mail_data(mail_id, &p_output_mail_data)) != EMAIL_ERROR_NONE) { EM_DEBUG_EXCEPTION("emcore_get_mail_data failed"); goto FINISH_OFF; @@ -226,7 +212,10 @@ EXPORT_API int email_get_decrypt_message(int mail_id, email_mail_data_t **output if (p_output_attachment_data[i].attachment_mime_type && (search = strcasestr(p_output_attachment_data[i].attachment_mime_type, "PKCS7-MIME"))) { EM_DEBUG_LOG("Found the encrypt file"); break; - } + } else if (p_output_attachment_data[i].attachment_mime_type && (search = strcasestr(p_output_attachment_data[i].attachment_mime_type, "octet-stream"))) { + EM_DEBUG_LOG("Found the encrypt file"); + break; + } } if (!search) { @@ -235,8 +224,27 @@ EXPORT_API int email_get_decrypt_message(int mail_id, email_mail_data_t **output goto FINISH_OFF; } - if (!emcore_smime_set_decrypt_message(p_output_attachment_data[i].attachment_path, p_account_tbl->certificate_path, &decrypt_filepath, &err)) { - EM_DEBUG_EXCEPTION("emcore_smime_set_decrypt_message failed"); + if (p_output_mail_data->smime_type == EMAIL_SMIME_ENCRYPTED || p_output_mail_data->smime_type == EMAIL_SMIME_SIGNED_AND_ENCRYPTED) { + emcore_init_openssl_library(); + if (!emcore_smime_get_decrypt_message(p_output_attachment_data[i].attachment_path, p_account_tbl->certificate_path, &decrypt_filepath, &err)) { + EM_DEBUG_EXCEPTION("emcore_smime_get_decrypt_message failed"); + emcore_clean_openssl_library(); + goto FINISH_OFF; + } + emcore_clean_openssl_library(); + } else if (p_output_mail_data->smime_type == EMAIL_PGP_ENCRYPTED) { + if ((err = emcore_pgp_get_decrypted_message(p_output_attachment_data[i].attachment_path, p_output_mail_data->pgp_password, false, &decrypt_filepath, &verify)) != EMAIL_ERROR_NONE) { + EM_DEBUG_EXCEPTION("emcore_pgp_get_decrypted_message failed : [%d]", err); + goto FINISH_OFF; + } + } else if (p_output_mail_data->smime_type == EMAIL_PGP_SIGNED_AND_ENCRYPTED) { + if ((err = emcore_pgp_get_decrypted_message(p_output_attachment_data[i].attachment_path, p_output_mail_data->pgp_password, true, &decrypt_filepath, &verify)) != EMAIL_ERROR_NONE) { + EM_DEBUG_EXCEPTION("emcore_pgp_get_decrypted_message failed : [%d]", err); + goto FINISH_OFF; + } + } else { + EM_DEBUG_LOG("Invalid encrypted mail"); + err = EMAIL_ERROR_INVALID_PARAM; goto FINISH_OFF; } @@ -256,9 +264,12 @@ EXPORT_API int email_get_decrypt_message(int mail_id, email_mail_data_t **output (*output_mail_data)->full_address_to = EM_SAFE_STRDUP(p_output_mail_data->full_address_to); (*output_mail_data)->full_address_cc = EM_SAFE_STRDUP(p_output_mail_data->full_address_cc); (*output_mail_data)->full_address_bcc = EM_SAFE_STRDUP(p_output_mail_data->full_address_bcc); + (*output_mail_data)->flags_flagged_field = p_output_mail_data->flags_flagged_field; FINISH_OFF: + EM_SAFE_FREE(decrypt_filepath); + if (p_account_tbl) emstorage_free_account(&p_account_tbl, 1, NULL); @@ -272,6 +283,100 @@ FINISH_OFF: return err; } +EXPORT_API int email_get_decrypt_message_ex(email_mail_data_t *input_mail_data, email_attachment_data_t *input_attachment_data, int input_attachment_count, + email_mail_data_t **output_mail_data, email_attachment_data_t **output_attachment_data, int *output_attachment_count) +{ + EM_DEBUG_API_BEGIN (); + int err = EMAIL_ERROR_NONE; + int i = 0; + int verify = 0; + char *decrypt_filepath = NULL; + char *search = NULL; + emstorage_account_tbl_t *p_account_tbl = NULL; + + EM_IF_NULL_RETURN_VALUE(input_mail_data, EMAIL_ERROR_INVALID_PARAM); + + if (!output_mail_data || !output_attachment_data || !output_attachment_count) { + EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM"); + err = EMAIL_ERROR_INVALID_PARAM; + goto FINISH_OFF; + } + + if (!emstorage_get_account_by_id(input_mail_data->account_id, EMAIL_ACC_GET_OPT_OPTIONS, &p_account_tbl, false, &err)) { + EM_DEBUG_EXCEPTION("emstorage_get_account_by_id failed : [%d]", err); + goto FINISH_OFF; + } + + for (i = 0; i < input_attachment_count; i++) { + EM_DEBUG_LOG("mime_type : [%s]", input_attachment_data[i].attachment_mime_type); + if (input_attachment_data[i].attachment_mime_type && (search = strcasestr(input_attachment_data[i].attachment_mime_type, "PKCS7-MIME"))) { + EM_DEBUG_LOG("Found the encrypt file"); + break; + } else if (input_attachment_data[i].attachment_mime_type && (search = strcasestr(input_attachment_data[i].attachment_mime_type, "octet-stream"))) { + EM_DEBUG_LOG("Found the encrypt file"); + break; + } + } + + if (!search) { + EM_DEBUG_EXCEPTION("No have a decrypt file"); + err = EMAIL_ERROR_INVALID_PARAM; + goto FINISH_OFF; + } + + if (input_mail_data->smime_type == EMAIL_SMIME_ENCRYPTED || input_mail_data->smime_type == EMAIL_SMIME_SIGNED_AND_ENCRYPTED) { + emcore_init_openssl_library(); + if (!emcore_smime_get_decrypt_message(input_attachment_data[i].attachment_path, p_account_tbl->certificate_path, &decrypt_filepath, &err)) { + EM_DEBUG_EXCEPTION("emcore_smime_get_decrypt_message failed"); + emcore_clean_openssl_library(); + goto FINISH_OFF; + } + emcore_clean_openssl_library(); + } else if (input_mail_data->smime_type == EMAIL_PGP_ENCRYPTED) { + if ((err = emcore_pgp_get_decrypted_message(input_attachment_data[i].attachment_path, input_mail_data->pgp_password, false, &decrypt_filepath, &verify)) != EMAIL_ERROR_NONE) { + EM_DEBUG_EXCEPTION("emcore_pgp_get_decrypted_message failed : [%d]", err); + goto FINISH_OFF; + } + } else if (input_mail_data->smime_type == EMAIL_PGP_SIGNED_AND_ENCRYPTED) { + if ((err = emcore_pgp_get_decrypted_message(input_attachment_data[i].attachment_path, input_mail_data->pgp_password, true, &decrypt_filepath, &verify)) != EMAIL_ERROR_NONE) { + EM_DEBUG_EXCEPTION("emcore_pgp_get_decrypted_message failed : [%d]", err); + goto FINISH_OFF; + } + } else { + EM_DEBUG_LOG("Invalid encrypted mail"); + err = EMAIL_ERROR_INVALID_PARAM; + goto FINISH_OFF; + } + + /* Change decrpyt_message to mail_data_t */ + if (!emcore_parse_mime_file_to_mail(decrypt_filepath, output_mail_data, output_attachment_data, output_attachment_count, &err)) { + EM_DEBUG_EXCEPTION("emcore_parse_mime_file_to_mail failed : [%d]", err); + goto FINISH_OFF; + } + + (*output_mail_data)->subject = EM_SAFE_STRDUP(input_mail_data->subject); + (*output_mail_data)->date_time = input_mail_data->date_time; + (*output_mail_data)->full_address_return = EM_SAFE_STRDUP(input_mail_data->full_address_return); + (*output_mail_data)->email_address_recipient = EM_SAFE_STRDUP(input_mail_data->email_address_recipient); + (*output_mail_data)->email_address_sender = EM_SAFE_STRDUP(input_mail_data->email_address_sender); + (*output_mail_data)->full_address_reply = EM_SAFE_STRDUP(input_mail_data->full_address_reply); + (*output_mail_data)->full_address_from = EM_SAFE_STRDUP(input_mail_data->full_address_from); + (*output_mail_data)->full_address_to = EM_SAFE_STRDUP(input_mail_data->full_address_to); + (*output_mail_data)->full_address_cc = EM_SAFE_STRDUP(input_mail_data->full_address_cc); + (*output_mail_data)->full_address_bcc = EM_SAFE_STRDUP(input_mail_data->full_address_bcc); + (*output_mail_data)->flags_flagged_field = input_mail_data->flags_flagged_field; + +FINISH_OFF: + + EM_SAFE_FREE(decrypt_filepath); + + if (p_account_tbl) + emstorage_free_account(&p_account_tbl, 1, NULL); + + EM_DEBUG_API_END ("err[%d]", err); + return err; +} + EXPORT_API int email_verify_signature(int mail_id, int *verify) { EM_DEBUG_API_BEGIN ("mail_id[%d]", mail_id); @@ -279,7 +384,7 @@ EXPORT_API int email_verify_signature(int mail_id, int *verify) int err = EMAIL_ERROR_NONE; int p_verify = 0; - EM_IF_NULL_RETURN_VALUE(mail_id, EMAIL_ERROR_INVALID_PARAM); + EM_IF_NULL_RETURN_VALUE(mail_id, EMAIL_ERROR_INVALID_PARAM); HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_VERIFY_SIGNATURE); if (hAPI == NULL) { @@ -336,8 +441,20 @@ EXPORT_API int email_verify_signature_ex(email_mail_data_t *input_mail_data, ema break; } - if (!emcore_verify_signature(input_attachment_data[count].attachment_path, input_mail_data->file_path_mime_entity, verify, &err)) - EM_DEBUG_EXCEPTION("emcore_verify_signature failed"); + if (input_mail_data->smime_type == EMAIL_SMIME_SIGNED) { + emcore_init_openssl_library(); + if (!emcore_verify_signature(input_attachment_data[count].attachment_path, input_mail_data->file_path_mime_entity, verify, &err)) + EM_DEBUG_EXCEPTION("emcore_verify_signature failed : [%d]", err); + + emcore_clean_openssl_library(); + } else if(input_mail_data->smime_type == EMAIL_PGP_SIGNED) { + if ((err = emcore_pgp_get_verify_signature(input_attachment_data[count].attachment_path, input_mail_data->file_path_mime_entity, input_mail_data->digest_type, verify)) != EMAIL_ERROR_NONE) + EM_DEBUG_EXCEPTION("emcore_pgp_get_verify_siganture failed : [%d]", err); + } else { + EM_DEBUG_LOG("Invalid signed mail : mime_type[%d]", input_mail_data->smime_type); + err = EMAIL_ERROR_INVALID_PARAM; + } + EM_DEBUG_API_END ("err[%d]", err); return err; diff --git a/email-api/include/email-api-account.h b/email-api/include/email-api-account.h index 98c545c..6da101a 100755 --- a/email-api/include/email-api-account.h +++ b/email-api/include/email-api-account.h @@ -26,371 +26,429 @@ #include "email-types.h" /** -* @defgroup EMAIL_SERVICE Email Service -* @{ -*/ - - -/** -* @ingroup EMAIL_SERVICE -* @defgroup EMAIL_API_ACCOUNT Email Account API -* @{ -*/ + * @internal + * @ingroup EMAIL_SERVICE_FRAMEWORK + * @defgroup EMAIL_SERVICE_ACCOUNT_MODULE Account API + * @brief Account API is a set of operations to manage email accounts like add, update, delete or get account related details. + * + * @section EMAIL_SERVICE_ACCOUNT_MODULE_HEADER Required Header + * \#include <email-api.h> + * + * @section EMAIL_SERVICE_ACCOUNT_MODULE_OVERVIEW Overview + * Account API is a set of operations to manage email accounts like add, update, delete or get account related details. + */ /** + * @file email-api-account.h + * @brief This file contains the data structures and interfaces of Accounts provided by email-service. + * @{ + * @code + * #include "email-api-account.h" + * bool + * other_app_invoke_uniform_api_sample(int* error_code) + * { + * email_account_t *account = NULL; + * email_account_t *new_account = NULL; * - * This file contains the data structures and interfaces needed for application, - * to interact with email-service. - * @file email-api-account.h - * @author Kyuho Jo <kyuho.jo@samsung.com> - * @author Sunghyun Kwon <sh0701.kwon@samsung.com> - * @version 0.1 - * @brief This file contains the data structures and interfaces of Accounts provided by - * email-service . + * account = malloc(sizeof(email_account_t)); + * memset(account, 0x00, sizeof(email_account_t)); * -* @{ - -* @code -* #include "email-api-account.h" -* bool -* other_app_invoke_uniform_api_sample(int* error_code) -* { -* email_account_t *account = NULL; -* email_account_t *new_account = NULL; -* -* account = malloc(sizeof(email_account_t)); -* memset(account, 0x00, sizeof(email_account_t)); -* -* account->retrieval_mode = 1; -* account->incoming_server_secure_connection = 1; -* account->outgoing_server_type = EMAIL_SERVER_TYPE_SMTP; -* account->outgoing_server_port_number = EMAIL_SMTP_PORT; -* account->outgoing_server_need_authentication = 1; -* account->account_name = strdup("gmail"); -* account->display_name = strdup("Tom"); -* account->user_email_address = strdup("tom@gmail.com"); -* account->reply_to_addr = strdup("tom@gmail.com"); -* account->return_addr = strdup("tom@gmail.com"); -* account->incoming_server_type = EMAIL_SERVER_TYPE_POP3; -* account->incoming_server_address = strdup("pop3.gmail.com"); -* account->incoming_server_port_number = 995; -* account->incoming_server_secure_connection = 1; -* account->retrieval_mode = EMAIL_IMAP4_RETRIEVAL_MODE_ALL; -* account->incoming_server_user_name = strdup("tom"); -* account->password = strdup("password"); -* account->outgoing_server_type = EMAIL_SERVER_TYPE_SMTP; -* account->outgoing_server_address = strdup("smtp.gmail.com"); -* account->outgoing_server_port_number = 587; -* account->outgoing_server_secure_connection = 0x02; -* account->outgoing_server_need_authentication = 1; -* account->outgoing_server_user_name = strdup("tom@gmail.com"); -* account->sending_password = strdup("password"); -* account->auto_resend_times = 0; -* account->pop_before_smtp = 0; -* account->incoming_server_requires_apop = 0; -* account->incoming_server_authentication_method = 0; -* account->is_preset_account = 1; -* account->logo_icon_path = strdup("Logo Icon Path"); -* account->options.priority = 3; -* account->options.keep_local_copy = 0; -* account->options.req_delivery_receipt = 0; -* account->options.req_read_receipt = 0; -* account->options.download_limit = 0; -* account->options.block_address = 0; -* account->options.block_subject = 0; -* account->options.display_name_from = strdup("Display name from"); -* account->options.reply_with_body = 0; -* account->options.forward_with_files = 0; -* account->options.add_myname_card = 0; -* account->options.add_signature = 0; -* account->options.signature= strdup("Signature"); -* account->check_interval = 0; -* // Add account -* if(EMAIL_ERROR_NONE != email_add_account(account)) -* //failure -* //else -* { -* //success -* if(account_id) -* *account_id = account->account_id; -* } -* if(EMAIL_ERROR_NONE != email_validate_account(account_id,&account_handle)) -* //failure -* else -* //success -* if(EMAIL_ERROR_NONE != email_delete_account(account_id)) -* //failure -* else -* //success -* new_account = malloc(sizeof(email_account_t)); -* memset(new_account, 0x00, sizeof(email_account_t)); -* new_account->flag1 = 1; -* new_account->account_name = strdup("samsung001"); -* new_account->display_name = strdup("Tom001"); -* new_account->options.keep_local_copy = 1; -* new_account->check_interval = 55; -* // Update account -* if(EMAIL_ERROR_NONE != email_update_account(acount_id,new_account)) -* //failure -* else -* //success -* // Get account -* if(EMAIL_ERROR_NONE != email_get_account(account_id,GET_FULL_DATA,&account)) -* //failure -* else -* //success -* // Get list of accounts -* if(EMAIL_ERROR_NONE != email_get_account_list(&account_list,&count)) -* //failure -* else -* //success -* // free account -* email_free_account(&account, 1); -* } + * account->retrieval_mode = 1; + * account->incoming_server_secure_connection = 1; + * account->outgoing_server_type = EMAIL_SERVER_TYPE_SMTP; + * account->outgoing_server_port_number = EMAIL_SMTP_PORT; + * account->outgoing_server_need_authentication = 1; + * account->account_name = strdup("gmail"); + * account->display_name = strdup("Tom"); + * account->user_email_address = strdup("tom@gmail.com"); + * account->reply_to_addr = strdup("tom@gmail.com"); + * account->return_addr = strdup("tom@gmail.com"); + * account->incoming_server_type = EMAIL_SERVER_TYPE_POP3; + * account->incoming_server_address = strdup("pop3.gmail.com"); + * account->incoming_server_port_number = 995; + * account->incoming_server_secure_connection = 1; + * account->retrieval_mode = EMAIL_IMAP4_RETRIEVAL_MODE_ALL; + * account->incoming_server_user_name = strdup("tom"); + * account->password = strdup("password"); + * account->outgoing_server_type = EMAIL_SERVER_TYPE_SMTP; + * account->outgoing_server_address = strdup("smtp.gmail.com"); + * account->outgoing_server_port_number = 587; + * account->outgoing_server_secure_connection = 0x02; + * account->outgoing_server_need_authentication = 1; + * account->outgoing_server_user_name = strdup("tom@gmail.com"); + * account->sending_password = strdup("password"); + * account->auto_resend_times = 0; + * account->pop_before_smtp = 0; + * account->incoming_server_requires_apop = 0; + * account->incoming_server_authentication_method = 0; + * account->is_preset_account = 1; + * account->logo_icon_path = strdup("Logo Icon Path"); + * account->options.priority = 3; + * account->options.keep_local_copy = 0; + * account->options.req_delivery_receipt = 0; + * account->options.req_read_receipt = 0; + * account->options.download_limit = 0; + * account->options.block_address = 0; + * account->options.block_subject = 0; + * account->options.display_name_from = strdup("Display name from"); + * account->options.reply_with_body = 0; + * account->options.forward_with_files = 0; + * account->options.add_myname_card = 0; + * account->options.add_signature = 0; + * account->options.signature= strdup("Signature"); + * account->check_interval = 0; + * // Add account + * if(EMAIL_ERROR_NONE != email_add_account(account)) + * //failure + * //else + * { + * //success + * if(account_id) + * *account_id = account->account_id; + * } + * if(EMAIL_ERROR_NONE != email_validate_account(account_id,&account_handle)) + * //failure + * else + * //success + * if(EMAIL_ERROR_NONE != email_delete_account(account_id)) + * //failure + * else + * //success + * new_account = malloc(sizeof(email_account_t)); + * memset(new_account, 0x00, sizeof(email_account_t)); + * new_account->flag1 = 1; + * new_account->account_name = strdup("tizen001"); + * new_account->display_name = strdup("Tom001"); + * new_account->options.keep_local_copy = 1; + * new_account->check_interval = 55; + * // Update account + * if(EMAIL_ERROR_NONE != email_update_account(acount_id,new_account)) + * //failure + * else + * //success + * // Get account + * if(EMAIL_ERROR_NONE != email_get_account(account_id,GET_FULL_DATA,&account)) + * //failure + * else + * //success + * // Get list of accounts + * if(EMAIL_ERROR_NONE != email_get_account_list(&account_list,&count)) + * //failure + * else + * //success + * // free account + * email_free_account(&account, 1); + * } * * @endcode * @} */ +/** + * @internal + * @addtogroup EMAIL_SERVICE_ACCOUNT_MODULE + * @{ + */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** - * @fn email_add_account(email_account_t* account) - * @brief Create a new email account.This function is invoked when user wants to add new email account + * @brief Creates a new email account. + * @details This function is invoked when the user wants to add a new email account. * - * @param[in] account Specifies the structure pointer of account. - * @exception none - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @see email_account_t - * @remarks N/A + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * @param[in] account The structure pointer of an account + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_account_t */ EXPORT_API int email_add_account(email_account_t* account); /** - * @fn email_delete_account(int account_id) - * @brief Delete a email account.This function is invoked when user wants to delete an existing email account + * @brief Deletes an email account. + * @details This function is invoked when the user wants to delete an existing email account. * - * @param[in] account_id Specifies the account ID. - * @exception EMAIL_ERROR_INVALID_PARAM -Invalid argument - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @see - * @remarks N/A + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] account_id The account ID + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @retval EMAIL_ERROR_INVALID_PARAM Invalid argument */ EXPORT_API int email_delete_account(int account_id); /** - * @fn email_update_account(int account_id, email_account_t* new_account) - * @brief Change the information of a email account.This function is getting invoked when user wants to change some information of existing email account. - * - * @param[in] account_id Specifies the orignal account ID. - * @param[in] new_account Specifies the information of new account. - * @param[in] with_validation If this is 1, email-service will validate the account before updating. If this is 0, email-service will update the account without validation. - * @exception EMAIL_ERROR_INVALID_PARAM -Invalid argument - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @see email_account_t - * @remarks N/A + * @brief Changes the information of an email account. + * @details This function is invoked when the user wants to change some information of the existing email account. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] account_id The original account ID + * @param[in] new_account The information of new account + * @param[in] with_validation The validation flag \n + * If this is @c 1, email-service will validate the account before updating. + * If this is @c 0, email-service will update the account without validation. + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @retval #EMAIL_ERROR_INVALID_PARAM Invalid argument + * + * @see #email_account_t */ EXPORT_API int email_update_account(int account_id, email_account_t* new_account); /** - * @fn email_update_account_with_validation(int account_id, email_account_t* new_account) - * @brief Change the information of a email account.This function is getting invoked when user wants to change some information of existing email account. - * - * @param[in] account_id Specifies the orignal account ID. - * @param[in] new_account Specifies the information of new account. - * @param[in] with_validation If this is 1, email-service will validate the account before updating. If this is 0, email-service will update the account without validation. - * @exception EMAIL_ERROR_INVALID_PARAM -Invalid argument - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @see email_account_t - * @remarks N/A + * @brief Changes the information of an email account. + * @details This function is invoked when the user wants to change some information of the existing email account. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] account_id The original account ID + * @param[in] new_account The information of new account + * @param[in] with_validation The validation tag \n + * If this is @c 1, email-service will validate the account before updating. + * If this is @c 0, email-service will update the account without validation. + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @retval #EMAIL_ERROR_INVALID_PARAM Invalid argument + * + * @see #email_account_t */ EXPORT_API int email_update_account_with_validation(int account_id, email_account_t* new_account); /** - * @fn email_get_account(int account_id, int pulloption, email_account_t** account) - * @brief Get an email account by ID. This function is getting invoked when user wants to get the account informantion based on account id and option (GET_FULL_DATA/WITHOUT_OPTION/ONLY_OPTION).<br> - * Memory for account information will be allocated to 3rd param(account). The allocated memory should be freed by email_free_account(). - * - * @param[in] account_id Specifies the account ID.This function is invoked when user - * @param[in] pulloption Option to specify to get full details or partial, see definition of EMAIL_ACC_GET_OPT_XXX - * @param[out] account The returned account is saved here. - * @exception EMAIL_ERROR_INVALID_PARAM -Invalid argument - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @see email_account_t - * @remarks N/A + * @brief Gets an email account by ID. + * @details This function is invoked when the user wants to get the account information based on account ID and option (GET_FULL_DATA/WITHOUT_OPTION/ONLY_OPTION). + * Memory for account information will be allocated to the 3rd param (@a account). + * You must free the allocated memory using email_free_account(). + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] account_id The account ID + * @param[in] pulloption The option to specify to get full details or partial \n + * See definition of #EMAIL_ACC_GET_OPT_XXX. + * @param[out] account The returned account is saved here + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @retval #EMAIL_ERROR_INVALID_PARAM Invalid argument + * + * @see #email_account_t */ EXPORT_API int email_get_account(int account_id, int pulloption, email_account_t** account); /** - * @fn email_get_account_list(email_account_t** account_list, int* count); - * @brief Get Account List.This function is getting invoked when user wants to get all account information based on the count of accounts provided by user.<br> - * Memory for account information will be allocated to 3rd param(account). The allocated memory should be freed by email_free_account(). - * - * @param[in] account_list Specifies the structure pointer of account. - * @param[out] count Specifies the count of accounts. - * @exception EMAIL_ERROR_INVALID_PARAM -Invalid argument - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @see email_account_t - * @remarks N/A + * @brief Gets an account list. + * @details This function is invoked when the user wants to get all account information based on the count of accounts provided by user. + * Memory for account information will be allocated to 3rd param (@a account). + * You must free the allocated memory using email_free_account(). + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] account_list The structure pointer of an account + * @param[out] count The count of accounts + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @retval #EMAIL_ERROR_INVALID_PARAM Invalid argument + * + * @see #email_account_t */ EXPORT_API int email_get_account_list(email_account_t** account_list, int* count); /** - * @fn email_free_account(email_account_t** account_list, int count); - * @brief Free allocated memory.This function is getting invoked when user wants to delete all account information. - * - * @param[in] account_list Specifies the structure pointer of account. - * @param[out] count Specifies the count of accounts. - * @exception EMAIL_ERROR_INVALID_PARAM -Invalid argument - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @see email_account_t - * @remarks N/A + * @brief Frees allocated memory. + * @details This function is invoked when the user wants to delete all account information. + * + * @since_tizen 2.3 + * @privlevel N/P + * + * @param[in] account_list The structure pointer of an account + * @param[out] count The count of accounts + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @retval #EMAIL_ERROR_INVALID_PARAM Invalid argument + * + * @see #email_account_t */ EXPORT_API int email_free_account(email_account_t** account_list, int count); - -/** - * @fn email_validate_account(int account_id, int *handle) - * @brief Validate account.This function is getting invoked after adding one account to validate it.If account is not validated then user should retry once again to add the account . - * - * @param[in] account_id Specifies the account Id to validate. - * @param[out] handle Specifies the sending handle. - * @remarks N/A - * @exception EMAIL_ERROR_INVALID_PARAM -Invalid argument - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @see none - * @remarks N/A - */ EXPORT_API int email_validate_account(int account_id, int *handle) DEPRECATED; /* Will be replaced with email_validate_account_ex */ /** - * @fn email_validate_account_ex(email_account_t* account, int *handle) - * @brief Validate account.This function is getting invoked after adding one account to validate it.If account is not validated then user should retry once again to add the account . + * @brief Validates an account. + * @details This function is invoked after adding one account to validate it. + * If the account is not validated then t user should retry once again to add the account. * - * @param[in] account Specifies the account structure - * @param[out] handle Specifies the sending handle. - * @remarks N/A - * @exception EMAIL_ERROR_INVALID_PARAM - Invalid argument - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @see email_account_t - * @remarks N/A + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] account The account structure + * @param[out] handle The sending handle + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @retval #EMAIL_ERROR_INVALID_PARAM Invalid argument + * + * @see #email_account_t */ EXPORT_API int email_validate_account_ex(email_account_t* account, int *handle); /** - * @fn email_add_account_with_validation(email_account_t* account, int *handle) - * @brief Add an account when the account is validated. This function is getting invoked when user want to validate an account. If account is not validated then user should retry once again to add the account.<br> - * Validation is executed without saving an account to DB + * @brief Adds an account when the account is validated. + * @details This function is invoked when a user wants to validate an account. + * If the account is not validated then user should retry once again to add the account. + * Validation is executed without saving an account to DB. * - * @param[in] account Specifies the structure pointer of account. - * @param[out] handle Specifies the sending handle. - * @remarks N/A - * @return This function returns true on success or false on failure. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] account The structure pointer of an account + * @param[out] handle The sending handle + * + * @return @c true on success, + * otherwise @c false on failure */ EXPORT_API int email_add_account_with_validation(email_account_t* account, int *handle); /** - * @fn email_backup_accounts_into_secure_storage(const char *file_name) - * @brief Back up information of all accounts into secure storage. - * This function is getting invoked when user want to backup account information safely. + * @brief Backs up information of all accounts into the secure storage. + * @details This function is invoked when a user wants to backup account information safely. * - * @param[in] file_name Specifies the file name in secure storage - * @remarks N/A - * @return This function returns true on success or false on failure. + * @param[in] file_name The file name in secure storage + * + * @return @c true on success, + * otherwise @c false on failure */ EXPORT_API int email_backup_accounts_into_secure_storage(const char *file_name); /** - * @fn email_restore_accounts_from_secure_storage(const char *file_name) - * @brief Restore accounts from stored file in secure storage. - * This function is getting invoked when user want to restore accounts. + * @brief Restores accounts from a file stored in the secure storage. + * @details This function is invoked when a user wants to restore accounts. * - * @param[in] file_name Specifies the file name in secure storage - * @remarks N/A - * @return This function returns true on success or false on failure. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] file_name The file name in the secure storage + * + * @return @c true on success, + * otherwise @c false on failure */ EXPORT_API int email_restore_accounts_from_secure_storage(const char * file_name); /** - * @fn email_get_password_length_of_account(const int account_id, int *password_length) - * @brief Get password length of an account. - * This function is getting invoked when user want to know the length of an account. + * @brief Gets the password length of an account. + * @details This function is invoked when a user wants to know the length of an account. * - * @param[in] account_id Specifies the account id - * @param[in] password_type Specifies the password type - * @param[out] password_length Specifies the password length. - * @remarks N/A - * @return This function returns true on success or false on failure. - */ -EXPORT_API int email_get_password_length_of_account(int account_id, int *password_length); - - -/** - * @fn email_query_server_info(const char* domain_name, email_server_info_t **result_server_info) - * @brief Query email server information. - * This function is getting invoked when user want to get email server information. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email * - * @param[in] domain_name Specifies the domain name of server - * @param[out] result_server_info Specifies the information of email server. - * @remarks N/A - * @return This function returns true on success or false on failure. + * @param[in] account_id The account ID + * @param[in] password_type The password type + * @param[out] password_length The password length + * + * @return @c true on success, + * otherwise @c false on failure */ -EXPORT_API int email_query_server_info(const char* domain_name, email_server_info_t **result_server_info); +EXPORT_API int email_get_password_length_of_account(int account_id, email_get_password_length_type password_type, int *password_length); /** - * @fn email_free_server_info(email_server_info_t **result_server_info) - * @brief Free email_server_info_t. - * This function is getting invoked when user want to free email_server_info_t. + * @brief Updates notifications on the notification bar. + * @details This function is invoked when user want to update notification bar. * - * @param[in] result_server_info Specifies the pointer of in secure storage - * @remarks N/A - * @return This function returns true on success or false on failure. + * @param[in] account_id The account ID + * @param[in] total_mail_count The total number of synced mail + * @param[in] unread_mail_count The unread number of synced mail + * @param[in] input_from_eas The flag that specifies whether the mail is from EAS + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise error code (see #EMAIL_ERROR_XXX) on failure */ -EXPORT_API int email_free_server_info(email_server_info_t **result_server_info); +EXPORT_API int email_update_notification_bar(int account_id, int total_mail_count, int unread_mail_count, int input_from_eas); /** - * @fn email_update_notification_bar(int account_id) - * @brief Update notifications on notification bar. - * This function is getting invoked when user want to update notification bar. + * @brief Clears all notification on the notification bar. + * @details This function is invoked when a user wants to clear notification bar. * - * @param[in] account_id Specifies the id of account. - * @remarks N/A - * @return This function returns true on success or false on failure. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise error code (see #EMAIL_ERROR_XXX) on failure */ -EXPORT_API int email_update_notification_bar(int account_id); +EXPORT_API int email_clear_all_notification_bar(); /** - * @fn email_clear_all_notification_bar() - * @brief Clear all notification on notification bar. - * This function is getting invoked when user want to clear notification bar. + * @fn email_clear_notification_bar(int account_id) + * @brief Clear notification of account on notification bar. + * This function is getting invoked when user want to clear notification bar. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email * * @remarks N/A - * @return This function returns true on success or false on failure. + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ -EXPORT_API int email_clear_all_notification_bar(); - +EXPORT_API int email_clear_notification_bar(int account_id); /** - * @fn email_save_default_account_id() - * @brief Save default account id to vconf storage. - * This function is getting invoked when user want to save default account id. + * @brief Saves the default account ID to the vconf storage. + * @details This function is invoked when a user wants to save a default account ID. * - * @remarks N/A - * @return This function returns true on success or false on failure. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_save_default_account_id(int input_account_id); /** - * @fn email_load_default_account_id() - * @brief Load default account id to vconf storage. - * This function is getting invoked when user want to load default account id. + * @brief Loads the default account ID to the vconf storage. + * @details This function is invoked when a user wants to load a default account ID. * - * @remarks N/A - * @return This function returns true on success or false on failure. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @return @c true on success, + * otherwise @c false on failure */ EXPORT_API int email_load_default_account_id(int *output_account_id); @@ -399,8 +457,8 @@ EXPORT_API int email_load_default_account_id(int *output_account_id); #endif /* __cplusplus */ /** -* @} @} -*/ + * @} + */ #endif /* __EMAIL_API_ACCOUNT_H__ */ diff --git a/email-api/include/email-api-etc.h b/email-api/include/email-api-etc.h index 4d6d2e5..1d19100 100755 --- a/email-api/include/email-api-etc.h +++ b/email-api/include/email-api-etc.h @@ -20,26 +20,27 @@ */ /** -* @defgroup EMAIL_SERVICE Email Service -* @{ -*/ + * @file email-api-etc.h + * @brief This file contains the data structures and interfaces of etc APIs provided by email-service. + */ /** -* @ingroup EMAIL_SERVICE -* @defgroup EMAIL_API_ETC Email API -* @{ -*/ + * @internal + * @ingroup EMAIL_SERVICE_FRAMEWORK + * @defgroup EMAIL_SERVICE_ETC_MODULE Other API + * @brief Various API set for initializing and MIME operations and verifying email address. + * + * @section EMAIL_SERVICE_ETC_MODULE_HEADER Required Header + * \#include <email-api-etc.h> + * \#include <email-api-init.h> + * + * @section EMAIL_SERVICE_ETC_MODULE_OVERVIEW Overview + */ /** - * - * This file contains the data structures and interfaces needed for application, - * to interact with email-service. - * @file email-api-etc.h - * @author Kyuho Jo <kyuho.jo@samsung.com> - * @author Sunghyun Kwon <sh0701.kwon@samsung.com> - * @version 0.1 - * @brief This file contains the data structures and interfaces of Accounts provided by - * email-service . + * @internal + * @addtogroup EMAIL_SERVICE_FRAMEWORK + * @{ */ #ifndef __EMAIL_API_ETC_H__ @@ -52,67 +53,98 @@ extern "C" { #include "email-types.h" /** - * @fn email_show_user_message - * @brief This function show user message. + * @brief Shows a user message. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @exception none - * @see email_action_t - * @remarks N/A + * @param[in] id (need to be updated) + * @param[in] action (need to be updated) + * @param[in] error_code (need to be updated) + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_action_t */ EXPORT_API int email_show_user_message(int id, email_action_t action, int error_code); /** - * @fn email_parse_mime_file - * @brief This function parse mime file - * @param[in] eml_file_path - * @param[out] output_mail_data - * @param[out] output_attachment_data - * @param[out] output_attachment_count - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @exception none - * @see - * @remarks N/A + * @brief Parses a MIME file. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] eml_file_path (need to be updated) + * @param[out] output_mail_data (need to be updated) + * @param[out] output_attachment_data (need to be updated) + * @param[out] output_attachment_count (need to be updated) + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_parse_mime_file(char *eml_file_path, email_mail_data_t **output_mail_data, email_attachment_data_t **output_attachment_data, int *output_attachment_count); /** - * @fn email_write_mime_file - * @brief This function create mime file from input data - * @param[in] input_mail_data - * @param[in] input_attachment_data - * @param[in] input_attachment_count - * @param[out] output_file_path - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @exception none - * @see - * @remarks N/A + * @brief Creates a MIME file from input data. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] input_mail_data (need to be updated) + * @param[in] input_attachment_data (need to be updated) + * @param[in] input_attachment_count (need to be updated) + * @param[out] output_file_path (need to be updated) + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_write_mime_file(email_mail_data_t *input_mail_data, email_attachment_data_t *input_attachment_data, int input_attachment_count, char **output_file_path); /** - * @fn email_delete_parsed_data - * @brief This function delete parsed files of mime - * @param[in] input_mail_data - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @exception none - * @see - * @remarks N/A + * @brief Deletes the parsed files of MIME. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] input_mail_data (need to be updated) + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_delete_parsed_data(email_mail_data_t *input_mail_data); /** - * @fn email_get_mime_entity - * @brief This function get mime entity - * @param[in] mime_path - * @param[out] mime_entity - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @exception none - * @see - * @remarks N/A + * @brief Gets a MIME entity. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] mime_path (need to be updated) + * @param[out] mime_entity (need to be updated) + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_get_mime_entity(char *mime_path, char **mime_entity); + +/** + * @brief Validates email address. + * + * @since_tizen 2.3 + * + * @param[in] input_email_address The email address string + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + */ +EXPORT_API int email_verify_email_address(char *input_email_address); #ifdef __cplusplus } #endif /* __cplusplus */ @@ -120,5 +152,5 @@ EXPORT_API int email_get_mime_entity(char *mime_path, char **mime_entity); #endif /* __EMAIL_API_ETC_H__ */ /** -* @} @} -*/ + * @} + */ diff --git a/email-api/include/email-api-init.h b/email-api/include/email-api-init.h index 6e2ffe1..6e15f3f 100755 --- a/email-api/include/email-api-init.h +++ b/email-api/include/email-api-init.h @@ -26,140 +26,133 @@ #include "email-types.h" /** -* @defgroup EMAIL_SERVICE Email Service -* @{ -*/ - - -/** -* @ingroup EMAIL_SERVICE -* @defgroup EMAIL_API_INIT Email Initialization API -* @{ -*/ - -/** + * @internal + * @file email-api-init.h + * @brief This file contains the data structures and interfaces of Email FW Initialization provided by email-service. + * + * @{ + * @code + * + * #include "email-api-init.h" + * + * bool + * other_app_invoke_uniform_api_sample(int* error_code) + * { + * int err = EMAIL_ERROR_NONE; + * + * // Opens connections to email-service and DB + * // The connections will be maintain throughout application's execution + * if(EMAIL_ERROR_NONE == email_service_begin()) + * { + * If(EMAIL_ERROR_NONE != email_open_db()) + * { + * return false; + * } + * + * // Executes email_init_storage() if and only if there is no db file. + * // This function will create db file and tables for email service + * If(EMAIL_ERROR_NONE !=email_init_storage()) + * { + * return false; + * } + * } + * + * ...... + * + * // Work with calling MAPI functions * - * This file contains the data structures and interfaces needed for application, - * to interact with email-service. - * @file email-api-init.h - * @author Kyuho Jo <kyuho.jo@samsung.com> - * @author Sunghyun Kwon <sh0701.kwon@samsung.com> - * @version 0.1 - * @brief This file contains the data structures and interfaces of Email FW Initialization provided by - * email-service . - *@{ - *@code - * - * #include "email-api-init.h" - * - * bool - * other_app_invoke_uniform_api_sample(int* error_code) - * { - * int err = EMAIL_ERROR_NONE; - * - * // Open connections to email-service and DB - * // The connections will be maintain throughout application's execution - * if(EMAIL_ERROR_NONE == email_service_begin()) - * { - * If(EMAIL_ERROR_NONE != email_open_db()) - * { - * return false; - * } - * - * // Execute email_init_storage() if and only if there is no db file. - * // This fuction will create db file and tables for email service - * If(EMAIL_ERROR_NONE !=email_init_storage()) - * { - * return false; - * } - * } - * - * ...... - * - * // Work with calling MAPI functions - * - * ...... - * - * // Close the connections to email-service and DB after all email job is finished. (ex. close an email application) - * // DO NOT have to call these funtions until the connections is not needed any more. - * err =email_close_db(); - * err =email_service_end(); - * } + * ...... + * + * // Closes the connections to email-service and DB after all email jobs are finished. (ex. close an email application) + * // DO NOT have to call these funtions until the connections are not needed any more. + * err =email_close_db(); + * err =email_service_end(); + * } * * @endcode * @} */ - +/** + * @internal + * @addtogroup EMAIL_SERVICE_ETC_MODULE + * @{ + */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** - * @fn email_init_storage(void) - * @brief Create all tables for email. + * @brief Creates all tables for an email. * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure - * @exception none - * @see none - * @remarks N/A + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_init_storage(void); /** - * @fn email_open_db(void) - * @brief This function Open the email DB and register busy handler + * @brief Opens the email DB and registers a busy handler. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @exception none - * @see none - * @remarks N/A + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_open_db(void); /** - * @fn email_close_db(void) - * @brief This function closes the connection of the email DB + * @brief Closes the connection to the email DB. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @exception none - * @see none - * @remarks N/A + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_close_db(void); /** - * @fn email_service_begin(void) - * @brief Does the IPC Proxy Initialization by the Application which used the Email FW API's + * @brief Initializes IPC Proxy by an application which used the Email FW API's. * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @exception none - * @see none - * @remarks N/A + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_service_begin(void); /** - * @fn email_service_end(void) - * @brief This function does the IPC Proxy Finaization by the Application which used the Email FW API's - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @exception none - * @see none - * @remarks N/A + * @brief Finalizes IPC Proxy by an application which used the Email FW API's. + + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_service_end(void); /** - * @fn email_ping_service(void) - * @brief This function check email-service process is running or not + * @brief Checks whether the email-service process is running. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @exception none - * @see none - * @remarks N/A + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_ping_service(void); @@ -168,8 +161,8 @@ EXPORT_API int email_ping_service(void); #endif /* __cplusplus */ /** -* @} @} -*/ + * @} + */ #endif /* __EMAIL_API_INTI_H__ */ diff --git a/email-api/include/email-api-mail.h b/email-api/include/email-api-mail.h index 212cd81..b2cdf1a 100755 --- a/email-api/include/email-api-mail.h +++ b/email-api/include/email-api-mail.h @@ -30,913 +30,1000 @@ #include <unistd.h> /** -* @defgroup EMAIL_SERVICE Email Service -* @{ -*/ - - -/** -* @ingroup EMAIL_SERVICE -* @defgroup EMAIL_API_MAIL Email Mail API -* @{ -*/ + * @file email-api-mail.h + */ /** + * @internal + * @ingroup EMAIL_SERVICE_FRAMEWORK + * @defgroup EMAIL_SERVICE_MAIL_MODULE Mail API + * @brief Mail API is a set of operations to manage mail like add, update, delete or get mail related details. + * + * @section EMAIL_SERVICE_MAIL_MODULE_HEADER Required Header + * \#include <email-api-mail.h> * - * This file contains the data structures and interfaces needed for application, - * to interact with email-service. - * @file email-api-mail.h - * @author Kyuho Jo <kyuho.jo@samsung.com> - * @author Sunghyun Kwon <sh0701.kwon@samsung.com> - * @version 0.1 - * @brief This file contains the data structures and interfaces of Messages provided by - * email-service . + * @section EMAIL_SERVICE_MAIL_MODULE_OVERVIEW Overview + * Mail API is a set of operations to manage mail like add, update, delete or get mail related details. */ - +/** + * @internal + * @addtogroup EMAIL_SERVICE_MAIL_MODULE + * @{ + */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** - * @fn email_add_mail(email_mail_data_t *input_mail_data, email_attachment_data_t *input_attachment_data_list, int input_attachment_count, email_meeting_request_t* input_meeting_request, int input_from_eas) - * @brief Save a mail. This function is invoked when user wants to add a mail. - * If the option from_eas is 1 then this will save the message on server as well as on locally. - * If the incoming_server_type is EMAIL_SERVER_TYPE_POP3 then from_eas value will be 0 - * If the incoming_server_type is EMAIL_SERVER_TYPE_IMAP4 then from_eas value will be 1/0 - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_mail_data Specifies the saving mail. - * @param[in] input_attachment_data_list Specifies the mailbox structure for saving email. - * @param[in] input_attachment_count Specifies if the mail comes from composer. - * @param[in] input_meeting_request Specifies if the mail comes from composer. - * @param[in] input_from_eas Specifies if the mail will be saved on server. - - * @exception none - * @see email_mail_data_t and email_mailbox_t - * @remarks N/A - * @code - * #include "email-api-mail.h" - * int _test_add_mail () - * { - * int i = 0; - * int account_id = 0; - * int from_eas = 0; - * int attachment_count = 0; - * int err = EMAIL_ERROR_NONE; - * char arg[50] = { 0 , }; - * char *body_file_path = MAILHOME"/tmp/mail.txt"; - * email_mailbox_t *mailbox_data = NULL; - * email_mail_data_t *test_mail_data = NULL; - * email_attachment_data_t *attachment_data = NULL; - * email_meeting_request_t *meeting_req = NULL; - * FILE *body_file; - * - * printf("\n > Enter account id : "); - * scanf("%d", &account_id); - * - * - * memset(arg, 0x00, 50); - * printf("\n > Enter mailbox name : "); - * scanf("%s", arg); - * - * email_get_mailbox_by_name(account_id, arg, &mailbox_data); - * - * test_mail_data = malloc(sizeof(email_mail_data_t)); - * memset(test_mail_data, 0x00, sizeof(email_mail_data_t)); - * - * printf("\n From EAS? [0/1]> "); - * scanf("%d", &from_eas); - * - * test_mail_data->account_id = account_id; - * test_mail_data->save_status = 1; - * test_mail_data->flags_seen_field = 1; - * test_mail_data->file_path_plain = strdup(body_file_path); - * test_mail_data->mailbox_id = mailbox_data->mailbox_id; - * test_mail_data->mailbox_type = mailbox_data->mailbox_type; - * test_mail_data->full_address_from = strdup("<test1@test.com>"); - * test_mail_data->full_address_to = strdup("<test2@test.com>"); - * test_mail_data->full_address_cc = strdup("<test3@test.com>"); - * test_mail_data->full_address_bcc = strdup("<test4@test.com>"); - * test_mail_data->subject = strdup("Meeting request mail"); - * - * body_file = fopen(body_file_path, "w"); - * - * for(i = 0; i < 500; i++) - * fprintf(body_file, "X2 X2 X2 X2 X2 X2 X2"); - * fflush(body_file); - * fclose(body_file); - * - * printf(" > Attach file? [0/1] : "); - * scanf("%d",&attachment_count); - * - * if ( attachment_count ) { - * memset(arg, 0x00, 50); - * printf("\n > Enter attachment name : "); - * scanf("%s", arg); - * - * attachment_data = malloc(sizeof(email_attachment_data_t)); - * - * attachment_data->attachment_name = strdup(arg); - * - * memset(arg, 0x00, 50); - * printf("\n > Enter attachment absolute path : "); - * scanf("%s",arg); - * - * attachment_data->attachment_path = strdup(arg); - * attachment_data->save_status = 1; - * test_mail_data->attachment_count = attachment_count; - * } + * @brief Saves a mail. + * @details This function is invoked when a user wants to add a mail.\n + * If the option from_eas is 1 then this will save the message on server as well as on locally.\n + * If the incoming_server_type is EMAIL_SERVER_TYPE_POP3 then from_eas value will be 0.\n + * If the incoming_server_type is EMAIL_SERVER_TYPE_IMAP4 then from_eas value will be 1/0. * - * printf("\n > Meeting Request? [0: no, 1: yes (request from server), 2: yes (response from local)]"); - * scanf("%d", &(test_mail_data->meeting_request_status)); - * - * if ( test_mail_data->meeting_request_status == 1 - * || test_mail_data->meeting_request_status == 2 ) { - * time_t current_time; - * meeting_req = malloc(sizeof(email_meeting_request_t)); - * memset(meeting_req, 0x00, sizeof(email_meeting_request_t)); - * - * meeting_req->meeting_response = 1; - * current_time = time(NULL); - * gmtime_r(¤t_time, &(meeting_req->start_time)); - * gmtime_r(¤t_time, &(meeting_req->end_time)); - * meeting_req->location = malloc(strlen("Seoul") + 1); - * memset(meeting_req->location, 0x00, strlen("Seoul") + 1); - * strcpy(meeting_req->location, "Seoul"); - * strcpy(meeting_req->global_object_id, "abcdef12345"); - * - * meeting_req->time_zone.offset_from_GMT = 9; - * strcpy(meeting_req->time_zone.standard_name, "STANDARD_NAME"); - * gmtime_r(¤t_time, &(meeting_req->time_zone.standard_time_start_date)); - * meeting_req->time_zone.standard_bias = 3; - * - * strcpy(meeting_req->time_zone.daylight_name, "DAYLIGHT_NAME"); - * gmtime_r(¤t_time, &(meeting_req->time_zone.daylight_time_start_date)); - * meeting_req->time_zone.daylight_bias = 7; + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email * - * } + * @param[in] input_mail_data The mail to be saved + * @param[in] input_attachment_data_list The mailbox structure for saving email + * @param[in] input_attachment_count The mail attachment count + * @param[in] input_meeting_request Specifies if the mail comes from composer + * @param[in] input_from_eas Specifies if the mail will be saved on server * - * if((err = email_add_mail(test_mail_data, attachment_data, attachment_count, meeting_req, from_eas)) != EMAIL_ERROR_NONE) - * printf("email_add_mail failed. [%d]\n", err); - * else - * printf("email_add_mail success.\n"); + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure * - * if(attachment_data) - * email_free_attachment_data(&attachment_data, attachment_count); + * @see #email_mail_data_t and #email_mailbox_t + * + * @code + * #include "email-api-mail.h" + * int _test_add_mail () + * { + * int i = 0; + * int account_id = 0; + * int from_eas = 0; + * int attachment_count = 0; + * int err = EMAIL_ERROR_NONE; + * char arg[50] = { 0 , }; + * char *body_file_path = MAILHOME"/tmp/mail.txt"; + * email_mailbox_t *mailbox_data = NULL; + * email_mail_data_t *test_mail_data = NULL; + * email_attachment_data_t *attachment_data = NULL; + * email_meeting_request_t *meeting_req = NULL; + * FILE *body_file; + * + * printf("\n > Enter account id : "); + * scanf("%d", &account_id); + * + * + * memset(arg, 0x00, 50); + * printf("\n > Enter mailbox name : "); + * scanf("%s", arg); + * + * email_get_mailbox_by_name(account_id, arg, &mailbox_data); + * + * test_mail_data = malloc(sizeof(email_mail_data_t)); + * memset(test_mail_data, 0x00, sizeof(email_mail_data_t)); + * + * printf("\n From EAS? [0/1]> "); + * scanf("%d", &from_eas); + * + * test_mail_data->account_id = account_id; + * test_mail_data->save_status = 1; + * test_mail_data->flags_seen_field = 1; + * test_mail_data->file_path_plain = strdup(body_file_path); + * test_mail_data->mailbox_id = mailbox_data->mailbox_id; + * test_mail_data->mailbox_type = mailbox_data->mailbox_type; + * test_mail_data->full_address_from = strdup("<test1@test.com>"); + * test_mail_data->full_address_to = strdup("<test2@test.com>"); + * test_mail_data->full_address_cc = strdup("<test3@test.com>"); + * test_mail_data->full_address_bcc = strdup("<test4@test.com>"); + * test_mail_data->subject = strdup("Meeting request mail"); + * + * body_file = fopen(body_file_path, "w"); + * + * for(i = 0; i < 500; i++) + * fprintf(body_file, "X2 X2 X2 X2 X2 X2 X2"); + * fflush(body_file); + * fclose(body_file); + * + * printf(" > Attach file? [0/1] : "); + * scanf("%d",&attachment_count); + * + * if ( attachment_count ) { + * memset(arg, 0x00, 50); + * printf("\n > Enter attachment name : "); + * scanf("%s", arg); + * + * attachment_data = malloc(sizeof(email_attachment_data_t)); + * + * attachment_data->attachment_name = strdup(arg); + * + * memset(arg, 0x00, 50); + * printf("\n > Enter attachment absolute path : "); + * scanf("%s",arg); + * + * attachment_data->attachment_path = strdup(arg); + * attachment_data->save_status = 1; + * test_mail_data->attachment_count = attachment_count; + * } + * + * printf("\n > Meeting Request? [0: no, 1: yes (request from server), 2: yes (response from local)]"); + * scanf("%d", &(test_mail_data->meeting_request_status)); + * + * if ( test_mail_data->meeting_request_status == 1 + * || test_mail_data->meeting_request_status == 2 ) { + * time_t current_time; + * meeting_req = malloc(sizeof(email_meeting_request_t)); + * memset(meeting_req, 0x00, sizeof(email_meeting_request_t)); + * + * meeting_req->meeting_response = 1; + * current_time = time(NULL); + * gmtime_r(¤t_time, &(meeting_req->start_time)); + * gmtime_r(¤t_time, &(meeting_req->end_time)); + * meeting_req->location = malloc(strlen("Seoul") + 1); + * memset(meeting_req->location, 0x00, strlen("Seoul") + 1); + * strcpy(meeting_req->location, "Seoul"); + * strcpy(meeting_req->global_object_id, "abcdef12345"); + * + * meeting_req->time_zone.offset_from_GMT = 9; + * strcpy(meeting_req->time_zone.standard_name, "STANDARD_NAME"); + * gmtime_r(¤t_time, &(meeting_req->time_zone.standard_time_start_date)); + * meeting_req->time_zone.standard_bias = 3; + * + * strcpy(meeting_req->time_zone.daylight_name, "DAYLIGHT_NAME"); + * gmtime_r(¤t_time, &(meeting_req->time_zone.daylight_time_start_date)); + * meeting_req->time_zone.daylight_bias = 7; + * + * } + * + * if((err = email_add_mail(test_mail_data, attachment_data, attachment_count, meeting_req, from_eas)) != EMAIL_ERROR_NONE) + * printf("email_add_mail failed. [%d]\n", err); + * else + * printf("email_add_mail success.\n"); + * + * if(attachment_data) + * email_free_attachment_data(&attachment_data, attachment_count); * - * if(meeting_req) - * email_free_meeting_request(&meeting_req, 1); + * if(meeting_req) + * email_free_meeting_request(&meeting_req, 1); * - * email_free_mail_data(&test_mail_data, 1); - * email_free_mailbox(&mailbox_data, 1); + * email_free_mail_data(&test_mail_data, 1); + * email_free_mailbox(&mailbox_data, 1); * - * printf("saved mail id = [%d]\n", test_mail_data->mail_id); + * printf("saved mail id = [%d]\n", test_mail_data->mail_id); * - * return 0; + * return 0; * } * @endcode */ EXPORT_API int email_add_mail(email_mail_data_t *input_mail_data, email_attachment_data_t *input_attachment_data_list, int input_attachment_count, email_meeting_request_t* input_meeting_request, int input_from_eas); /** - * @fn email_add_read_receipt(int input_read_mail_id, int *output_handle) - * @brief Add a read receipt mail. This function is invoked when user receives a mail with read report enable and wants to send a read report for the same. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_read_mail_id Specifies the id of mail which has been read. - * @param[out] output_receipt_mail_id Specifies the receipt mail id . - * @exception none - * @see - * @remarks N/A + * @brief Adds a read receipt mail. + * @details This function is invoked when a user receives a mail with read report enable and wants to send a read report for the same. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] input_read_mail_id The ID of mail which has been read + * @param[out] output_receipt_mail_id The receipt mail ID + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_add_read_receipt(int input_read_mail_id, int *output_receipt_mail_id); /** - * @fn email_update_mail(email_mail_data_t *input_mail_data, email_attachment_data_t *input_attachment_data_list, int input_attachment_count, email_meeting_request_t* input_meeting_request, int input_from_composer) - * @brief Update a existing email information. This function is invoked when user wants to change some existing email information with new email information. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_mail_data Specifies the mail ID. - * @param[in] input_attachment_data_list Specifies the pointer of attachment data. - * @param[in] input_attachment_count Specifies the number of attachment data. - * @param[in] input_meeting_request Specifies the meeting request data. - * @param[in] input_from_eas Specifies whether sync server. - - * @exception none - * @see email_mail_data_t + * @brief Updates an existing email information. + * @details This function is invoked when a user wants to change some existing email information with new email information. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] input_mail_data The mail ID + * @param[in] input_attachment_data_list The pointer of attachment data + * @param[in] input_attachment_count The number of attachment data + * @param[in] input_meeting_request The meeting request data + * @param[in] input_from_eas Specifies whether sync server + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mail_data_t + * * @code * #include "email-api-account.h" * int email_test_update_mail() * { - * int mail_id = 0; - * int err = EMAIL_ERROR_NONE; - * int test_attachment_data_count = 0; - * char arg[50]; - * email_mail_data_t *test_mail_data = NULL; - * email_attachment_data_t *test_attachment_data_list = NULL; - * email_meeting_request_t *meeting_req = NULL; + * int mail_id = 0; + * int err = EMAIL_ERROR_NONE; + * int test_attachment_data_count = 0; + * char arg[50]; + * email_mail_data_t *test_mail_data = NULL; + * email_attachment_data_t *test_attachment_data_list = NULL; + * email_meeting_request_t *meeting_req = NULL; * - * printf("\n > Enter mail id : "); - * scanf("%d", &mail_id); + * printf("\n > Enter mail id : "); + * scanf("%d", &mail_id); * - * email_get_mail_data(mail_id, &test_mail_data); + * email_get_mail_data(mail_id, &test_mail_data); * - * printf("\n > Enter Subject: "); - * scanf("%s", arg); + * printf("\n > Enter Subject: "); + * scanf("%s", arg); * - * test_mail_data->subject= strdup(arg); + * test_mail_data->subject= strdup(arg); * * * - * if (test_mail_data->attachment_count > 0) { - * if ( (err = email_get_attachment_data_list(mail_id, &test_attachment_data_list, &test_attachment_data_count)) != EMAIL_ERROR_NONE ) { - * printf("email_get_meeting_request() failed [%d]\n", err); - * return -1; - * } - * } + * if (test_mail_data->attachment_count > 0) { + * if ( (err = email_get_attachment_data_list(mail_id, &test_attachment_data_list, &test_attachment_data_count)) != EMAIL_ERROR_NONE ) { + * printf("email_get_meeting_request() failed [%d]\n", err); + * return -1; + * } + * } * - * if ( test_mail_data->meeting_request_status == EMAIL_MAIL_TYPE_MEETING_REQUEST - * || test_mail_data->meeting_request_status == EMAIL_MAIL_TYPE_MEETING_RESPONSE - * || test_mail_data->meeting_request_status == EMAIL_MAIL_TYPE_MEETING_ORIGINATINGREQUEST) { + * if ( test_mail_data->meeting_request_status == EMAIL_MAIL_TYPE_MEETING_REQUEST + * || test_mail_data->meeting_request_status == EMAIL_MAIL_TYPE_MEETING_RESPONSE + * || test_mail_data->meeting_request_status == EMAIL_MAIL_TYPE_MEETING_ORIGINATINGREQUEST) { * - * if ( (err = email_get_meeting_request(mail_id, &meeting_req)) != EMAIL_ERROR_NONE ) { - * printf("email_get_meeting_request() failed [%d]\n", err); - * return -1; - * } + * if ( (err = email_get_meeting_request(mail_id, &meeting_req)) != EMAIL_ERROR_NONE ) { + * printf("email_get_meeting_request() failed [%d]\n", err); + * return -1; + * } * - * printf("\n > Enter meeting response: "); - * scanf("%d", (int*)&(meeting_req->meeting_response)); - * } + * printf("\n > Enter meeting response: "); + * scanf("%d", (int*)&(meeting_req->meeting_response)); + * } * - * if ( (err = email_update_mail(test_mail_data, test_attachment_data_list, test_attachment_data_count, meeting_req, 0)) != EMAIL_ERROR_NONE) - * printf("email_update_mail failed.[%d]\n", err); - * else - * printf("email_update_mail success\n"); + * if ( (err = email_update_mail(test_mail_data, test_attachment_data_list, test_attachment_data_count, meeting_req, 0)) != EMAIL_ERROR_NONE) + * printf("email_update_mail failed.[%d]\n", err); + * else + * printf("email_update_mail success\n"); * - * if(test_mail_data) - * email_free_mail_data(&test_mail_data, 1); + * if(test_mail_data) + * email_free_mail_data(&test_mail_data, 1); * - * if(test_attachment_data_list) - * email_free_attachment_data(&test_attachment_data_list, test_attachment_data_count); + * if(test_attachment_data_list) + * email_free_attachment_data(&test_attachment_data_list, test_attachment_data_count); * - * if(meeting_req) - * email_free_meeting_request(&meeting_req, 1); + * if(meeting_req) + * email_free_meeting_request(&meeting_req, 1); * - * return 0; + * return 0; * } * @endcode - * @remarks N/A */ EXPORT_API int email_update_mail(email_mail_data_t *input_mail_data, email_attachment_data_t *input_attachment_data_list, int input_attachment_count, email_meeting_request_t* input_meeting_request, int input_from_eas); /** - * @fn email_update_mail_attribute(int input_account_id, int *input_mail_id_array, int input_mail_id_count, email_mail_attribute_type input_attribute_type, email_mail_attribute_value_t input_value) - * @brief This function update individual attribute of mail data. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_account_id Specifies the id of account. - * @param[in] input_mail_id_array Specify the array list if mail id - * @param[in] input_mail_id_count Specify the count of mail id array - * @param[in] input_attribute_type Specify the attribute type which to update - * @param[in] input_value Specify the value of attribute - * @exception none - * @see - * @remarks N/A + * @brief Updates an individual attribute of the mail data. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] input_account_id The ID of account + * @param[in] input_mail_id_array The array list of mail IDs + * @param[in] input_mail_id_count The count of mail ID array + * @param[in] input_attribute_type The attribute type to update + * @param[in] input_value The value of attribute + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_update_mail_attribute(int input_account_id, int *input_mail_id_array, int input_mail_id_count, email_mail_attribute_type input_attribute_type, email_mail_attribute_value_t input_value); /** - * @fn email_count_mail(email_mailbox_t* mailbox, int* total, int* unseen) - * @brief Get mail count from mailbox.This function is invoked when user wants to know how many toatl mails and out of that - * how many unseen mails are there in a given mailbox. + * @brief Gets the mail count. + * @details This function is invoked when a user wants to know how many total mails and out of that + * how many unseen mails are there in a given mailbox. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] mailbox The pointer of mailbox structure + * @param[out] total The total email count + * @param[out] unseen The unread email count + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] mailbox Specifies the pointer of mailbox structure. - * @param[out] total Total email count is saved here. - * @param[out] unseen Unread email count is saved here. - * @exception none - * @see email_mailbox_t - * @code - * #include "email-api-account.h" - * bool - * _api_sample_count_mail() - * { - * int total = 0; - * int unseen = 0; - * email_list_filter_t *filter_list = NULL; - * int err = EMAIL_ERROR_NONE; - * int i = 0; - * filter_list = malloc(sizeof(email_list_filter_t) * 3); - * memset(filter_list, 0 , sizeof(email_list_filter_t) * 3); - * - * filter_list[0].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE; - * filter_list[0].list_filter_item.rule.target_attribute = EMAIL_MAIL_ATTRIBUTE_SUBJECT; - * filter_list[0].list_filter_item.rule.rule_type = EMAIL_LIST_FILTER_RULE_INCLUDE; - * filter_list[0].list_filter_item.rule.key_value.string_type_value = strdup("RE"); - * filter_list[0].list_filter_item.rule.case_sensitivity = false; - * - * filter_list[1].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_OPERATOR; - * filter_list[1].list_filter_item.operator_type = EMAIL_LIST_FILTER_OPERATOR_OR; - * - * filter_list[2].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE; - * filter_list[2].list_filter_item.rule.target_attribute = EMAIL_MAIL_ATTRIBUTE_TO; - * filter_list[2].list_filter_item.rule.rule_type = EMAIL_LIST_FILTER_RULE_INCLUDE; - * filter_list[2].list_filter_item.rule.key_value.string_type_value = strdup("RE"); - * filter_list[2].list_filter_item.rule.case_sensitivity = false; - * - * if(EMAIL_ERROR_NONE == email_count_mail(filter_list, 3, &total, &unseen)) - * printf("\n Total: %d, Unseen: %d \n", total, unseen); - * } + * #include "email-api-account.h" + * bool + * _api_sample_count_mail() + * { + * int total = 0; + * int unseen = 0; + * email_list_filter_t *filter_list = NULL; + * int err = EMAIL_ERROR_NONE; + * int i = 0; + * filter_list = malloc(sizeof(email_list_filter_t) * 3); + * memset(filter_list, 0 , sizeof(email_list_filter_t) * 3); + * + * filter_list[0].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE; + * filter_list[0].list_filter_item.rule.target_attribute = EMAIL_MAIL_ATTRIBUTE_SUBJECT; + * filter_list[0].list_filter_item.rule.rule_type = EMAIL_LIST_FILTER_RULE_INCLUDE; + * filter_list[0].list_filter_item.rule.key_value.string_type_value = strdup("RE"); + * filter_list[0].list_filter_item.rule.case_sensitivity = false; + * + * filter_list[1].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_OPERATOR; + * filter_list[1].list_filter_item.operator_type = EMAIL_LIST_FILTER_OPERATOR_OR; + * + * filter_list[2].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE; + * filter_list[2].list_filter_item.rule.target_attribute = EMAIL_MAIL_ATTRIBUTE_TO; + * filter_list[2].list_filter_item.rule.rule_type = EMAIL_LIST_FILTER_RULE_INCLUDE; + * filter_list[2].list_filter_item.rule.key_value.string_type_value = strdup("RE"); + * filter_list[2].list_filter_item.rule.case_sensitivity = false; + * + * if(EMAIL_ERROR_NONE == email_count_mail(filter_list, 3, &total, &unseen)) + * printf("\n Total: %d, Unseen: %d \n", total, unseen); + * } * @endcode - * @remarks N/A */ EXPORT_API int email_count_mail(email_list_filter_t *input_filter_list, int input_filter_count, int *output_total_mail_count, int *output_unseen_mail_count); /** - * @fn email_get_max_mail_count(int *Count) - * @brief Gets the max count of mails which can be supported by email-service + * @brief Gets the max count of mails which can be supported by email-service. + * + * @param[out] count The max count of mails which can be supported by email-service + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[out] Count max count of mails which can be supported by email-service - * @exception none * @code - * #include "email-api-account.h" - * bool - * _api_sample_get_max_mail_count() - * { - * int max_count = -1; - * - * if(EMAIL_ERROR_NONE == email_get_max_mail_count(&max_count)) - * printf("\n\t>>>>> email_get_max_mail_count() return [%d]\n\n", max_count); - * } + * #include "email-api-account.h" + * bool + * _api_sample_get_max_mail_count() + * { + * int max_count = -1; + * + * if(EMAIL_ERROR_NONE == email_get_max_mail_count(&max_count)) + * printf("\n\t>>>>> email_get_max_mail_count() returns [%d]\n\n", max_count); + * } * @endcode - * @remarks N/A */ EXPORT_API int email_get_max_mail_count(int *count); /** - * @fn email_delete_mail(email_mailbox_t* mailbox, int *mail_ids, int num, int from_server) - * @brief Delete a mail or multiple mails.Based on from_server value this function will delte a mail or multiple mails from server or loaclly. - * @param[in] mailbox Reserved. - * If the incoming_server_type is EMAIL_SERVER_TYPE_POP3 then from_server value will be 0 - * If the incoming_server_type is EMAIL_SERVER_TYPE_IMAP4 then from_server value will be 1/0 - * - * @param[in] mail_ids[] Specifies the array of mail id. - * @param[in] num Specifies the number of mail id. - * @param[in] from_server Specifies whether mails are deleted from server. - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @exception none + * @brief Deletes a mail or multiple mails. + * @details Based on from_server value, this function will delete a mail or multiple mails from the server or locally. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @remarks If the incoming_server_type is #EMAIL_SERVER_TYPE_POP3 then from_server value will be @c 0. \n + * If the incoming_server_type is #EMAIL_SERVER_TYPE_IMAP4 then from_server value will be 1/0. + * + * @param[in] mailbox Reserved + * @param[in] mail_ids[] The array of mail IDs + * @param[in] num The number of mail IDs + * @param[in] from_server The flag that specifies whether mails are deleted from server + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise error code (see #EMAIL_ERROR_XXX) on failure + * * @code - * #include "email-api-account.h" - * bool - * _api_sample_delete_mail() - * { - * int count, i, mail_id=0, mailbox_id =0; - * - * printf("\n > Enter Mail_id: "); - * scanf("%d",&mail_id); - * printf("\n > Enter Mailbox ID: "); - * scanf("%d",&mailbox_id); - * if(EMAIL_ERROR_NONE == email_delete_mail(mailbox_id, &mail_id, 1, 1)) - * printf("\n email_delete_mail success"); - * else - * printf("\n email_delete_mail failed"); - * } + * #include "email-api-account.h" + * bool + * _api_sample_delete_mail() + * { + * int count, i, mail_id=0, mailbox_id =0; + * + * printf("\n > Enter Mail_id: "); + * scanf("%d",&mail_id); + * printf("\n > Enter Mailbox ID: "); + * scanf("%d",&mailbox_id); + * if(EMAIL_ERROR_NONE == email_delete_mail(mailbox_id, &mail_id, 1, 1)) + * printf("\n email_delete_mail success"); + * else + * printf("\n email_delete_mail failed"); + * } * @endcode - * @remarks N/A */ EXPORT_API int email_delete_mail(int input_mailbox_id, int *input_mail_ids, int input_num, int input_from_server); /** - * @fn email_delete_all_mails_in_mailbox(int input_mailbox_id, int input_from_server) - * @brief Delete all mail from a mailbox. - * If the incoming_server_type is EMAIL_SERVER_TYPE_POP3 then from_server value will be 0 - * If the incoming_server_type is EMAIL_SERVER_TYPE_IMAP4 then from_server value will be 1/0 + * @brief Deletes all mails from a mailbox. + * @details If the incoming_server_type is #EMAIL_SERVER_TYPE_POP3 then @a from_server value will be @c 0. \n + * If the incoming_server_type is #EMAIL_SERVER_TYPE_IMAP4 then @a from_server value will be 1/0. * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] mailbox Specifies the structure of mailbox. - * @param[in] from_server Specifies whether mails are also deleted from server. - * @exception none - * @see email_mailbox_t - + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] mailbox The structure of mailbox + * @param[in] from_server The flag that specifies whether mails are also deleted from server + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t + * @code - * #include "email-api-account.h" - * bool - * _api_sample_delete_all_mails_in_mailbox() - * { - * int count, mailbox_id =0; - * - * printf("\n > Enter mailbox_id: "); - * scanf("%d",&mailbox_id); - * - * if (EMAIL_ERROR_NONE != email_delete_all_mails_in_mailbox(mailbox_id, 0)) - * printf("email_delete_all_mails_in_mailbox failed"); - * else - * printf("email_delete_all_mails_in_mailbox Success"); - * } + * #include "email-api-account.h" + * bool + * _api_sample_delete_all_mails_in_mailbox() + * { + * int count, mailbox_id =0; + * + * printf("\n > Enter mailbox_id: "); + * scanf("%d",&mailbox_id); + * + * if (EMAIL_ERROR_NONE != email_delete_all_mails_in_mailbox(mailbox_id, 0)) + * printf("email_delete_all_mails_in_mailbox failed"); + * else + * printf("email_delete_all_mails_in_mailbox Success"); + * } * @endcode - * @remarks N/A */ EXPORT_API int email_delete_all_mails_in_mailbox(int input_mailbox_id, int input_from_server); /** - * @fn email_clear_mail_data() - * @brief delete email data from storage. This API will be used by the Settings Application + * @brief Deletes email data from the storage. + * @details This API will be used by Settings Application. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @exception none - * @see none - * @code - * #include "email-api-account.h" - * bool - * _api_sample_clear_mail_data() - * { - * if(EMAIL_ERROR_NONE == email_clear_mail_data()) - * //success - * else - * //failure - * - * } + * #include "email-api-account.h" + * bool + * _api_sample_clear_mail_data() + * { + * if(EMAIL_ERROR_NONE == email_clear_mail_data()) + * //success + * else + * //failure + * } * @endcode - * @remarks N/A */ EXPORT_API int email_clear_mail_data(); /** - * @fn email_add_attachment(int mail_id, email_attachment_data_t* attachment) - * @brief Append a attachment to email.This function is invoked when user wants to add attachment to existing mail. + * @brief Appends an attachment to an email. + * @details This function is invoked when a user wants to add attachment to an existing mail. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] mail_id The mail ID + * @param[in] attachment The structure of attachment + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_attachment_data_t * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] mail_id Specifies the mail ID. - * @param[in] attachment Specifies the structure of attachment. - * @exception none - * @see email_attachment_data_t - * @code - * #include "email-api-account.h" - * bool - * _api_sample_mail_add_attachment() - * { - * int mail_id = 0; - * email_attachment_data_t attachment; - * - * printf("\n > Enter Mail Id: "); - * scanf("%d", &mail_id); - * memset(&attachment, 0x00, sizeof(email_attachment_data_t)); - * printf("\n > Enter attachment name: "); - * attachment.name = strdup("Test"); - * printf("\n > Enter attachment absolute path: "); - * attachment.savename = strdup("/tmp/test.txt"); - * attachment.next = NULL; - * if(EMAIL_ERROR_NONE != email_add_attachment(mail_id, &attachment)) - * printf("email_add_attachment failed\n"); - * else - * printf(email_add_attachment success\n"); - * } + * #include "email-api-account.h" + * bool + * _api_sample_mail_add_attachment() + * { + * int mail_id = 0; + * email_attachment_data_t attachment; + * + * printf("\n > Enter Mail Id: "); + * scanf("%d", &mail_id); + * memset(&attachment, 0x00, sizeof(email_attachment_data_t)); + * printf("\n > Enter attachment name: "); + * attachment.name = strdup("Test"); + * printf("\n > Enter attachment absolute path: "); + * attachment.savename = strdup("/tmp/test.txt"); + * attachment.next = NULL; + * if(EMAIL_ERROR_NONE != email_add_attachment(mail_id, &attachment)) + * printf("email_add_attachment failed\n"); + * else + * printf(email_add_attachment success\n"); + * } * @endcode - * @remarks N/A */ EXPORT_API int email_add_attachment(int mail_id, email_attachment_data_t* attachment); /** - * @fn email_delete_attachment(int mail_id, const char * attachment_id) - * @brief delete a attachment from email.This function is invoked when user wants to delete a attachment from existing mailbased on mail Id and attachment Id - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] mail_id Specifies the mail ID. - * @param[in] attachment_id Specifies the attachment id. - * @exception none - * @see email_mailbox_t + * @brief Deletes an attachment from email. + * @details This function is invoked when a user wants to delete a attachment from an existing mail based on mail ID and attachment ID. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] mail_id The mail ID + * @param[in] attachment_id The attachment ID + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t + * * @code - * #include "email-api-account.h" - * bool - * _api_sample_mail_delete_attachment() - * { - * - * if(EMAIL_ERROR_NONE != email_delete_attachment(1)) - * //failure - * else - * //success - * } + * #include "email-api-account.h" + * bool + * _api_sample_mail_delete_attachment() + * { + * + * if(EMAIL_ERROR_NONE != email_delete_attachment(1)) + * //failure + * else + * //success + * } * @endcode - * @remarks N/A */ EXPORT_API int email_delete_attachment(int attachment_id); /** - * @fn email_get_attachment_data(int mail_id, const char* attachment_id, email_attachment_data_t** attachment) - * @brief Get a mail attachment.This function is invoked when user wants to get the attachment information based on attachment id for the specified mail Id. + * @brief Gets a mail attachment. + * @details This function is invoked when a user wants to get the attachment information based on an attachment ID for the specified mail ID. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] mail_id The mail ID + * @param[in] attachment_id The buffer that an attachment ID is saved + * @param[out] attachment The returned attachment + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t and #email_mail_attachment_info_t * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] mail_id Specifies the mail ID. - * @param[in] attachment_id Specifies the buffer that a attachment ID been saved. - * @param[out] attachment The returned attachment is save here. - * @exception none - * @see email_mailbox_t and email_mail_attachment_info_t - * @code - * #include "email-api-account.h" - * bool - * _api_sample_mail_get_attachment_info() - * { - * email_mail_attachment_info_t *mail_attach_info = NULL; - * int mail_id = 0; - * char arg[10]; - * int err = EMAIL_ERROR_NONE; - * - * - * printf("\n > Enter Mail Id: "); - * scanf("%d", &mail_id); - * printf("> attachment Id\n"); - * scanf("%s",arg); - * if (EMAIL_ERROR_NONE != email_get_attachment_data(mail_id, &mail_attach_info)) - * printf("email_get_attachment_data failed\n"); - * else - * { - * printf("email_get_attachment_data SUCCESS\n"); - * //do something - * email_free_attachment_data(&mail_attach_info,1); - * } - * } + * #include "email-api-account.h" + * bool + * _api_sample_mail_get_attachment_info() + * { + * email_mail_attachment_info_t *mail_attach_info = NULL; + * int mail_id = 0; + * char arg[10]; + * int err = EMAIL_ERROR_NONE; + * + * + * printf("\n > Enter Mail Id: "); + * scanf("%d", &mail_id); + * printf("> attachment Id\n"); + * scanf("%s",arg); + * if (EMAIL_ERROR_NONE != email_get_attachment_data(mail_id, &mail_attach_info)) + * printf("email_get_attachment_data failed\n"); + * else + * { + * printf("email_get_attachment_data SUCCESS\n"); + * //do something + * email_free_attachment_data(&mail_attach_info,1); + * } + * } * @endcode - * @remarks N/A */ EXPORT_API int email_get_attachment_data(int attachment_id, email_attachment_data_t** attachment); /** - * @fn email_get_attachment_data_list(int input_mail_id, email_attachment_data_t **output_attachment_data, int *output_attachment_count) - * @brief Get a list of mail attachment.This function is invoked when user wants to get the information of attachment list based on mail id. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_mail_id Specifies the mail ID. - * @param[out] output_attachment_data The returned attachment list is save here. - * @param[out] output_attachment_count The returned count of attachment list. - * @exception none - * @see email_attachment_data_t - * @remarks N/A + * @brief Gets a list of mail attachments. + * @details This function is invoked when a user wants to get the the attachment list information based on the mail ID. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] input_mail_id The mail ID + * @param[out] output_attachment_data The returned attachment list is save here + * @param[out] output_attachment_count The returned count of attachment list + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_attachment_data_t */ EXPORT_API int email_get_attachment_data_list(int input_mail_id, email_attachment_data_t **output_attachment_data, int *output_attachment_count); /** - * @fn email_free_attachment_data(email_attachment_data_t **attachment_data_list, int attachment_data_count) - * @brief Free allocated memroy for email attachment. + * @brief Frees the allocated memory for email attachments. + * + * @since_tizen 2.3 + * + * @param[in] atch_info The pointer of mail attachment structure pointer + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mail_attachment_info_t * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] atch_info Specifies the pointer of mail attachment structure pointer. - * @exception none - * @see email_mail_attachment_info_t - * @code - * #include "email-api-account.h" - * bool - * _api_sample_mail_free_attachment_info() - * { - * email_mailbox_t mailbox; - * email_mail_attachment_info_t *mail_attach_info = NULL; - * int mail_id = 0,account_id = 0; - * char arg[10]; - * int err = EMAIL_ERROR_NONE; - * - * memset(&mailbox, 0x00, sizeof(email_mailbox_t)); - * - * printf("\n > Enter Mail Id: "); - * scanf("%d", &mail_id); - * printf("\n > Enter account Id: "); - * scanf("%d", &account_id); - * printf("> attachment Id\n"); - * scanf("%s",arg); - * mailbox.account_id = account_id; - * if (EMAIL_ERROR_NONE != email_get_attachment_data(&mailbox, mail_id, &mail_attach_info)) - * printf("email_get_attachment_data failed\n"); - * else - * { - * printf("email_get_attachment_data SUCCESS\n"); - * //do something - * email_free_attachment_info(&mail_attach_info,1); - * } - * } + * #include "email-api-account.h" + * bool + * _api_sample_mail_free_attachment_info() + * { + * email_mailbox_t mailbox; + * email_mail_attachment_info_t *mail_attach_info = NULL; + * int mail_id = 0,account_id = 0; + * char arg[10]; + * int err = EMAIL_ERROR_NONE; + * + * memset(&mailbox, 0x00, sizeof(email_mailbox_t)); + * + * printf("\n > Enter Mail Id: "); + * scanf("%d", &mail_id); + * printf("\n > Enter account Id: "); + * scanf("%d", &account_id); + * printf("> attachment Id\n"); + * scanf("%s",arg); + * mailbox.account_id = account_id; + * if (EMAIL_ERROR_NONE != email_get_attachment_data(&mailbox, mail_id, &mail_attach_info)) + * printf("email_get_attachment_data failed\n"); + * else + * { + * printf("email_get_attachment_data SUCCESS\n"); + * //do something + * email_free_attachment_info(&mail_attach_info,1); + * } + * } * @endcode - * @remarks N/A */ EXPORT_API int email_free_attachment_data(email_attachment_data_t **attachment_data_list, int attachment_data_count); /*----------------------------------------------------------- - Mail Information API + Mail Information API -----------------------------------------------------------*/ /** - * @fn email_query_mails(char *conditional_clause_string, email_mail_data_t** mail_list, int *result_count) - * @brief Query the mail list information from DB based on the mailbox name. + * @brief Queries the mail list information from the DB based on the mailbox name. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] conditional_clause_string The where clause string + * @param[in/out] mail_list The pointer to the structure #email_mail_data_t + * @param[in/out] result_count The number of mails returned + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mail_list_item_t * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] conditional_clause_string Specifies the where clause string. - * @param[in/out] mail_list Specifies the pointer to the structure email_mail_data_t. - * @param[in/out] result_count Specifies the number of mails returned. - * @exception None - * @see email_mail_list_item_t - * @code - * #include "email-api-account.h" - * bool - * _api_sample_query_mail() - * { - * email_mail_data_t *mail_list = NULL; - * char conditional_clause_string[500]; - * int result_count = 0; - * - * memset(conditional_clause_string, 0x00, 10); - * printf("\n > Enter where clause: "); - * scanf("%s", conditional_clause_string); - * - * - * if (EMAIL_ERROR_NONE != email_query_mails(conditional_clause_string, &mail_list, &result_count)) - * printf("email_query_mails failed \n"); - * else { - * printf("Success\n"); - * //do something - * free(mail_list); - * } - * - * } + * #include "email-api-account.h" + * bool + * _api_sample_query_mail() + * { + * email_mail_data_t *mail_list = NULL; + * char conditional_clause_string[500]; + * int result_count = 0; + * + * memset(conditional_clause_string, 0x00, 10); + * printf("\n > Enter where clause: "); + * scanf("%s", conditional_clause_string); + * + * + * if (EMAIL_ERROR_NONE != email_query_mails(conditional_clause_string, &mail_list, &result_count)) + * printf("email_query_mails failed \n"); + * else { + * printf("Success\n"); + * //do something + * free(mail_list); + * } + * + * } * @endcode - * @remarks N/A */ EXPORT_API int email_query_mails(char *conditional_clause_string, email_mail_data_t** mail_list, int *result_count); /** - * @fn email_query_mail_list(char *input_conditional_clause_string, email_mail_list_item_t** output_mail_list, int *output_result_count) - * @brief Query the mail list information from DB. + * @brief Queries the mail list information from the DB. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] input_conditional_clause_string The where clause string + * @param[in/out] output_mail_list The pointer to the structure #email_mail_list_item_t + * @param[in/out] output_result_count The number of mails returned + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mail_list_item_t * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_conditional_clause_string Specifies the where clause string. - * @param[in/out] output_mail_list Specifies the pointer to the structure email_mail_list_item_t. - * @param[in/out] output_result_count Specifies the number of mails returned. - * @exception None - * @see email_mail_list_item_t - * @code - * #include "email-api-account.h" - * bool - * _api_sample_query_mail_list() - * { - * email_mail_list_item_t *mail_list = NULL; - * char conditional_clause_string[500]; - * int result_count = 0; - * - * memset(conditional_clause_string, 0x00, 10); - * printf("\n > Enter where clause: "); - * scanf("%s", conditional_clause_string); - * - * - * if (EMAIL_ERROR_NONE != email_query_mail_list(conditional_clause_string, &mail_list, &result_count)) - * printf("email_query_mail_list failed \n"); - * else { - * printf("Success\n"); - * //do something - * free(mail_list); - * } - * - * } + * #include "email-api-account.h" + * bool + * _api_sample_query_mail_list() + * { + * email_mail_list_item_t *mail_list = NULL; + * char conditional_clause_string[500]; + * int result_count = 0; + * + * memset(conditional_clause_string, 0x00, 10); + * printf("\n > Enter where clause: "); + * scanf("%s", conditional_clause_string); + * + * + * if (EMAIL_ERROR_NONE != email_query_mail_list(conditional_clause_string, &mail_list, &result_count)) + * printf("email_query_mail_list failed \n"); + * else { + * printf("Success\n"); + * //do something + * free(mail_list); + * } + * + * } * @endcode - * @remarks N/A */ EXPORT_API int email_query_mail_list(char *input_conditional_clause_string, email_mail_list_item_t** output_mail_list, int *output_result_count); /** - * @fn email_get_mail_data(int input_mail_id, email_mail_data_t **output_mail_data) - * @brief Get a mail by its mail id. This function is invoked when user wants to get a mail based on mail id existing in DB. + * @brief Gets a mail by its mail ID. + * @details This function is invoked when a user wants to get a mail based on mail ID existing in the DB. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] input_mail_id The mail ID + * @param[out] output_mail_data The returned mail is save here + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mail_data_t * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_mail_id specifies the mail id. - * @param[out] output_mail_data The returned mail is save here. - * @exception none - * @see email_mail_data_t - * @code * #include "email-api-account.h" - * bool - * _api_sample_get_mail_data() - * { - * email_mail_data_t *mail = NULL; - * int mail_id = 0 ; - * int err = EMAIL_ERROR_NONE; - * - * printf("\n > Enter mail id: "); - * scanf("%d", &mail_id); - * - * if (EMAIL_ERROR_NONE != email_get_mail_data(mail_id, &mail)) - * printf("email_get_mail_data failed\n"); - * else - * { - * printf("email_get_mail_data SUCCESS\n"); - * //do something - * email_free_mail_data(&mail,1); - * } - * } + * bool + * _api_sample_get_mail_data() + * { + * email_mail_data_t *mail = NULL; + * int mail_id = 0 ; + * int err = EMAIL_ERROR_NONE; + * + * printf("\n > Enter mail id: "); + * scanf("%d", &mail_id); + * + * if (EMAIL_ERROR_NONE != email_get_mail_data(mail_id, &mail)) + * printf("email_get_mail_data failed\n"); + * else + * { + * printf("email_get_mail_data SUCCESS\n"); + * //do something + * email_free_mail_data(&mail,1); + * } + * } * @endcode - * @remarks N/A */ EXPORT_API int email_get_mail_data(int input_mail_id, email_mail_data_t **output_mail_data); /** - * @fn email_free_mail_data(email_mail_data_t** mail_list, int count) - * @brief Free allocated memroy for emails. + * @brief Frees the allocated memory for emails. + * + * @since_tizen 2.3 + * + * @param[in] mail_list The pointer of mail structure pointer + * @param[in] count The count of mails + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mail_data_t * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] mail_list Specifies the pointer of mail structure pointer. - * @param[in] count Specifies the count of mails. - * @exception none - * @see email_mail_data_t - * @code - * #include "email-api-account.h" - * bool - * _api_sample_free_mail() - * { - * email_mail_data_t *mail; - * - * //fill the mail structure - * //count - number of mail structure user want to free - * if(EMAIL_ERROR_NONE == email_free_mail_data(&mail,count)) - * //success - * else - * //failure - * - * } + * #include "email-api-account.h" + * bool + * _api_sample_free_mail() + * { + * email_mail_data_t *mail; + * + * //fill the mail structure + * //count - number of mail structure a user want to free + * if(EMAIL_ERROR_NONE == email_free_mail_data(&mail,count)) + * //success + * else + * //failure + * + * } * @endcode - * @remarks N/A */ EXPORT_API int email_free_mail_data(email_mail_data_t** mail_list, int count); /*----------------------------------------------------------- - Mail Flag API + Mail Flag API -----------------------------------------------------------*/ /** - * @fn email_set_flags_field(int *mail_ids, int num, email_flags_field_type field_type, int value, int onserver) - * @brief Change email flags field. - * If the incoming_server_type is EMAIL_SERVER_TYPE_POP3 then from_server value will be 0 - * If the incoming_server_type is EMAIL_SERVER_TYPE_IMAP4 then from_server value will be 1/0 - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] account_id Specifies account ID. - * @param[in] mail_ids Specifies the array of mail ID. - * @param[in] num Specifies the number of mail ID. - * @param[in] field_type Specifies the field type what you want to set. Refer email_flags_field_type. - * @param[in] value Specifies the value what you want to set. - * @param[in] onserver Specifies whether mail Flag updation in server - * @exception none - * @see none + * @brief Changes an email flags field. + * @details If the incoming_server_type is EMAIL_SERVER_TYPE_POP3 then from_server value will be 0. \n + * If the incoming_server_type is EMAIL_SERVER_TYPE_IMAP4 then from_server value will be 1/0. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] account_id The account ID + * @param[in] mail_ids The array of mail IDs + * @param[in] num The number of mail IDs + * @param[in] field_type The field type to be set \n + * See #email_flags_field_type. + * @param[in] value The value to be set + * @param[in] onserver The flag indicating whether mail flag updating is in server + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * * @code - * #include "email-api-account.h" - * bool - * _api_sample_set_flags_field() - * { - * int account_id = 0; - * int mail_id = 0; - * int err = EMAIL_ERROR_NONE; - * - * printf("\n > Enter account id: "); - * scanf("%d", &account_id); - * - * printf("\n > Enter mail id: "); - * scanf("%d", &mail_id); - * if (EMAIL_ERROR_NONE != email_set_flags_field(&account_id, &mail_id, EMAIL_FLAGS_SEEN_FIELD, 1, 0)) - * printf("email_set_flags_field failed\n"); - * else - * { - * printf("email_set_flags_field succeed\n"); - * //do something - * } - * } + * #include "email-api-account.h" + * bool + * _api_sample_set_flags_field() + * { + * int account_id = 0; + * int mail_id = 0; + * int err = EMAIL_ERROR_NONE; + * + * printf("\n > Enter account id: "); + * scanf("%d", &account_id); + * + * printf("\n > Enter mail id: "); + * scanf("%d", &mail_id); + * if (EMAIL_ERROR_NONE != email_set_flags_field(&account_id, &mail_id, EMAIL_FLAGS_SEEN_FIELD, 1, 0)) + * printf("email_set_flags_field failed\n"); + * else + * { + * printf("email_set_flags_field succeed\n"); + * //do something + * } + * } * @endcode - * @remarks N/A */ EXPORT_API int email_set_flags_field(int account_id, int *mail_ids, int num, email_flags_field_type field_type, int value, int onserver); /* ----------------------------------------------------------- - Mail Move API + Mail Move API -----------------------------------------------------------*/ /** - * @fn email_move_mail_to_mailbox(int *mail_ids, int num, int input_target_mailbox_id) - * @brief Move a email to another mailbox. + * @brief Moves an email to another mailbox. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] mail_id The array of mail ID + * @param[in] num The count of mail IDs + * @param[in] input_target_mailbox_id The mailbox ID for moving email + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] mail_id Specifies the array of mail ID. - * @param[in] num Specifies the count of mail IDs. - * @param[in] input_target_mailbox_id Specifies the mailbox ID for moving email. - * @exception none - * @see email_mailbox_t - * @code - * #include "email-api-account.h" - * bool - * _api_sample_move_mail_to_mailbox() - * { - * int mail_id = 0; + * #include "email-api-account.h" + * bool + * _api_sample_move_mail_to_mailbox() + * { + * int mail_id = 0; * int mailbox_id = 0; - * int err = EMAIL_ERROR_NONE; + * int err = EMAIL_ERROR_NONE; - * printf("\n > Enter mail_id: "); - * scanf("%d",&mail_id); + * printf("\n > Enter mail_id: "); + * scanf("%d",&mail_id); * - * printf("\n > Enter target mailbox_id: "); - * scanf("%d",&mailbox_id); + * printf("\n > Enter target mailbox_id: "); + * scanf("%d",&mailbox_id); * - * if(EMAIL_ERROR_NONE == email_move_mail_to_mailbox(&mail_id, 1, mailbox_id)) - * printf("Success\n"); + * if(EMAIL_ERROR_NONE == email_move_mail_to_mailbox(&mail_id, 1, mailbox_id)) + * printf("Success\n"); * - * } + * } * @endcode - * @remarks N/A */ EXPORT_API int email_move_mail_to_mailbox(int *mail_ids, int num, int input_target_mailbox_id); /** - * @fn email_move_all_mails_to_mailbox(int input_source_mailbox_id, int input_target_mailbox_id) - * @brief Move all email to another mailbox. + * @brief Moves all emails to another mailbox. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] input_source_mailbox_id The source mailbox ID for moving email + * @param[in] input_target_mailbox_id The destination mailbox ID for moving email + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_source_mailbox_id Specifies the source mailbox ID for moving email. - * @param[in] input_target_mailbox_id Specifies the destination mailbox ID for moving email. - * @exception none - * @see email_mailbox_t - * @code - * #include "email-api-account.h" - * bool - * _api_sample_move_all_mails_to_mailbox() - * { - * int src_mailbox_id; - * int dst_mailbox_id; - * int total_count; - * int err = EMAIL_ERROR_NONE; - * char temp[128]; - * - * - * // input mailbox information : need account_id and name (src & dest) - * printf("src mail maibox id> "); - * scanf("%d", &src_mailbox_id); - * - * // Destination mailbox - * printf("dest mailbox id> "); - * scanf("%d", &dst_mailbox_id); - * - * if( EMAIL_ERROR_NONE == email_move_all_mails_to_mailbox(src_mailbox_id, dst_mailbox_id)) - * { - * printf(" fail email_move_all_mails_to_mailbox: \n"); - * } - * else - * //success + * #include "email-api-account.h" + * bool + * _api_sample_move_all_mails_to_mailbox() + * { + * int src_mailbox_id; + * int dst_mailbox_id; + * int total_count; + * int err = EMAIL_ERROR_NONE; + * char temp[128]; + * + * + * // input mailbox information : need account_id and name (src & dest) + * printf("src mail maibox id> "); + * scanf("%d", &src_mailbox_id); + * + * // Destination mailbox + * printf("dest mailbox id> "); + * scanf("%d", &dst_mailbox_id); + * + * if( EMAIL_ERROR_NONE == email_move_all_mails_to_mailbox(src_mailbox_id, dst_mailbox_id)) + * { + * printf(" fail email_move_all_mails_to_mailbox: \n"); + * } + * else + * //success * } * @endcode - * @remarks N/A */ EXPORT_API int email_move_all_mails_to_mailbox(int input_source_mailbox_id, int input_target_mailbox_id); /** - * @fn email_move_mails_to_mailbox_of_another_account(int input_source_mailbox_id, int *mail_id_array, int mail_id_count, int input_target_mailbox_id, int *output_task_id) - * @brief Move mails to a mailbox of another account. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_source_mailbox_id Specifies the source mailbox ID for moving email. - * @param[in] mail_id_array Specifies the source mail id array for moving email. - * @param[in] mail_id_count Specifies the count of source mail for moving email. - * @param[in] input_target_mailbox_id Specifies the destination mailbox ID for moving email. - * @param[out] output_task_id Specifies the task id for handling the task. - * @exception none - * @remarks N/A + * @brief Moves mails to the mailbox of an another account. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] input_source_mailbox_id The source mailbox ID for moving email + * @param[in] mail_id_array The source mail ID array for moving email + * @param[in] mail_id_count The count of source mail for moving email + * @param[in] input_target_mailbox_id The destination mailbox ID for moving email + * @param[out] output_task_id The Task ID for handling the task + * + * @return #EMAIL_ERROR_NONE on success, + * or an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_move_mails_to_mailbox_of_another_account(int input_source_mailbox_id, int *mail_id_array, int mail_id_count, int input_target_mailbox_id, int *output_task_id); /** - * @fn email_get_mail_list_ex(email_list_filter_t *input_filter_list, int input_filter_count, email_list_sorting_rule_t *input_sorting_rule_list, int input_sorting_rule_count, int input_start_index, int input_limit_count, email_mail_list_item_t** output_mail_list, int *output_result_count) - * @brief Get the Mail List information from DB. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_filter_list Specifies the filter list - * @param[in] input_filter_count Specifies the number of filter - * @param[in] input_sorting_rule_list Specifies the sorting rule list. - * @param[in] input_sorting_rule_count Specifies the number of sorting rule - * @param[in] input_start_index Specifies start index for LIMIT clause of SQL query. - * @param[in] input_limit_count Specifies limit count for LIMIT clause of SQL query. - * @param[in/out] output_mail_list Specifies the pointer to the structure email_mail_list_item_t. - * @param[in/out] output_result_count Specifies the number of mails returned. - * @exception none - * @see email_mail_list_item_t + * @brief Gets the Mail List information from the DB. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] input_filter_list The filter list + * @param[in] input_filter_count The number of filter + * @param[in] input_sorting_rule_list The sorting rule list + * @param[in] input_sorting_rule_count The number of sorting rule + * @param[in] input_start_index The start index for LIMIT clause of SQL query + * @param[in] input_limit_count The limit count for LIMIT clause of SQL query + * @param[in/out] output_mail_list The pointer to the structure #email_mail_list_item_t + * @param[in/out] output_result_count The number of mails returned + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mail_list_item_t + * * @code * email_list_filter_t *filter_list = NULL; * email_list_sorting_rule_t *sorting_rule_list = NULL; @@ -1015,482 +1102,543 @@ EXPORT_API int email_move_mails_to_mailbox_of_another_account(int input_source_m * * return FALSE; * @endcode - * @remarks N/A */ EXPORT_API int email_get_mail_list_ex(email_list_filter_t *input_filter_list, int input_filter_count, email_list_sorting_rule_t *input_sorting_rule_list, int input_sorting_rule_count, int input_start_index, int input_limit_count, email_mail_list_item_t** output_mail_list, int *output_result_count); /** - * @fn email_free_list_filter(email_list_filter_t **input_filter_list, int input_filter_count) - * @brief Free allocated memroy for filers. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_filter_list Specifies the pointer of filter structure. - * @param[in] input_filter_count Specifies the count of filter. - * @exception none - * @see email_list_filter_t - * @remarks N/A + * @brief Frees the allocated memory for filters. + * + * @since_tizen 2.3 + * @privlevel N/P + * + * @param[in] input_filter_list The pointer of filter structure + * @param[in] input_filter_count The count of filter + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_list_filter_t */ EXPORT_API int email_free_list_filter(email_list_filter_t **input_filter_list, int input_filter_count); /** - * @fn email_get_mails(int account_id , int mailbox_id, int thread_id, int start_index, int limit_count, email_sort_type_t sorting, email_mail_data_t** mail_list, int* result_count) - * @brief Get the Mail List information from DB based on the mailbox name. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] account_id Specifies the account ID - * @param[in] mailbox_id Specifies the mailbox id - * @param[in] thread_id Specifies the thread id. It can be EMAIL_LIST_TYPE_THREAD, EMAIL_LIST_TYPE_NORMAL or thread id. - * @param[in] start_index Specifies start index for LIMIT clause of SQL query. - * @param[in] limit_count Specifies limit count for LIMIT clause of SQL query. - * @param[in] sorting Specifies the sorting type. - * @param[in/out] mail_list Specifies the pointer to the structure email_mail_data_t. - * @param[in/out] result_count Specifies the number of mails returned. - * @exception none - * @see email_mail_data_t - + * @brief Gets the Mail List information from the DB based on the mailbox name. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] account_id The account ID + * @param[in] mailbox_id The mailbox ID + * @param[in] thread_id The thread ID \n + * It can be #EMAIL_LIST_TYPE_THREAD, #EMAIL_LIST_TYPE_NORMAL or thread ID. + * @param[in] start_index The start index for LIMIT clause of SQL query + * @param[in] limit_count The limit count for LIMIT clause of SQL query + * @param[in] sorting The sorting type + * @param[in/out] mail_list The pointer to the structure #email_mail_data_t + * @param[in/out] result_count The number of mails returned + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mail_data_t + * * @code - * #include "email-api-account.h" - * bool - * _api_sample_get_mail() - * { - * email_mail_data_t *mail_list = NULL; - * int mailbox_id; - * int result_count = 0; - * int account_id = 0; - * int err_code = EMAIL_ERROR_NONE; - * - * printf("\n > Enter Mailbox id: "); - * scanf("%d", mailbox_id); - * - * printf("\n > Enter Account_id: "); - * scanf("%d",&account_id); - * - * if (EMAIL_ERROR_NONE != email_get_mails(account_id, mailbox_id, EMAIL_LIST_TYPE_NORMAL, 0, 100, EMAIL_SORT_DATETIME_HIGH, &mail_list, &result_count)) { - * printf("email_get_mails failed \n"); - * } - * else { - * printf("Success\n"); - * //do something - * free(mail_list); - * } - * - * } + * #include "email-api-account.h" + * bool + * _api_sample_get_mail() + * { + * email_mail_data_t *mail_list = NULL; + * int mailbox_id; + * int result_count = 0; + * int account_id = 0; + * int err_code = EMAIL_ERROR_NONE; + * + * printf("\n > Enter Mailbox id: "); + * scanf("%d", mailbox_id); + * + * printf("\n > Enter Account_id: "); + * scanf("%d",&account_id); + * + * if (EMAIL_ERROR_NONE != email_get_mails(account_id, mailbox_id, EMAIL_LIST_TYPE_NORMAL, 0, 100, EMAIL_SORT_DATETIME_HIGH, &mail_list, &result_count)) { + * printf("email_get_mails failed \n"); + * } + * else { + * printf("Success\n"); + * //do something + * free(mail_list); + * } + * + * } * @endcode - * @remarks N/A */ EXPORT_API int email_get_mails(int account_id , int mailbox_id, int thread_id, int start_index, int limit_count, email_sort_type_t sorting, email_mail_data_t** mail_list, int* result_count); /** - * @fn email_get_mail_list(int account_id, int mailbox_id, int thread_id, int start_index, int limit_count, email_sort_type_t sorting, email_mail_list_item_t** mail_list, int* result_count) - * @brief Get the Mail List information from DB based on the mailbox name. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] account_id Specifies the account id - * @param[in] mailbox_id Specifies the mailbox id - * @param[in] thread_id Specifies the thread id. It can be EMAIL_LIST_TYPE_THREAD, EMAIL_LIST_TYPE_NORMAL or thread id. - * @param[in] start_index Specifies start index for LIMIT clause of SQL query. - * @param[in] limit_count Specifies limit count for LIMIT clause of SQL query. - * @param[in] sorting Specifies the sorting type. - * @param[in/out] mail_list Specifies the pointer to the structure email_mail_list_item_t. - * @param[in/out] result_count Specifies the number of mails returned. - * @exception none - * @see email_mail_list_item_t - + * @brief Gets the Mail List information from the DB based on the mailbox name. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] account_id The account ID + * @param[in] mailbox_id The mailbox ID + * @param[in] thread_id The thread ID \n + * It can be #EMAIL_LIST_TYPE_THREAD, #EMAIL_LIST_TYPE_NORMAL or thread ID. + * @param[in] start_index The start index for LIMIT clause of SQL query + * @param[in] limit_count The limit count for LIMIT clause of SQL query + * @param[in] sorting The sorting type + * @param[in/out] mail_list The pointer to the structure #email_mail_list_item_t + * @param[in/out] result_count The number of mails returned + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mail_list_item_t + * * @code - * #include "email-api-account.h" - * bool - * _api_sample_get_mail() - * { - * email_mail_list_item_t *mail_list = NULL; - * int mailbox_id; - * int result_count = 0; - * int account_id = 0; - * int err_code = EMAIL_ERROR_NONE; - * - * printf("\n > Enter Mailbox id: "); - * scanf("%d", mailbox_id); - * - * printf("\n > Enter Account_id: "); - * scanf("%d",&account_id); - * - * if (EMAIL_ERROR_NONE != email_get_mail_list(account_id, mailbox_id, EMAIL_LIST_TYPE_NORMAL, 0, 100, EMAIL_SORT_DATETIME_HIGH, &mail_list, &result_count)) - * { - * printf("email_get_mail_list_ex failed \n"); - * } - * else - * { - * printf("Success\n"); - * //do something - * free(mail_list); - * } - * - * } + * #include "email-api-account.h" + * bool + * _api_sample_get_mail() + * { + * email_mail_list_item_t *mail_list = NULL; + * int mailbox_id; + * int result_count = 0; + * int account_id = 0; + * int err_code = EMAIL_ERROR_NONE; + * + * printf("\n > Enter Mailbox id: "); + * scanf("%d", mailbox_id); + * + * printf("\n > Enter Account_id: "); + * scanf("%d",&account_id); + * + * if (EMAIL_ERROR_NONE != email_get_mail_list(account_id, mailbox_id, EMAIL_LIST_TYPE_NORMAL, 0, 100, EMAIL_SORT_DATETIME_HIGH, &mail_list, &result_count)) + * { + * printf("email_get_mail_list_ex failed \n"); + * } + * else + * { + * printf("Success\n"); + * //do something + * free(mail_list); + * } + * + * } * @endcode - * @remarks N/A */ EXPORT_API int email_get_mail_list(int account_id, int mailbox_id, int thread_id, int start_index, int limit_count, email_sort_type_t sorting, email_mail_list_item_t** mail_list, int* result_count); /** - * @fn email_get_mail_by_address(int account_id, int mailbox_id, email_email_address_list_t* addr_list, - int start_index, int limit_count, email_sort_type_t sorting, email_mail_list_item_t** mail_list, int* result_count) - * @brief Get the Mail List information from the DB based on the mailbox name account_id and sender address. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] account_id Specifies the Account ID - * @param[in] mailbox_id Specifies the Mailbox ID - * @param[in] addr_list Specifies the addresses of senders. see email_email_address_list_t - * @param[in] start_index Specifies the first mail index of searched mail. This function will return mails whose index in the result list are from start_index to start_index + limit_count - * @param[in] limit_count Specifies the max number of returned mails. - * @param[in] search_type Specifies the search type. - * @param[in] search_value Specifies the search value. - * @param[in] sorting Specifies the sorting order. see email_sort_type_t - * @param[in/out] mail_list Specifies the Pointer to the structure email_mail_list_item_t. - * @param[in/out] result_count Specifies the Number of searched Mails - * @exception none - * @see email_email_address_list_t, email_sort_type_t, email_mail_list_item_t - * @code - * @endcode - * @remarks N/A + * @brief Gets the Mail List information from the DB based on the mailbox name account_id and sender addresses. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] account_id The Account ID + * @param[in] mailbox_id The Mailbox ID + * @param[in] addr_list The addresses of senders \n + * See #email_email_address_list_t. + * @param[in] start_index The first mail index of searched mail \n + * This function will return mails whose index in the result list are from @a start_index to @a start_index + @a limit_count. + * @param[in] limit_count The max number of returned mails + * @param[in] search_type The search type + * @param[in] search_value The search value + * @param[in] sorting The sorting order \n + * See #email_sort_type_t. + * @param[in/out] mail_list The Pointer to the structure #email_mail_list_item_t + * @param[in/out] result_count The number of searched mails + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_email_address_list_t, #email_sort_type_t, #email_mail_list_item_t */ EXPORT_API int email_get_mail_by_address(int account_id , int mailbox_id, email_email_address_list_t* addr_list, - int start_index, int limit_count, int search_type, const char *search_value, email_sort_type_t sorting, email_mail_list_item_t** mail_list, int* result_count); + int start_index, int limit_count, int search_type, const char *search_value, email_sort_type_t sorting, email_mail_list_item_t** mail_list, int* result_count); /** - * @fn email_get_thread_information_by_thread_id(int thread_id, email_mail_data_t** thread_info) - * @brief Get the thread information for specific thread from DB based on the mailbox name. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] thread_id Specifies the thread_id - * @param[in/out] thread_info Specifies the Pointer to the structure email_mail_data_t. - * @exception none - * @see email_mail_data_t + * @brief Gets thread information for a specific thread from DB based on the mailbox name. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] thread_id The thread ID + * @param[in/out] thread_info The pointer to the structure #email_mail_data_t + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mail_data_t + * * @code - * #include "email-api-account.h" - * bool - * _api_sample_get_thread_information() - * { - * email_mail_data_t *thread_info = NULL; - * int thread_id = 0; - * int err_code = EMAIL_ERROR_NONE; - * - * printf("\n > Enter thread_id: "); - * scanf("%d",&thread_id); - * - * if ( EMAIL_ERROR_NONE != email_get_thread_information_by_thread_id(thread_id, &thread_info)) - * { - * printf("email_get_thread_information_by_thread_id failed :\n"); * - * } - * else - * { - * printf("Success\n"); - * //do something - * } - * - * } + * #include "email-api-account.h" + * bool + * _api_sample_get_thread_information() + * { + * email_mail_data_t *thread_info = NULL; + * int thread_id = 0; + * int err_code = EMAIL_ERROR_NONE; + * + * printf("\n > Enter thread_id: "); + * scanf("%d",&thread_id); + * + * if ( EMAIL_ERROR_NONE != email_get_thread_information_by_thread_id(thread_id, &thread_info)) + * { + * printf("email_get_thread_information_by_thread_id failed :\n"); * + * } + * else + * { + * printf("Success\n"); + * //do something + * } + * + * } * @endcode - * @remarks N/A */ EXPORT_API int email_get_thread_information_by_thread_id(int thread_id, email_mail_data_t** thread_info); /** - * @fn email_get_thread_information_ex(int thread_id, email_mail_list_item_t** thread_info) - * @brief Get the Mail List information for specific thread from DB based on the mailbox name. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] thread_id Specifies the thread_id - * @param[in/out] thread_info Specifies the Pointer to the structure email_mail_list_item_t. - * @exception none - * @see email_mail_list_item_t + * @brief Gets Mail List information for a specific thread from the DB based on the mailbox name. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] thread_id The thread ID + * @param[in/out] thread_info The pointer to the structure #email_mail_list_item_t + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mail_list_item_t + * * @code - * #include "email-api-account.h" - * bool - * _api_sample_get_thread_information_ex() - * { - * email_mail_list_item_t *thread_info = NULL; - * int thread_id = 0; - * int err_code = EMAIL_ERROR_NONE; - * - * printf("\n > Enter thread_id: "); - * scanf("%d",&thread_id); - * - * if ( EMAIL_ERROR_NONE != email_get_thread_information_ex(thread_id, &thread_info)) - * { - * printf("email_get_mail_list_of_thread failed :\n"); * - * } - * else - * { - * printf("Success\n"); - * //do something - * } - * - * } + * #include "email-api-account.h" + * bool + * _api_sample_get_thread_information_ex() + * { + * email_mail_list_item_t *thread_info = NULL; + * int thread_id = 0; + * int err_code = EMAIL_ERROR_NONE; + * + * printf("\n > Enter thread_id: "); + * scanf("%d",&thread_id); + * + * if ( EMAIL_ERROR_NONE != email_get_thread_information_ex(thread_id, &thread_info)) + * { + * printf("email_get_mail_list_of_thread failed :\n"); * + * } + * else + * { + * printf("Success\n"); + * //do something + * } + * + * } * @endcode - * @remarks N/A */ EXPORT_API int email_get_thread_information_ex(int thread_id, email_mail_list_item_t** thread_info); /** - * @fn email_retry_sending_mail( int mail_id, int timeout_in_sec) - * @brief Retry mail send + * @brief Retries to send a mail. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] mail_id The mail ID for the mail to resend + * @param[in] timeout_in_sec The timeout value in seconds + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] mail_id Specifies the mail id for the mail to resend - * @param[in] timeout_in_sec Specifies the timeout value in seconds - * @exception none - * @see none - * @code - * #include "email-api-account.h" - * bool - * _api_sample_retry_send_mail() - * { - * int mail_id = 1; - * int timeout_in_sec = 2; - * - * if(EMAIL_ERROR_NONE == email_retry_sending_mail(mail_id,timeout_in_sec)) - * //success - * else - * //failure - * - * } + * #include "email-api-account.h" + * bool + * _api_sample_retry_send_mail() + * { + * int mail_id = 1; + * int timeout_in_sec = 2; + * + * if(EMAIL_ERROR_NONE == email_retry_sending_mail(mail_id,timeout_in_sec)) + * //success + * else + * //failure + * + * } * @endcode - * @remarks N/A */ EXPORT_API int email_retry_sending_mail(int mail_id, int timeout_in_sec); /** - * @fn email_create_db_full() - * @brief Create db and fill with dummy data + * @brief Creates a DB and fill it with dummy data. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @exception none - * @see none - * @remarks N/A + * @return #EMAIL_ERROR_NONE on success, + * otherwise error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_create_db_full(); /** - * @fn email_cancel_sending_mail( int mail_id) - * @brief Callback function for cm popup. We set the status as EMAIL_MAIL_STATUS_SEND_CANCELED + * @brief Callback function for cm popup. + * We set the status as EMAIL_MAIL_STATUS_SEND_CANCELED <<need to be updated>>. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] mail_id The mail ID + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] mail_id Specifies the mailID - * @exception none - * @see none * @code - * #include "email-api-account.h" - * bool - * _api_sample_cancel_send_mail() - * { - * int mail_id = 10; + * #include "email-api-account.h" + * bool + * _api_sample_cancel_send_mail() + * { + * int mail_id = 10; * * - * if(EMAIL_ERROR_NONE == email_cancel_sending_mail(mail_id,)) - * //success - * else - * //failure + * if(EMAIL_ERROR_NONE == email_cancel_sending_mail(mail_id,)) + * //success + * else + * //failure * - * } + * } * @endcode - * @remarks N/A */ EXPORT_API int email_cancel_sending_mail(int mail_id) ; /** - * @fn email_get_disk_space_usage(unsigned long *total_size) - * @brief Gets the total disk usage of emails in KB. + * @brief Gets the total disk usage of emails in KB. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[out] total_size The total disk usage of emails + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[out] total_size total disk usage of emails - * @exception none * @code - * #include "email-api-account.h" - * bool - * _api_sample_get_disk_space_usage() - * { - * unsigned long total_size = 0; - * - * if ( EMAIL_ERROR_NONE != email_get_disk_space_usage(&total_size)) - * printf("email_get_disk_space_usage failed err : %d\n",err_code); - * else - * printf("email_get_disk_space_usage SUCCESS, total disk usage in KB : %ld \n", total_size); - * } + * #include "email-api-account.h" + * bool + * _api_sample_get_disk_space_usage() + * { + * unsigned long total_size = 0; + * + * if ( EMAIL_ERROR_NONE != email_get_disk_space_usage(&total_size)) + * printf("email_get_disk_space_usage failed err : %d\n",err_code); + * else + * printf("email_get_disk_space_usage SUCCESS, total disk usage in KB : %ld \n", total_size); + * } * @endcode - * @remarks N/A */ EXPORT_API int email_get_disk_space_usage(unsigned long *total_size); /** - * @fn email_get_address_info_list(int mail_id, email_address_info_list_t** address_info_list) - * @brief Get the address info list. The address info list contains from, to, cc, bcc addresses and their display name, contact id and etc. (see email_address_info_list_t) - * Each GList (from, to, cc, bcc) is the list of email_address_info_t data. - * "data" variable of GList structure contains email_address_info_t data. <br> - * To get email_address_info_t data from GList, Use type casting from GList node. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] mail_id Specifies the mail id to get the list. - * @param[out] address_info_list Specifies the Pointer to the structure email_address_info_list_t. Memory for a new address info list will be allocated to this. Call email_free_address_info_list() to free the memory allocated to this. - * @exception none - * @see email_address_info_list_t, email_address_info_t, email_free_address_info_list() + * @brief Gets the address info list. + * @details The address info list contains From, To, CC, BCC addresses and their display name, contact ID and etc (see #email_address_info_list_t).\n + * Each GList (From, To, CC, BCC) is the list of #email_address_info_t data. \n + * "data" variable of GList structure contains #email_address_info_t data. \n + * To get #email_address_info_t data from GList, use type casting from GList node. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] mail_id The mail ID to get the list + * @param[out] address_info_list The pointer to the structure #email_address_info_list_t \n + * Memory for a new address info list will be allocated to this. + * You must call email_free_address_info_list() to free the memory allocated to this. + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_address_info_list_t, #email_address_info_t, email_free_address_info_list() + * * @code - * #include "email-api-account.h" - * bool - * _api_sample_get_address_info_list() - * { - * email_address_info_list_t *p_address_info_list= NULL; - * email_address_info_t *p_address_info = NULL; - * int mai_id; - * int err_code = EMAIL_ERROR_NONE; - * - * mail_id = 1; - * - * if ( EMAIL_ERROR_NONE != (err_code = email_get_address_info_list(mail_id, &p_address_info_list)) ) - * { - * printf("email_get_address_info_list failed :\n"); * - * return false; - * } - * else - * { - * printf("Success\n"); - * //do something with p_address_info_list - * GList *list = p_address_info_list->from; - * GList *node = g_list_first(list); - * while ( node != NULL ) - * { - * p_address_info = (email_address_info_t*)node->data; - * printf("%d, %s, %s, %d\n", p_address_info->address_type, p_address_info->address, p_address_info->display_name, p_address_info->contact_id); - * - * node = g_list_next(node); - * } - * } - * - * // Free sender list - * if ( p_address_info_list ) - * { - * email_free_address_info_list(&p_address_info_list); - * } - * } + * #include "email-api-account.h" + * bool + * _api_sample_get_address_info_list() + * { + * email_address_info_list_t *p_address_info_list= NULL; + * email_address_info_t *p_address_info = NULL; + * int mai_id; + * int err_code = EMAIL_ERROR_NONE; + * + * mail_id = 1; + * + * if ( EMAIL_ERROR_NONE != (err_code = email_get_address_info_list(mail_id, &p_address_info_list)) ) + * { + * printf("email_get_address_info_list failed :\n"); * + * return false; + * } + * else + * { + * printf("Success\n"); + * //do something with p_address_info_list + * GList *list = p_address_info_list->from; + * GList *node = g_list_first(list); + * while ( node != NULL ) + * { + * p_address_info = (email_address_info_t*)node->data; + * printf("%d, %s, %s, %d\n", p_address_info->address_type, p_address_info->address, p_address_info->display_name, p_address_info->contact_id); + * + * node = g_list_next(node); + * } + * } + * + * // Free sender list + * if ( p_address_info_list ) + * { + * email_free_address_info_list(&p_address_info_list); + * } + * } * @endcode - * @remarks N/A */ EXPORT_API int email_get_address_info_list(int mail_id, email_address_info_list_t** address_info_list); /** - * @fn email_free_address_info_list(email_address_info_list_t **address_info_list) - * @brief Free the address info list allocated by email_get_address_info_list(). This function will free the memory which is allocated to address_info_list itself. + * @brief Frees the address info list allocated by email_get_address_info_list(). + * @details This function will free the memory which is allocated to address_info_list itself. + * + * @since_tizen 2.3 + * @privlevel N/P + * + * @param[in] address_info_list The pointer to the structure #email_address_info_list_t to be freed * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] address_info_list Specifies the Pointer to the structure email_address_info_list_t to be freed. - * @exception none - * @see email_address_info_list_t, email_get_address_info_list() + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_address_info_list_t, email_get_address_info_list() */ EXPORT_API int email_free_address_info_list(email_address_info_list_t **address_info_list); /** - * @fn email_get_structure(const char*encoded_string, void **struct_var, email_convert_struct_type_e type) - * @brief This function returns the structure of the type which is indicated by 'type' variable. This function will allocate new memory to 'struct_var' for structure.<br> - * Some notifications such as NOTI_DOWNLOAD_NEW_MAIL are published with string parameter. The string contains various values that might be divided by delimiter.<br> - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] encoded_string Specifies the Pointer to the string from notification. - * @param[out] struct_var Specifies the Pointer to the structure to be returned. If success, new memory for structure will be allocated. - * @param[in] type Specifies the converting type. see email_convert_struct_type_e - * @exception none - * @see email_convert_struct_type_e - */ -EXPORT_API int email_get_structure(const char*encoded_string, void **struct_var, email_convert_struct_type_e type); - -/** - - * @fn email_get_meeting_request(int mail_id, email_meeting_request_t **meeting_req) - * @brief Query the information of meeting request. - * The information of meeting request is corresponding to only one mail. - * For this reason, the information of meeting request can be added by using email_add_message_with_meeting_request() with a matched mail information. - * - * @return This function returns EMAIL_ERROR_NONE on success. This function returns EMAIL_ERROR_DATA_NOT_FOUND if there isn't a matched mail. Otherwise it returns error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_conditional_clause_string Specifies the where clause string. - * @param[out] output_meeting_req Specifies the Pointer to the structure email_meeting_request_t. - * @param[out] output_count Specifies the number of meeting request returned. - * @exception none - * @see email_meeting_request_t + * @brief Queries the information of a meeting request. + * @details The information of a meeting request is corresponding to only one mail. \n + * For this reason, the information of a meeting request can be added by using email_add_message_with_meeting_request() with the matched mail information. + * + * @param[in] input_conditional_clause_string The where clause string + * @param[out] output_meeting_req The pointer to the structure #email_meeting_request_t + * @param[out] output_count The number of meeting request returned + * + * @return #EMAIL_ERROR_NONE on success, + * #EMAIL_ERROR_DATA_NOT_FOUND if there is no matched mail, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_meeting_request_t */ EXPORT_API int email_query_meeting_request(char *input_conditional_clause_string, email_meeting_request_t **output_meeting_req, int *output_count); /** - * @fn email_get_meeting_request(int mail_id, email_meeting_request_t **meeting_req) - * @brief Get the information of meeting request. The information of meeting request is based on Mail Id. <br> - * The information of meeting request is corresponding to only one mail. - * For this reason, the information of meeting request can be added by using email_add_message_with_meeting_request() with a matched mail information. - * - * @return This function returns EMAIL_ERROR_NONE on success. This function returns EMAIL_ERROR_DATA_NOT_FOUND if there isn't a matched mail. Otherwise it returns error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] mail_id Specifies the Mail id for which meeting request details need to be fetched - * @param[in/out] meeting_req Specifies the Pointer to the structure email_meeting_request_t. - * @exception none - * @see email_meeting_request_t + * @brief Gets the information of a meeting request. + * @details The information of a meeting request is based on the Mail ID. \n + * The information of the meeting request is corresponding to only one mail. \n + * For this reason, the meeting request information can be added by using email_add_message_with_meeting_request() with the matched mail information. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] mail_id The mail ID for which meeting request details need to be fetched + * @param[in/out] meeting_req The pointer to the structure #email_meeting_request_t + * + * @return #EMAIL_ERROR_NONE on success, + * #EMAIL_ERROR_DATA_NOT_FOUND if there is no matched mail, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_meeting_request_t */ EXPORT_API int email_get_meeting_request(int mail_id, email_meeting_request_t **meeting_req); /** - * @fn email_free_meeting_request(email_meeting_request_t** meeting_req, int count) - * @brief Free the meeting request allocated by email_get_meeting_request() or alloacted to add. This function will free the memory which is allocated to meeting_req (= *meeting_req) itself. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] email_meeting_request_t Specifies the Pointer to the structure email_meeting_request_t to be freed. - * @param[in] count Specifies the number of elements in meeting_req array. this is usually 1. - * @exception none - * @see email_meeting_request_t, email_get_meeting_request() + * @brief Frees a meeting request allocated by email_get_meeting_request() or allocated to add. + * @details This function will free the memory which is allocated to meeting_req (= *meeting_req) itself. + * + * @since_tizen 2.3 + * @privlevel N/P + * + * @param[in] email_meeting_request_t The pointer to the structure #email_meeting_request_t to be freed + * @param[in] count The number of elements in #meeting_req array (usually @c 1) + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_meeting_request_t, email_get_meeting_request() */ EXPORT_API int email_free_meeting_request(email_meeting_request_t** meeting_req, int count); /** - * @fn email_move_thread_to_mailbox(int thread_id, int target_mailbox_id, int move_always_flag) - * @brief Move a thread of mails to target mailbox. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] thread_id Specifies the thread id to move - * @param[in] target_mailbox_id Specifies the mailbox id which move in - * @param[in] move_always_flag Specify move always flag - * @exception none - * @see + * @brief Moves a thread of mails to the target mailbox. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] thread_id The thread ID to move + * @param[in] target_mailbox_id The mailbox ID in which to move + * @param[in] move_always_flag The move always flag + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_move_thread_to_mailbox(int thread_id, int target_mailbox_id, int move_always_flag); /** - * @fn email_delete_thread(int thread_id, int delete_always_flag) - * @brief delete a thread of mails. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] thread_id Specifies the thread id to delete - * @param[in] delete_always_flag Specify delete always flag - * @exception none - * @see + * @brief Deletes a thread of mails. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] thread_id The thread ID to delete + * @param[in] delete_always_flag The delete always flag + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_delete_thread(int thread_id, int delete_always_flag); /** - * @fn email_modify_seen_flag_of_thread(int thread_id, int seen_flag, int on_server) - * @brief Modify seen flags of thread - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] thread_id Specifies the thread id to modify - * @param[in] seen_flag Specify seem flag - * @param[in] on_server Specify to sync with server - * @exception none - * @see + * @brief Modifies seen flags of the thread. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] thread_id The thread ID to modify + * @param[in] seen_flag The seen flag + * @param[in] on_server The flag to sync with server + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_modify_seen_flag_of_thread(int thread_id, int seen_flag, int on_server); /** - * @fn email_expunge_mails_deleted_flagged(int input_mailbox_id, int input_on_server, int *output_handle) - * @brief Delete mails which flagged to delete - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_mailbox_id Specifies the id of mailbox - * @param[in] input_on_server Specify to sync with server - * @param[out] output_handle Specify the handle of task - * @exception none - * @see + * @brief Deletes mails flagged to "delete". + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] input_mailbox_id The mailbox ID + * @param[in] input_on_server The flag to sync with server + * @param[out] output_handle The handle of task + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_expunge_mails_deleted_flagged(int input_mailbox_id, int input_on_server, int *output_handle); @@ -1499,8 +1647,8 @@ EXPORT_API int email_expunge_mails_deleted_flagged(int input_mailbox_id, int inp #endif /* __cplusplus */ /** -* @} @} -*/ + * @} + */ #endif /* __EMAIL_API_MAIL_H__ */ diff --git a/email-api/include/email-api-mailbox.h b/email-api/include/email-api-mailbox.h index 0a7b7bb..60ceeea 100755 --- a/email-api/include/email-api-mailbox.h +++ b/email-api/include/email-api-mailbox.h @@ -26,104 +26,102 @@ #include "email-types.h" /** -* @defgroup EMAIL_SERVICE Email Service -* @{ -*/ - - -/** -* @ingroup EMAIL_SERVICE -* @defgroup EMAIL_API_MAILBOX Email Mailbox API -* @{ -*/ - -/** - * - * This file contains the data structures and interfaces needed for application, - * to interact with email-service. - * @file email-api-mailbox.h - * @author Kyuho Jo <kyuho.jo@samsung.com> - * @author Sunghyun Kwon <sh0701.kwon@samsung.com> - * @version 0.1 - * @brief This file contains the data structures and interfaces of mailbox provided by - * email-service . + * @file email-api-mailbox.h + * @brief This file contains the data structures and interfaces of mailbox provided by email-service. * @{ * @code * * #include "email_api_mailbox.h" * * bool other_app_invoke_uniform_api_sample(int *error_code) - * { - * email_mailbox_t mailbox; - * email_mailbox_t *new_mailbox =NULL; - * email_mailbox_t *mailbox_list = NULL; - * int count = 0; - * int mailbox_type; - * int handle = 0; - * char *pMaiboxName; - * char *pParentMailbox; - * - * memset(&mailbox,0x00,sizeof(email_mailbox_t)); - * mailbox.mailbox_name = strdup("test"); - * mailbox.alias = strdup("Personal"); - * mailbox.account_id = 1; - * printf("Enter local_yn(1/0)"); - * scanf("%d",&local_yn); - * mailbox.local=local_yn; - * mailbox.mailbox_type = 7; - * - * //create new mailbox - * - * if(EMAIL_ERR_NONE != email_add_mailbox(&mailbox,local_yn,&handle)) - * printf("email_add_mailbox failed\n"); - * else - * printf("email_add_mailbox success"); - * - * //delete mailbox - * - * if(EMAIL_ERROR_NONE != email_delete_mailbox(mailbox,local_yn,&handle)) - * printf("email_delete_mailbox failed\n"); - * else - * printf("email_delete_mailbox success\n"); - * - * //free mailbox - * email_free_mailbox("new_mailbox,1"); - * - * //Get mailbox list - * if(EMAIL_ERROR_NONE != email_get_mailbox_list(account_id,local_yn,&mailbox_list,&count)) - * //failure - * else - * //success - * - * //Get mailbox by name - * pMailboxName = strdup("test"); - * if(EMAIL_ERROR_NONE != email_get_mailbox_by_name(account_id,pMailboxName,&mailbox_list)) - * //failure - * else - * //success - * - * //Get child mailbox list - * pParentMailbox = strdup("test"); - * if(EMAIL_ERROR_NONE != email_get_child_mailbox_list(account_id, paerent_mailbox,&mailbox_list,&count)) - * //failure - * else - * //success - * - * //Get mailbox by mailbox_type - * printf("Enter mailbox_type\n"); - * scanf("%d",&mailbox_type); - * if(EMAIL_ERROR_NONE != email_get_mailbox_by_mailbox_type(account_id,mailbox_type,&mailbox_list)) - * //failure - * else - * //success - * - * } + * { + * email_mailbox_t mailbox; + * email_mailbox_t *new_mailbox =NULL; + * email_mailbox_t *mailbox_list = NULL; + * int count = 0; + * int mailbox_type; + * int handle = 0; + * char *pMaiboxName; + * char *pParentMailbox; + * + * memset(&mailbox,0x00,sizeof(email_mailbox_t)); + * mailbox.mailbox_name = strdup("test"); + * mailbox.alias = strdup("Personal"); + * mailbox.account_id = 1; + * printf("Enter local_yn(1/0)"); + * scanf("%d",&local_yn); + * mailbox.local=local_yn; + * mailbox.mailbox_type = 7; + * + * //create new mailbox + * + * if(EMAIL_ERR_NONE != email_add_mailbox(&mailbox,local_yn,&handle)) + * printf("email_add_mailbox failed\n"); + * else + * printf("email_add_mailbox success"); + * + * //delete mailbox + * + * if(EMAIL_ERROR_NONE != email_delete_mailbox(mailbox,local_yn,&handle)) + * printf("email_delete_mailbox failed\n"); + * else + * printf("email_delete_mailbox success\n"); + * + * //free mailbox + * email_free_mailbox("new_mailbox,1"); + * + * //Get mailbox list + * if(EMAIL_ERROR_NONE != email_get_mailbox_list(account_id,local_yn,&mailbox_list,&count)) + * //failure + * else + * //success + * + * //Get mailbox by name + * pMailboxName = strdup("test"); + * if(EMAIL_ERROR_NONE != email_get_mailbox_by_name(account_id,pMailboxName,&mailbox_list)) + * //failure + * else + * //success + * + * //Get child mailbox list + * pParentMailbox = strdup("test"); + * if(EMAIL_ERROR_NONE != email_get_child_mailbox_list(account_id, paerent_mailbox,&mailbox_list,&count)) + * //failure + * else + * //success + * + * //Get mailbox by mailbox_type + * printf("Enter mailbox_type\n"); + * scanf("%d",&mailbox_type); + * if(EMAIL_ERROR_NONE != email_get_mailbox_by_mailbox_type(account_id,mailbox_type,&mailbox_list)) + * //failure + * else + * //success + * + * } * * @endcode * @} */ +/** + * @internal + * @ingroup EMAIL_SERVICE_FRAMEWORK + * @defgroup EMAIL_SERVICE_MAILBOX_MODULE Mailbox API + * @brief Mailbox API is a set of operations to manage email mailboxes like add, update, delete or get mailbox related details. + * + * @section EMAIL_SERVICE_MAILBOX_MODULE_HEADER Required Header + * \#include <email-api-mailbox.h> + * + * @section EMAIL_SERVICE_MAILBOX_MODULE_OVERVIEW Overview + * Mailbox API is a set of operations to manage email mailboxes like add, update, delete or get mailbox related details. + */ +/** + * @internal + * @addtogroup EMAIL_SERVICE_MAILBOX_MODULE + * @{ + */ #ifdef __cplusplus extern "C" @@ -132,269 +130,347 @@ extern "C" /** - * @fn int email_add_mailbox(email_mailbox_t* new_mailbox, int on_server, int *handle) - * @brief Create a new mailbox or mailbox.This function is invoked when user wants to create a new mailbox for the specified account. - * If On_server is true then it will create the mailbox on server as well as in local also. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code(refer to EMAIL_ERROR_XXX) on failure. - * @param[in] new_mailbox Specifies the pointer of creating mailbox information. -* @param[in] on_server Specifies the creating mailbox on server. - * @param[out] handle Specifies the sending handle. - * @exception none - * @see email_mailbox_t - * @remarks N/A + * @brief Creates a new mailbox. + * @details This function is invoked when a user wants to create a new mailbox for the specified account.\n + * If on_server is true, it will create the mailbox on the server as well as locally. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] new_mailbox The pointer of creating mailbox information + * @param[in] on_server The creating mailbox on server + * @param[out] handle The sending handle + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t */ EXPORT_API int email_add_mailbox(email_mailbox_t *new_mailbox, int on_server, int *handle); /** - * @fn int email_rename_mailbox(int input_mailbox_id, char *input_mailbox_name, char *input_mailbox_alias) - * @brief Change mailbox name. This function is invoked when user wants to change the name of existing mail box. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code(refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_mailbox_id Specifies the id of the mailbox. - * @param[in] input_mailbox_name Specifies the name of the mailbox. - * @param[in] input_mailbox_alias Specifies the alias of the mailbox. - * @param[in] input_on_server Specifies the moving mailbox on server. - * @param[out] output_handle Specifies the handle to manage tasks. - * - * @exception see email-errors.h - * @see email_mailbox_t, email_mailbox_type_e - * @remarks N/A + * @brief Changes the name of a mailbox. + * @details This function is invoked when a user wants to change the name of an existing mail box. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @remarks See email-errors.h for exception. + * + * @param[in] input_mailbox_id The mailbox ID + * @param[in] input_mailbox_name The name of the mailbox + * @param[in] input_mailbox_alias The alias of the mailbox + * @param[in] input_on_server The moving mailbox on server + * @param[out] output_handle The handle to manage tasks + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t, #email_mailbox_type_e */ EXPORT_API int email_rename_mailbox(int input_mailbox_id, char *input_mailbox_name, char *input_mailbox_alias, int input_on_server, int *output_handle); /** - * @fn int email_rename_mailbox_ex(int input_mailbox_id, char *input_mailbox_name, char *input_mailbox_alias, void *input_eas_data, int input_eas_data_length, int input_on_server, int *output_handle); - * @brief Change mailbox name. This function is invoked when user wants to change the name of existing mail box. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code(refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_mailbox_id Specifies the id of the mailbox. - * @param[in] input_mailbox_name Specifies the name of the mailbox. - * @param[in] input_mailbox_alias Specifies the alias of the mailbox. - * @param[in] input_eas_data Specifies the eas data. - * @param[in] input_eas_data_length Specifies the length of eas data. - * @param[in] input_on_server Specifies the moving mailbox on server. - * @param[out] output_handle Specifies the handle to manage tasks. - * - * @exception see email-errors.h - * @see email_mailbox_t, email_mailbox_type_e - * @remarks N/A + * @brief Changes the name of a mailbox. + * @details This function is invoked when a user wants to change the name of an existing mail box. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @remarks See email-errors.h for exception. + * + * @param[in] input_mailbox_id The mailbox ID + * @param[in] input_mailbox_name The name of the mailbox + * @param[in] input_mailbox_alias The alias of the mailbox + * @param[in] input_eas_data The EAS data + * @param[in] input_eas_data_length The length of EAS data + * @param[in] input_on_server The moving mailbox on server + * @param[out] output_handle The handle to manage tasks + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t, #email_mailbox_type_e */ EXPORT_API int email_rename_mailbox_ex(int input_mailbox_id, char *input_mailbox_name, char *input_mailbox_alias, void *input_eas_data, int input_eas_data_length, int input_on_server, int *output_handle); /** - * @fn int email_delete_mailbox(int input_mailbox_id, int input_on_server, int *output_handle) - * @brief Delete a mailbox or mailbox.This function deletes the existing mailbox for specified account based on the option on_server. - * If the on_server is true then it deletes mailbox from server as well as locally. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code(refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_mailbox_id Specifies the id of target mailbox . - * @param[in] input_on_server Specifies the deleting mailbox on server. - * @param[out] output_handle Specifies the sending handle. - * @exception see email-errors.h - * @see email_mailbox_t - * @remarks N/A + * @brief Deletes a mailbox. + * @details This function deletes the existing mailbox for the specified account based on the on_server option. \n + * If on_server is true, it deletes the mailbox from the server as well as locally. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @remarks See email-errors.h for exception. + * + * @param[in] input_mailbox_id The target mailbox ID + * @param[in] input_on_server The deleting mailbox on server + * @param[out] output_handle The sending handle + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t */ EXPORT_API int email_delete_mailbox(int input_mailbox_id, int input_on_server, int *output_handle); /** - * @fn int email_delete_mailbox_ex(int input_account_id, int *input_mailbox_id_array, int input_mailbox_id_count, int input_on_server, int *output_handle); - * @brief Delete a mailbox or mailbox.This function deletes the existing mailbox for specified account based on the option on_server. - * If the on_server is true then it deletes mailbox from server as well as locally. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code(refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_account_id Specifies the id of account. - * @param[in] input_mailbox_id_array Specifies the mailbox array for deleting. - * @param[in] input_mailbox_id_count Specifies the count of mailbox for deleting. - * @param[in] input_on_server Specifies the deleting mailbox on server. - * @param[out] output_handle Specifies the sending handle. - * @exception see email-errors.h - * @see email_mailbox_t - * @remarks N/A + * @brief Deletes a mailbox. + * @details This function deletes the existing mailbox for the specified account based on the option on_server option. \n + * If on_server is true, it deletes the mailbox from the server as well as locally. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @remarks See email-errors.h for exception. + * + * @param[in] input_account_id The account ID + * @param[in] input_mailbox_id_array The mailbox array for deleting + * @param[in] input_mailbox_id_count The count of mailbox for deleting + * @param[in] input_on_server The deleting mailbox on server + * @param[out] output_handle The sending handle + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t */ EXPORT_API int email_delete_mailbox_ex(int input_account_id, int *input_mailbox_id_array, int input_mailbox_id_count, int input_on_server, int *output_handle); /** - * @fn int email_set_mailbox_type(int input_mailbox_id, email_mailbox_type_e input_mailbox_type) - * @brief Change the mailbox type. This function is invoked when user wants to change the mailbox type. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code(refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_mailbox_id Specifies the id of the mailbox. - * @param[in] input_mailbox_type Specifies the mailbox type. - * @exception see email-errors.h - * @see email_mailbox_type_e - * @remarks N/A + * @brief Changes the mailbox type. + * @details This function is invoked when a user wants to change the mailbox type. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @remarks See email-errors.h for exception. + * + * @param[in] input_mailbox_id The mailbox ID + * @param[in] input_mailbox_type The mailbox type + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code(see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_type_e */ EXPORT_API int email_set_mailbox_type(int input_mailbox_id, email_mailbox_type_e input_mailbox_type); /** - * @fn int email_set_local_mailbox(int input_mailbox_id, int input_is_local_mailbox) - * @brief Change the attribute 'local' of email_mailbox_t. This function is invoked when user wants to change the attribute 'local'. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code(refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_mailbox_id Specifies the id of the mailbox. - * @param[in] input_is_local_mailbox Specifies the value of the attribute 'local' of email_mailbox_t. - * @exception see email-errors.h - * @see none - * @remarks N/A + * @brief Changes the 'local' attribute of #email_mailbox_t. + * @details This function is invoked when a user wants to change the 'local' attribute. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @remarks See email-errors.h for exception. + * + * @param[in] input_mailbox_id The mailbox ID + * @param[in] input_is_local_mailbox The value of the attribute 'local' of #email_mailbox_t + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_set_local_mailbox(int input_mailbox_id, int input_is_local_mailbox); /** - * @fn email_get_mailbox_list(int account_id, int mailbox_sync_type, email_mailbox_t** mailbox_list, int* count) - * @brief Get all mailboxes from account. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code(refer to EMAIL_ERROR_XXX) on failure. - * @param[in] account_id Specifies the account ID. - * @param[in] mailbox_sync_type Specifies the sync type. - * @param[out] mailbox_list Specifies the pointer of mailbox structure pointer.(possibly NULL) - * @param[out] count The mailbox count is saved here.(possibly 0) - * @exception none - * @see email_mailbox_t - + * @brief Gets all mailboxes from account. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] account_id The account ID + * @param[in] mailbox_sync_type The sync type + * @param[out] mailbox_list The pointer of mailbox structure pointer (possibly @c NULL) + * @param[out] count The mailbox count (possibly @c 0) + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t + * * @code - * #include "email-api-mailbox.h" - * bool - * _api_sample_get_mailbox_list() - * { - * int account_id =0,count = 0; - * int mailbox_sync_type; - * int error_code = EMAIL_ERROR_NONE; - * email_mailbox_t *mailbox_list=NULL; - * - * printf("\n > Enter account id: "); - * scanf("%d", &account_id); - * printf("\n > Enter mailbox_sync_type: "); - * scanf("%d", &mailbox_sync_type); - * - * if((EMAIL_ERROR_NONE != email_get_mailbox_list(account_id, mailbox_sync_type, &mailbox_list, &count))) - * { - * printf(" Error\n"); - * } - * else - * { - * printf("Success\n"); - * email_free_mailbox(&mailbox_list,count); - * } - * } + * #include "email-api-mailbox.h" + * bool + * _api_sample_get_mailbox_list() + * { + * int account_id =0,count = 0; + * int mailbox_sync_type; + * int error_code = EMAIL_ERROR_NONE; + * email_mailbox_t *mailbox_list=NULL; + * + * printf("\n > Enter account id: "); + * scanf("%d", &account_id); + * printf("\n > Enter mailbox_sync_type: "); + * scanf("%d", &mailbox_sync_type); + * + * if((EMAIL_ERROR_NONE != email_get_mailbox_list(account_id, mailbox_sync_type, &mailbox_list, &count))) + * { + * printf(" Error\n"); + * } + * else + * { + * printf("Success\n"); + * email_free_mailbox(&mailbox_list,count); + * } + * } * @endcode - * @remarks N/A */ EXPORT_API int email_get_mailbox_list(int account_id, int mailbox_sync_type, email_mailbox_t** mailbox_list, int* count); /** - * @fn email_get_mailbox_list_ex(int account_id, int mailbox_sync_type, int with_count, email_mailbox_t** mailbox_list, int* count) - * @brief Extend the email_get_mailbox_list_ex function. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code(refer to EMAIL_ERROR_XXX) on failure. - * @param[in] account_id Specifies the account ID. - * @param[in] mailbox_sync_type Specifies the sync type. - * @param[in] with_count specifies the count of mailbox. - * @param[out] mailbox_list Specifies the pointer of mailbox structure pointer.(possibly NULL) - * @param[out] count The mailbox count is saved here.(possibly 0) - * @exception none - * @see email_mailbox_t - * @remarks N/A + * @brief Extends the email_get_mailbox_list_ex() function. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] account_id The account ID + * @param[in] mailbox_sync_type The sync type + * @param[in] with_count The count of mailbox + * @param[out] mailbox_list The pointer of mailbox structure pointer (possibly @c NULL) + * @param[out] count The mailbox count is saved here (possibly @c 0) + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t */ EXPORT_API int email_get_mailbox_list_ex(int account_id, int mailbox_sync_type, int with_count, email_mailbox_t** mailbox_list, int* count); /** - * @fn email_get_mailbox_list_by_keyworkd(int account_id, char *keyword , email_mailbox_t** mailbox_list, int* count) - * @brief Get the mailbox list to using keywork. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code(refer to EMAIL_ERROR_XXX) on failure. - * @param[in] account_id Specifies the account ID. - * @param[in] keywork Specifies the specified keyworkd for searching. - * @param[out] mailbox_list Specifies the pointer of mailbox structure pointer.(possibly NULL) - * @param[out] count The mailbox count is saved here.(possibly 0) - * @exception none - * @see email_mailbox_t - * @remarks N/A + * @brief Gets the mailbox list based on a keyword. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] account_id The account ID + * @param[in] keyword The specified keyword for searching + * @param[out] mailbox_list The pointer of mailbox structure pointer (possibly @c NULL) + * @param[out] count The mailbox count is saved here (possibly @c 0) + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t */ EXPORT_API int email_get_mailbox_list_by_keyword(int account_id, char *keyword, email_mailbox_t** mailbox_list, int* count); /** - * @fn email_get_mailbox_by_mailbox_type(int account_id, email_mailbox_type_e mailbox_type, email_mailbox_t** mailbox) - * @brief Get mailbox by mailbox_type.This function is invoked when user wants to know the mailbox information by mailbox_type for the given account. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code(refer to EMAIL_ERROR_XXX) on failure. - * @param[in] account_id Specifies the account ID. - * @param[in] mailbox_type Specifies the mailbox type. - * @param[out] mailbox Specifies the pointer of mailbox structure pointer.(possibly NULL) - * @exception none - * @see email_mailbox_t - * @remarks N/A + * @brief Gets a mailbox by mailbox type. + * @details This function is invoked when a user wants to know the mailbox information by @a mailbox_type for the given account. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] account_id The account ID + * @param[in] mailbox_type The mailbox type + * @param[out] mailbox The pointer of mailbox structure pointer (possibly @c NULL) + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t */ EXPORT_API int email_get_mailbox_by_mailbox_type(int account_id, email_mailbox_type_e mailbox_type, email_mailbox_t** mailbox); /** - * @fn email_get_mailbox_by_mailbox_id(int input_mailbox_id, email_mailbox_t** output_mailbox) - * @brief Get mailbox by mailbox_id. This function is invoked when user wants to know the mailbox information by mailbox id. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code(refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_mailbox_id Specifies the mailbox id. - * @param[out] output_mailbox Specifies the pointer of mailbox structure pointer.(possibly NULL) - * @exception none - * @see email_mailbox_t - * @remarks N/A + * @brief Gets a mailbox by mailbox ID. + * @details This function is invoked when a user wants to know the mailbox information by mailbox ID. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] input_mailbox_id The mailbox ID + * @param[out] output_mailbox The pointer of mailbox structure pointer (possibly @c NULL) + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t */ EXPORT_API int email_get_mailbox_by_mailbox_id(int input_mailbox_id, email_mailbox_t** output_mailbox); /** - * @fn email_set_mail_slot_size(int input_account_id, int input_mailbox_id, int input_new_slot_size) - * @brief Set mail slot size.This function is invoked when user wants to set the size of mail slot. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code(refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_account_id Specifies the account ID. - * @param[in] input_mailbox_id Specifies the mailbox id. - * @param[in] input_new_slot_size Specifies the mail slot size. - * @exception none - * @see email_mailbox_t - * @remarks N/A + * @brief Sets a mail slot size. + * @details This function is invoked when a user wants to set the size of mail slot. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] input_account_id The account ID + * @param[in] input_mailbox_id The mailbox ID + * @param[in] input_new_slot_size The mail slot size + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t */ EXPORT_API int email_set_mail_slot_size(int input_account_id, int input_mailbox_id, int input_new_slot_size); /** - * @fn email_stamp_sync_time_of_mailbox(int input_mailbox_id) - * @brief Stamp sync time of mailbox. This function is invoked when user wants to set the sync time of the mailbox. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code(refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_mailbox_id Specifies the mailbox id. - * @exception none - * @see email_mailbox_t - * @remarks N/A + * @brief Sets the sync time of a mailbox. + * @details This function is invoked when a user wants to set the sync time of the mailbox. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] input_mailbox_id The mailbox ID + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t */ EXPORT_API int email_stamp_sync_time_of_mailbox(int input_mailbox_id); /** - * @fn email_free_mailbox(email_mailbox_t** mailbox_list, int count) - * @brief Free allocated memory for mailbox information. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] mailbox_list Specifies the pointer for searching mailbox structure pointer. - * @param[in] count Specifies the count of mailboxes. - * @exception none - * @see email_mailbox_t - + * @brief Frees the memory allocated for the mailbox information. + * + * @since_tizen 2.3 + * @privlevel N/P + * + * @param[in] mailbox_list The pointer for searching mailbox structure pointer + * @param[in] count The count of mailboxes + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t + * * @code - * #include "email-api-mailbox.h" - * bool - * _api_sample_free_mailbox_info() - * { - * email_mailbox_t *mailbox; - * - * //fill the mailbox structure - * //count - number of mailbox structure user want to free - * if(EMAIL_ERROR_NONE == email_free_mailbox(&mailbox,count)) - * //success - * else - * //failure - * - * } + * #include "email-api-mailbox.h" + * bool + * _api_sample_free_mailbox_info() + * { + * email_mailbox_t *mailbox; + * + * //fill the mailbox structure + * //count - number of mailbox structure user want to free + * if(EMAIL_ERROR_NONE == email_free_mailbox(&mailbox,count)) + * //success + * else + * //failure + * + * } * @endcode - * @remarks N/A */ EXPORT_API int email_free_mailbox(email_mailbox_t** mailbox_list, int count); @@ -404,8 +480,8 @@ EXPORT_API int email_free_mailbox(email_mailbox_t** mailbox_list, int count); #endif /* __cplusplus */ /** -* @} @} -*/ + * @} + */ #endif /* __EMAIL_API_MAILBOX_H__ */ diff --git a/email-api/include/email-api-network.h b/email-api/include/email-api-network.h index 77f3e16..cbce793 100755 --- a/email-api/include/email-api-network.h +++ b/email-api/include/email-api-network.h @@ -26,259 +26,289 @@ #include "email-types.h" /** -* @defgroup EMAIL_SERVICE Email Service -* @{ -*/ - -/** -* @ingroup EMAIL_SERVICE -* @defgroup EMAIL_API_NETWORK Email Network API -* @{ -*/ - -/** - * - * This file contains the data structures and interfaces needed for application, - * to interact with email-service. - * @file email-api-network.h - * @author Kyuho Jo <kyuho.jo@samsung.com> - * @author Sunghyun Kwon <sh0701.kwon@samsung.com> - * @version 0.1 - * @brief This file contains the data structures and interfaces of Network related Functionality provided by - * email-service . + * @internal + * @file email-api-network.h + * @brief This file contains the data structures and interfaces of Network related Functionality provided by + * email-service. * * @{ - * @code - * #include "email-api.h" - * - * bool - * other_app_invoke_uniform_api_sample(int* error_code) - * { - * - * // Send a mail - * email_attachment_data_t attachment; - * int account_id = 1; - * int mailbox_id = 0; - * int attachment_id = 0; - * int err = EMAIL_ERROR_NONE; - * int mail_id = 0; - * int action = -1; - * - * printf("Enter mail id\n"); - * scanf("%d",&mail_id); - * - * if(EMAIL_ERROR_NONE == email_send_mail(mail_id, &handle)) - * //success - * else - * //failure - * - * // Download header of new emails from mail server - * int handle = 0; - * - * mailbox.account_id = account_id; - * printf("Enter mailbox id\n"); - * scanf("%d",&mailbox_id); - * if(EMAIL_ERROR_NONE == email_sync_header (account_id, mailbox_id, &handle)) - * //success - * else - * //failure - * - * //Sync mail header for all accounts - * if(EMAIL_ERROR_NONE == email_sync_header_for_all_account(&handle)) - * //success - * else - * //failure - * - * //Download email body from server - * - * if(EMAIL_ERROR_NONE == email_download_body (mail_id,0,&handle)) - * //success - * else - * //failure - * - * //Download a email nth-attachment from server - * prinf("Enter attachment number\n"); - * scanf("%d",&attachment_id); - * if(EMAIL_ERROR_NONE == email_download_attachment(mail_id, attachment_id, &handle)) - * //success - * else - * //failure - * - * //Cancel job - * if(EMAIL_ERROR_NONE == email_cancel_job(account_id,handle))//canceling download email nth attachment from server job. - * //so this handle contains the value return by the email_download_attachment() - * //success - * else - * //failure - * //Get pending job list for an account - * - * printf( " Enter Action \n SEND_MAIL = 0 \n SYNC_HEADER = 1 \n" \ - * " DOWNLOAD_BODY,= 2 \n DOWNLOAD_ATTACHMENT = 3 \n" \ - * " DELETE_MAIL = 4 \n SEARCH_MAIL = 5 \n SAVE_MAIL = 6 \n" \ - * " NUM = 7 \n"); - * scanf("%d",&action); - * if(EMAIL_ERROR_NONE == email_get_pending_job(action,account_id,mail_id,&status)) - * //success - * else - * //error - * - * //Get Network status - * if(EMAIL_ERROR_NONE == email_get_network_status(&sending,&receiving)) - * //success - * else - * //failure - * - * //Send read report - * if(EMAIL_ERROR_NONE == email_send_report(mail ,&handle)) - * //success - * else - * //failure - * //Save and send - * - * - * if(EMAIL_ERROR_NONE == email_add_mail(mail,NULL,0, NULL, 0)) - * { - * if(EMAIL_ERROR_NONE == email_send_saved(account_id,&option,&handle)) - * //success - * else - * //failure - * } - * //Get Imap mailbox list - * if(EMAIL_ERROR_NONE == email_sync_imap_mailbox_list(account_id, &handle)) - * //success - * else - * //failure + * #include "email-api.h" + * + * bool + * other_app_invoke_uniform_api_sample(int* error_code) + * { + * + * // Sends a mail + * email_attachment_data_t attachment; + * int account_id = 1; + * int mailbox_id = 0; + * int attachment_id = 0; + * int err = EMAIL_ERROR_NONE; + * int mail_id = 0; + * int action = -1; + * + * printf("Enter mail id\n"); + * scanf("%d",&mail_id); + * + * if(EMAIL_ERROR_NONE == email_send_mail(mail_id, &handle)) + * //success + * else + * //failure + * + * // Downloads header of new emails from mail server + * int handle = 0; + * + * mailbox.account_id = account_id; + * printf("Enter mailbox id\n"); + * scanf("%d",&mailbox_id); + * if(EMAIL_ERROR_NONE == email_sync_header (account_id, mailbox_id, &handle)) + * //success + * else + * //failure + * + * //Syncs mail header for all accounts + * if(EMAIL_ERROR_NONE == email_sync_header_for_all_account(&handle)) + * //success + * else + * //failure + * + * //Downloads email body from server + * + * if(EMAIL_ERROR_NONE == email_download_body (mail_id,0,&handle)) + * //success + * else + * //failure + * + * //Downloads an email nth-attachment from server + * prinf("Enter attachment number\n"); + * scanf("%d",&attachment_id); + * if(EMAIL_ERROR_NONE == email_download_attachment(mail_id, attachment_id, &handle)) + * //success + * else + * //failure + * + * //Cancel job + * if(EMAIL_ERROR_NONE == email_cancel_job(account_id,handle))//canceling download email nth attachment from server job. + * //so this handle contains the value return by the email_download_attachment() + * //success + * else + * //failure + * //Gets pending job list for an account + * + * printf( " Enter Action \n SEND_MAIL = 0 \n SYNC_HEADER = 1 \n" \ + * " DOWNLOAD_BODY,= 2 \n DOWNLOAD_ATTACHMENT = 3 \n" \ + * " DELETE_MAIL = 4 \n SEARCH_MAIL = 5 \n SAVE_MAIL = 6 \n" \ + * " NUM = 7 \n"); + * scanf("%d",&action); + * if(EMAIL_ERROR_NONE == email_get_pending_job(action,account_id,mail_id,&status)) + * //success + * else + * //error + * + * //Gets Network status + * if(EMAIL_ERROR_NONE == email_get_network_status(&sending,&receiving)) + * //success + * else + * //failure + * + * //Sends read report + * if(EMAIL_ERROR_NONE == email_send_report(mail ,&handle)) + * //success + * else + * //failure + * //Saves and sends + * + * + * if(EMAIL_ERROR_NONE == email_add_mail(mail,NULL,0, NULL, 0)) + * { + * if(EMAIL_ERROR_NONE == email_send_saved(account_id,&option,&handle)) + * //success + * else + * //failure + * } + * //Get Imap mailbox list + * if(EMAIL_ERROR_NONE == email_sync_imap_mailbox_list(account_id, &handle)) + * //success + * else + * //failure * * } * * @endcode * @} - */ +/** + * @internal + * @ingroup EMAIL_SERVICE_FRAMEWORK + * @defgroup EMAIL_SERVICE_NETWORK_MODULE Network API + * @brief Network API is a set of operations to manage email send, receive and cancel related details. + * + * @section EMAIL_SERVICE_NETWORK_MODULE_HEADER Required Header + * \#include <email-api-network.h> + * + * @section EMAIL_SERVICE_NETWORK_MODULE_OVERVIEW Overview + * Network API is a set of operations to manage email send, receive and cancel related details. + */ +/** + * @internal +* @addtogroup EMAIL_SERVICE_NETWORK_MODULE +* @{ +*/ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** - * @fn email_send_mail(int mail_id, int *handle) - * @brief Send a mail.This function is invoked when user wants to send a composed mail. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] mail_id Specifies the mail ID. - * @param[out] handle Specifies the sending handle. - * @exception none - * @see email_mailbox_t and email_option_t - * @remarks N/A + * @brief Sends a mail. + * @details This function is invoked when a user wants to send a composed mail. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] mail_id The mail ID + * @param[out] handle The sending handle + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t and #email_option_t */ EXPORT_API int email_send_mail(int mail_id, int *handle); /** - * @fn email_send_mail_with_downloading_attachment_of_original_mail(int input_mail_id, int *output_handle) - * @brief Send a mail. This function is invoked when user wants to send the mail, not been downloaded the attachment. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_mail_id Specifies the mail ID. - * @param[out] handle Specifies the sending handle. - * @exception none - * @see email_mailbox_t and email_option_t - * @remarks N/A + * @brief Sends a mail. + * @details This function is invoked when a user wants to send the mail, not been downloaded the attachment. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] input_mail_id The mail ID + * @param[out] handle The sending handle + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t and #email_option_t */ EXPORT_API int email_send_mail_with_downloading_attachment_of_original_mail(int input_mail_id, int *output_handle); /** - * @fn email_schedule_sending_mail(int input_mail_id, time_t input_time) - * @brief Send a mail. This function is invoked when user wants to send the scheduled mail. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_mail_id Specifies the mail ID. - * @param[out] input_time Specifies the scheduled time. - * @exception none - * @see email_mailbox_t and email_option_t - * @remarks N/A + * @brief Sends a mail. + * @details This function is invoked when a user wants to send the scheduled mail. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] input_mail_id The mail ID + * @param[out] input_time The scheduled time + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (refer to #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t and #email_option_t */ EXPORT_API int email_schedule_sending_mail(int input_mail_id, time_t input_time); /** - * @fn email_sync_header(int input_account_id, int input_mailbox_id, int *handle) - * @brief Download header of new emails from mail server.This function is invoked when user wants to download only header of new mails. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_account_id Specifies the account ID. - * @param[in] input_mailbox_id Specifies the mailbox ID. - * @param[out] handle Specifies the handle for stopping downloading. - * @exception none - * @see email_mailbox_t - * @remarks N/A + * @brief Downloads headers of new emails from the mail server. + * @details This function is invoked when a user wants to download only the headers of new mails. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] input_account_id The account ID + * @param[in] input_mailbox_id The mailbox ID + * @param[out] handle The handle for stopping downloading + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t */ EXPORT_API int email_sync_header(int input_account_id, int input_mailbox_id, int *handle); /** - * @fn email_sync_header_for_all_account(int *handle) - * @brief Download header of new emails from mail server for all emails.This function is invoked when user wants to download header of new mails for all accounts. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[out] handle Specifies the handle for stopping downloading. - * @exception none - * @see none - * @remarks N/A + * @brief Downloads headers of new emails from the mail server for all emails. + * @details This function is invoked when a user wants to download headers of new mails for all accounts. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[out] handle The handle for stopping downloading + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_sync_header_for_all_account(int *handle); /** - - * @fn email_download_body(int mail_id, int with_attachment, int *handle) - * @brief Download email body from server.This function is invoked when user wants to download email body with/without attachment based on the option with_attachment - * from the server. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] mail_id Specifies the mail ID. - * @param[in] with_attachment Specifies the whether attachment is there or not. - * @param[out] handle Specifies the handle for stopping downloading. - * @exception none - * @see email_mailbox_t - * @remarks N/A + * @brief Downloads an email body from the server. + * @details This function is invoked when a user wants to download email body with/without attachment based on the @a with_attachment option + * from the server. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] mail_id The mail ID + * @param[in] with_attachment The flag indicating whether there is an attachment + * @param[out] handle The handle for stopping downloading + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t */ EXPORT_API int email_download_body(int mail_id, int with_attachment, int *handle); - - - - /** - * @fn email_download_attachment(int mail_id, const char* nth, int *handle); - * @brief Download a email nth-attachment from server.This function is invoked if user wants to download only specific attachment of a mail whose body is already downloaded. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] mail_id Specifies the mail ID. - * @param[in] nth Specifies the attachment number been saved. the minimum number is "1". - * @param[out] handle Specifies the handle for stopping downloading. - * @exception none - * @see email_mailbox_t - * @remarks N/A + * @brief Downloads an email nth-attachment from the server. + * @details This function is invoked if a user wants to download only specific attachment of a mail whose body is already downloaded. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] mail_id The mail ID + * @param[in] nth The attachment number been saved (The minimum number is "1") + * @param[out] handle The handle for stopping downloading + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_mailbox_t */ EXPORT_API int email_download_attachment(int mail_id, int nth, int *handle); /** - * @fn email_cancel_job(int account_id, int handle); - * @brief cancel the ongoing job.This function is invoked if user wants to cancel any ongoing job of a specified account. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] input_account_id Specifies the account ID. - * @param[in] input_handle Specifies the handle for stopping the operation. - * @param[in] input_cancel_type Specifies the type of cancellation. - * @exception none - * @see none - * @remarks N/A + * @brief Cancels the ongoing job. + * @details This function is invoked if a user wants to cancel any ongoing job of a specified account. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] input_account_id The account ID + * @param[in] input_handle The handle for stopping the operation + * @param[in] input_cancel_type The type of cancellation + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_cancel_job(int input_account_id, int input_handle, email_cancelation_type input_cancel_type); @@ -287,90 +317,67 @@ EXPORT_API int email_get_pending_job(email_action_t action, int account_id, int EXPORT_API int email_get_network_status(int* on_sending, int* on_receiving) DEPRECATED; /** - * @fn email_get_task_information(email_task_information_t *output_task_information) - * @brief This function gives the current job information. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[out] output_task_information The array of job information. - * @param[out] output_task_information_count The count of job information. - * @exception none - * @see none - * @remarks N/A + * @brief Gives the current job information. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[out] output_task_information The array of job information + * @param[out] output_task_information_count The count of job information + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_get_task_information(email_task_information_t **output_task_information, int *output_task_information_count); /** - * @fn email_send_saved(int account_id, int *handle) - * @brief Send all mails to been saved in Offline-mode.This function is invoked when user wants to send an email and after saving it. - * This will save the email in draft mailbox and then sends. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] account_id Specifies the account ID. - * @param[out] handle Specifies the handle for stopping sending. - * @exception none - * @see email_option_t - * @remarks N/A + * @brief Sends all mails to be saved in offline-mode. + * @details This function is invoked when a user wants to send an email and saving it afterwards. + * This will save the email in draft mailbox and then send it. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] account_id The account ID + * @param[out] handle The handle for stopping sending + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @see #email_option_t */ EXPORT_API int email_send_saved(int account_id, int *handle); /** - - * @fn email_sync_imap_mailbox_list(int account_id, int *handle) - * @brief fetch all the mailbox names from server and store the non-existing mailboxes in DB.This function is invoked when user wants to download all server mailboxes from IMAP server - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] account_id Specifies the account ID. - * @param[out] handle Specifies the handle for stopping Network operation. - * @exception none - * @see none - * @remarks N/A + * @brief Fetches all mailbox names from the server and stores the non-existing mailboxes in the DB. + * @details This function is invoked when a user wants to download all server mailboxes from IMAP server. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] account_id The account ID + * @param[out] handle The handle for stopping Network operation + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_sync_imap_mailbox_list(int account_id, int *handle); /** - - * @fn email_search_mail_on_server(int input_account_id, int input_mailbox_id, email_search_filter_t *input_search_filter_list, int input_search_filter_count, int *output_handle) - * @brief Search the mails on server. - * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] account_id Specifies the Account ID - * @param[in] mailbox_id Specifies the Mailbox ID - * @param[in] search_type Specifies the searching type(EMAIL_SEARCH_FILTER_SUBJECT, EMAIL_SEARCH_FILTER_SENDER, EMAIL_SEARCH_FILTER_RECIPIENT, EMAIL_SEARCH_FILTER_ALL) - * @param[in] search_value Specifies the value to use for searching. (ex : Subject, email address, display name) - * @exception none - * @see email_search_filter_t, - * @code - * @endcode - * @remarks N/A - */ -EXPORT_API int email_search_mail_on_server(int input_account_id, int input_mailbox_id, email_search_filter_t *input_search_filter_list, int input_search_filter_count, int *output_handle); - -/** - - * @fn email_clear_result_of_search_mail_on_server(int input_account_id) - * @brief Delete the temporarily downloaded mails on local storage. + * @brief Queries the maximum mail size limit from the SMTP server. * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] account_id Specifies the Account ID - * @exception none - * @see email_search_filter_t, - * @code - * @endcode - * @remarks N/A - */ -EXPORT_API int email_clear_result_of_search_mail_on_server(int input_account_id); - -/** - - * @fn email_query_smtp_mail_size_limit(int account_id) - * @brief query maximum mail size limit from smtp server + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] account_id Specifies the Account ID - * @exception none - * @code - * @endcode - * @remarks N/A + * @param[in] account_id The Account ID + * @param[out] handle The handle for stopping Network operation + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_query_smtp_mail_size_limit(int account_id, int *handle); @@ -379,8 +386,8 @@ EXPORT_API int email_query_smtp_mail_size_limit(int account_id, int *handle); #endif /* __cplusplus */ /** -* @} -*/ + * @} + */ #endif /* __EMAIL_API_NETWORK_H__ */ diff --git a/email-api/include/email-api-rule.h b/email-api/include/email-api-rule.h index befcbc3..68b5644 100755 --- a/email-api/include/email-api-rule.h +++ b/email-api/include/email-api-rule.h @@ -26,192 +26,218 @@ #include "email-types.h" /** -* @defgroup EMAIL_SERVICE Email Service -* @{ -*/ - -/** -* @ingroup EMAIL_SERVICE -* @defgroup EMAIL_API_RULE Email Rule API -* @{ -*/ - - /** + * @file email-api-rule.h + * @brief This file contains the data structures and interfaces of Rule related Functionality provided by email-service. * - * This file contains the data structures and interfaces needed for application, - * to interact with email-service. - * @file email-api-rule.h - * @author Kyuho Jo <kyuho.jo@samsung.com> - * @author Sunghyun Kwon <sh0701.kwon@samsung.com> - * @version 0.1 - * @brief This file contains the data structures and interfaces of Rule related Functionality provided by - * email-service . * @{ - * @code - * #include "email-api-rule.h" - * bool - * other_app_invoke_uniform_api_sample(int* error_code) - * { - * int err = EMAIL_ERROR_NONE; - * email_rule_t* rule = NULL; - * int filter_id = 1; - * int count = 0; - * - * // Get a information of filtering - * printf("Enter filter Id:\n"); - * scanf("%d",&filter_id); - * - * if(EMAIL_ERROR_NONE == email_get_rule (filter_id,&rule)) - * //success - * else - * //failure - * - * // Get all filterings - * if(EMAIL_ERROR_NONE == email_get_rule_list(&rule,&count)) - * //success - * else - * //failure - * - * - * // Add a filter information - * if(EMAIL_ERROR_NONE == email_add_rule (rule)) - * //success - * else - * //failure - * err = email_free_rule (&rule,1); - * - * // Change a filter information - * if(EMAIL_ERROR_NONE == email_update_rule (filter_id,rule)) - * //success - * else - * //failure - * err = email_free_rule (&rule,1); - * - * // Delete a filter information - * printf("Enter filter Id:\n"); - * scanf("%d",&filter_id); - * - * if(EMAIL_ERROR_NONE == email_delete_rule (filter_id)) - * //success - * else - * //failure - * - * // Free allocated memory - * if(EMAIL_ERROR_NONE == email_free_rule (&rule,1)) - * //success - * else - * //failure - * - * } + * #include "email-api-rule.h" + * bool + * other_app_invoke_uniform_api_sample(int* error_code) + * { + * int err = EMAIL_ERROR_NONE; + * email_rule_t* rule = NULL; + * int filter_id = 1; + * int count = 0; + * + * // Gets information of filtering + * printf("Enter filter Id:\n"); + * scanf("%d",&filter_id); + * + * if(EMAIL_ERROR_NONE == email_get_rule (filter_id,&rule)) + * //success + * else + * //failure + * + * // Get all filterings + * if(EMAIL_ERROR_NONE == email_get_rule_list(&rule,&count)) + * //success + * else + * //failure + * + * + * // Adds a filter information + * if(EMAIL_ERROR_NONE == email_add_rule (rule)) + * //success + * else + * //failure + * err = email_free_rule (&rule,1); + * + * // Changes a filter information + * if(EMAIL_ERROR_NONE == email_update_rule (filter_id,rule)) + * //success + * else + * //failure + * err = email_free_rule (&rule,1); + * + * // Deletes a filter information + * printf("Enter filter Id:\n"); + * scanf("%d",&filter_id); + * + * if(EMAIL_ERROR_NONE == email_delete_rule (filter_id)) + * //success + * else + * //failure + * + * // Free allocated memory + * if(EMAIL_ERROR_NONE == email_free_rule (&rule,1)) + * //success + * else + * //failure + * + * } * * @endcode * @} */ +/** + * @internal + * @ingroup EMAIL_SERVICE_FRAMEWORK + * @defgroup EMAIL_SERVICE_RULE_MOUDLE Rule API + * @brief Rule API is a set of operations to manage email rules like add, get, delete or update rule related details. + * + * @section EMAIL_SERVICE_RULE_MOUDLE_HEADER Required Header + * \#include <email-api-rule.h> + * + * @section EMAIL_SERVICE_RULE_MOUDLE_OVERVIEW Overview + * Rule API is a set of operations to manage email rules like add, get, delete or update rule related details. + */ +/** + * @internal + * @addtogroup EMAIL_SERVICE_RULE_MOUDLE + * @{ + */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** - - - * @fn email_get_rule(int filter_id, email_rule_t** filtering_set) - * @brief Get a information of filtering. + * @brief Gets a filter rule. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] filter_id The filter ID + * @param[out] filtering_set The filter rule * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure - * @param[in] filter_id Specifies the filter ID. - * @param[out] filtering_set The returned information of filter are saved here. - * @exception EMAIL_ERROR_INVALID_PARAM -Invalid argument - * @see email_rule_t - * @remarks N/A + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @retval #EMAIL_ERROR_INVALID_PARAM Invalid argument + * + * @see #email_rule_t */ EXPORT_API int email_get_rule(int filter_id, email_rule_t** filtering_set); /** - - - * @fn email_get_rule_list(email_rule_t** filtering_set, int* count) - * @brief Get all filterings.This function gives all the filter rules already set before by user. - * This will provide total number of filter rules available and information of all rules. + * @brief Gets all filter rules. + * @details This function gives all the filter rules already set before by user. + * This will provide total number of filter rules available and information of all rules. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[out] filtering_set The filtering rules (possibly @c NULL) + * @param[out] count The count of returned filters (possibly @c 0) * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure - * @param[out] filtering_set The returned filterings are saved here.(possibly NULL) - * @param[out] count The count of returned filters is saved here.(possibly 0) - * @exception EMAIL_ERROR_INVALID_PARAM -Invalid argument - * @see email_rule_t - * @remarks N/A + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @retval EMAIL_ERROR_INVALID_PARAM Invalid argument + * + * @see #email_rule_t */ EXPORT_API int email_get_rule_list(email_rule_t** filtering_set, int* count); /** - - - * @fn email_add_rule(email_rule_t* filtering_set) - * @brief Add a filter information.This function is invoked if user wants to add a new filter rule. + * @brief Adds a filter rule. + * @details This function is invoked if a user wants to add a new filter rule. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] filtering_set The pointer of adding a filter structure + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise error code (see #EMAIL_ERROR_XXX) on failure * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] filtering_set Specifies the pointer of adding filter structure. - * @exception EMAIL_ERROR_INVALID_PARAM -Invalid argument - * @see email_rule_t - * @remarks N/A + * @retval EMAIL_ERROR_INVALID_PARAM Invalid argument + * + * @see #email_rule_t */ EXPORT_API int email_add_rule(email_rule_t* filtering_set); /** - - - * @fn email_update_rule(int filter_id, email_rule_t* new_set) - * @brief Change a filter information.This function will update the existing filter rule with new information. + * @brief Changes a filter rule. + * @details This function will update the existing filter rule with new information. * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @param[in] filter_id Specifies the original filter ID. - * @param[in] new_set Specifies the information of new filter. - * @exception EMAIL_ERROR_INVALID_PARAM -Invalid argument - * @see email_rule_t - * @remarks N/A + * @param[in] filter_id The original filter ID + * @param[in] new_set The information of new filter + + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @retval EMAIL_ERROR_INVALID_PARAM Invalid argument + * + * @see #email_rule_t */ EXPORT_API int email_update_rule(int filter_id, email_rule_t* new_set); /** - - * @fn email_delete_rule(int filter_id) - * @brief Delete a filter information.This function will delete the exsting filter information by specified filter Id. + * @brief Deletes a filter rule. + * @details This function will delete the existing filter information by the specified filter ID. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] filter_id The filter ID + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure - * @param[in] filter_id Specifies the filter ID. - * @exception EMAIL_ERROR_INVALID_PARAM -Invalid argument - * @see none - * @remarks N/A + * @retval EMAIL_ERROR_INVALID_PARAM Invalid argument */ EXPORT_API int email_delete_rule(int filter_id); /** - - * @fn email_free_rule (email_rule_t** filtering_set, int count) - * @brief Free allocated memory. + * @brief Frees allocated memory. + * + * @since_tizen 2.3 + * @privlevel N/P + * + * @param[in] filtering_set The pointer of pointer of filter structure for memory freeing + * @param[in] count The count of filter * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure - * @param[in] filtering_set Specifies the pointer of pointer of filter structure for memory free. - * @param[in] count Specifies the count of filter. - * @exception EMAIL_ERROR_INVALID_PARAM -Invalid argument - * @see email_rule_t - * @remarks N/A + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @retval EMAIL_ERROR_INVALID_PARAM Invalid argument + * + * @see #email_rule_t */ EXPORT_API int email_free_rule (email_rule_t** filtering_set, int count); /** - - * @fn email_apply_rule(int filter_id) - * @brief Delete a filter information.This function will delete the exsting filter information by specified filter Id. + * @brief Deletes a filter rule. + * @details This function will delete the existing filter information by the specified filter ID. * - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure - * @param[in] filter_id Specifies the filter ID. - * @exception EMAIL_ERROR_INVALID_PARAM -Invalid argument - * @see none - * @remarks N/A + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] filter_id The filter ID + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + * + * @retval EMAIL_ERROR_INVALID_PARAM Invalid argument */ EXPORT_API int email_apply_rule(int filter_id); @@ -220,8 +246,8 @@ EXPORT_API int email_apply_rule(int filter_id); #endif /* __cplusplus */ /** -* @} @} -*/ + * @} + */ #endif /* __EMAIL_API_RULE_H__ */ diff --git a/email-api/include/email-api-smime.h b/email-api/include/email-api-smime.h index fc66834..a9d27d8 100755 --- a/email-api/include/email-api-smime.h +++ b/email-api/include/email-api-smime.h @@ -29,136 +29,198 @@ extern "C" { #endif /* __cplusplus */ /** + * @file email-api-smime.h + */ - * @fn email_add_certificate(char *certificate_path, char *email_address) - * @brief Store infomations of public certificate in database. +/** + * @internal + * @ingroup EMAIL_SERVICE_FRAMEWORK + * @defgroup EMAIL_SERVICE_SMIME_MODULE SMIME API + * @brief SMIME API is a set of operations to handle SMIME data for secured email. * - * @param[in] certificate_path File path of public certificate. - * @param[in] email_address Keyword for searching the certificate information - * @exception none - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @see - * @remarks N/A + * @section EMAIL_SERVICE_SMIME_MODULE_HEADER Required Header + * \#include <email-api-smime.h> + * + * @section EMAIL_SERVICE_SMIME_MODULE_OVERVIEW Overview + * SMIME API is a set of operations to handle SMIME data for secured email. */ -EXPORT_API int email_add_certificate(char *certificate_path, char *email_address); /** + * @internal + * @addtogroup EMAIL_SERVICE_SMIME_MODULE + * @{ + */ + - * @fn email_delete_certificate(char *email_address) - * @brief Delete infomations of public certificate in database. +/** + * @brief Stores a public certificate information in the database. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email * - * @param[in] email_address Keyword for deleting the certificate information - * @exception none - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @see - * @remarks N/A + * @param[in] certificate_path The file path of public certificate + * @param[in] email_address The keyword for searching the certificate information + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ -EXPORT_API int email_delete_certificate(char *email_address); +EXPORT_API int email_add_certificate(char *certificate_path, char *email_address); /** + * @brief Deletes a public certificate information from the database. + * + * @param[in] email_address The keyword for deleting the certificate information + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + */ +EXPORT_API int email_delete_certificate(char *email_address); - * @fn email_get_certificate(char *email_address, email_certificate_t **certificate) - * @brief Get infomations of public certificate in database. +/** + * @brief Gets the the public certificate information from the database. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email * - * @param[in] email_address Keyword for geting the certificate information - * @param[out] certificate Specifies the certificate - * @exception none - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @see - * @remarks N/A + * @param[in] email_address The keyword for getting the certificate information + * @param[out] certificate The certificate + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_get_certificate(char *email_address, email_certificate_t **certificate); /** + * @brief Gets a decrypted message. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] mail_id The mail ID + * @param[out] output_mail_data The mail data + * @param[out] output_attachment_data The mail attachment data + * @param[out] output_attachment_count The count of attachment + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure + */ +EXPORT_API int email_get_decrypt_message(int mail_id, email_mail_data_t **output_mail_data, email_attachment_data_t **output_attachment_data, int *output_attachment_count); - * @fn email_get_decrypt_message(int mail_id, email_mail_data_t **output_mail_data, email_attachment_data_t **output_attachment_data, int *output_attachment_count); - - * @brief Get the decrypted message - * @param[in] mail_id Specifies the mail_id - * @param[out] output_mail_data Specifies the mail_data +/** + * @brief Gets a decrypted message. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * @param[in] input_mail_data Specifies the signed mail data + * @param[in] input_attachment_data Specifies the attachment of signed mail + * @param[in] input_attachment_count Specifies the attachment count of signed mail + * @param[out] output_mail_data Specifies the mail_data * @param[out] output_attachment_data Specifies the mail_attachment_data * @param[out] output_attachment_count Specifies the count of attachment - * @exception none - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @see - * @remarks N/A + * @return EMAIL_ERROR_NONE on success or an error code (refer to EMAIL_ERROR_XXX) on failure */ -EXPORT_API int email_get_decrypt_message(int mail_id, email_mail_data_t **output_mail_data, email_attachment_data_t **output_attachment_data, int *output_attachment_count); - +EXPORT_API int email_get_decrypt_message_ex(email_mail_data_t *input_mail_data, email_attachment_data_t *input_attachment_data, int input_attachment_count, + email_mail_data_t **output_mail_data, email_attachment_data_t **output_attachment_data, int *output_attachment_count); /** - - * @fn email_verify_signature(int mail_id, int *verify); - - * @brief Verify the signed mail - * @param[in] mail_id Specifies the mail_id - * @param[out] verify Specifies verify [false : failed verify, true : success the verification] - * @exception none - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @see - * @remarks N/A + * @brief Verifies a signed mail. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] mail_id The mail ID + * @param[out] verify The verification state \n + * [false : failed verification, true : verification successful] + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_verify_signature(int mail_id, int *verify); +/** +* @brief Verifies a signed mail. +* @since_tizen 2.3 +* +* @param[in] input_mail_data The signed mail data +* @param[in] input_attachment_data The attachment of signed mail +* @param[in] input_attachment_count The attachment count of signed mail +* @param[out] verify The verification status \n +* false : failed verification, true : verification successful +* +* @return #EMAIL_ERROR_NONE on success, +* otherwise an error code (see #EMAIL_ERROR_XXX) on failure +*/ EXPORT_API int email_verify_signature_ex(email_mail_data_t *input_mail_data, email_attachment_data_t *input_attachment_data, int input_attachment_count, int *verify); /** - - * @fn email_verify_certificate(char *certificate_path, int *verify); - - * @brief Verify the certificate - * @param[in] certificate_path Specifies the path of certificate - * @param[out] verify Specifies verify [false : failed verify, true : success the verification] - * @exception none - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @see - * @remarks N/A + * @brief Verifies a certificate. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] certificate_path The path of the certificate + * @param[out] verify The verification status \n + * false : failed verification, true : verification successful + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_verify_certificate(char *certificate_path, int *verify); /** - - * @fn email_get_resolve_recipients(int account_id, char *email_address, unsigned *handle); - - * @brief Get the certificate at the server [Using exchange server] - * @param[in] account_id Specifies an account_id - * @param[in] email_address Specifies email address for getting certificate - * @param[out] handle Specifies the handle for stopping - * @exception none - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @see - * @remarks N/A + * @brief Gets the certificate from the server (using exchange server). + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] account_id The account ID + * @param[in] email_address The email address that gets a certificate + * @param[out] handle The handle for stopping + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_get_resolve_recipients(int account_id, char *email_address, unsigned *handle); /** - - * @fn email_validate_certificate(int account_id, char *email_address, unsigned *handle); - - * @brief Verfiy the certificate to the server [Using exchange server] - * @param[in] account_id Specifies an account_id - * @param[in] email_address Specifies email address for validating certificate - * @param[out] handle Specifies the handle for stopping - * @exception none - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @see - * @remarks N/A + * @brief Verifies the certificate to the server (using exchange server). + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/email + * + * @param[in] account_id The account ID + * @param[in] email_address The email address that validates a certificate + * @param[out] handle The handle for stopping + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise an error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_validate_certificate(int account_id, char *email_address, unsigned *handle); /** - - * @fn email_free_certificate(email_certificate_t **certificate, int count); - - * @brief Free the memory of certificate - * @param[in] certificate Specifies the certificate - * @param[in] count Specifies the count of certificates - * @exception none - * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure. - * @see - * @remarks N/A + * @brief Frees the memory of the certificate. + * + * @since_tizen 2.3 + * @privlevel N/P + * + * @param[in] certificate The certificate + * @param[in] count The count of certificates + * + * @return #EMAIL_ERROR_NONE on success, + * otherwise error code (see #EMAIL_ERROR_XXX) on failure */ EXPORT_API int email_free_certificate(email_certificate_t **certificate, int count); +/** + * @} + */ + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/email-api/include/email-api.h b/email-api/include/email-api.h index 8da1b26..e3841e9 100755 --- a/email-api/include/email-api.h +++ b/email-api/include/email-api.h @@ -35,26 +35,9 @@ #include "email-api-smime.h" #include "email-api-etc.h" - /** -* @defgroup EMAIL_SERVICE Email Service -* @{ -*/ - -/** -* @{ -*/ - -/** - * - * This file contains the data structures and interfaces needed for application, - * to interact with email-service. - * @file email-api.h - * @author Kyuho Jo <kyuho.jo@samsung.com> - * @author Sunghyun Kwon <sh0701.kwon@samsung.com> - * @version 0.1 - * @brief This file contains the data structures and interfaces provided by - * email-service. + * @file email-api.h + * @brief This file contains the data structures and interfaces provided by email-service. */ @@ -67,9 +50,6 @@ extern "C" { } #endif -/** -* @} @} -*/ #endif /* __EMAIL_MAPI_H__ */ |