summaryrefslogtreecommitdiff
path: root/email-api
diff options
context:
space:
mode:
Diffstat (limited to 'email-api')
-rwxr-xr-xemail-api/doc/email-service_doc.h2
-rwxr-xr-xemail-api/email-api-account.c189
-rwxr-xr-xemail-api/email-api-etc.c51
-rwxr-xr-xemail-api/email-api-init.c41
-rwxr-xr-xemail-api/email-api-mail.c231
-rwxr-xr-xemail-api/email-api-mailbox.c313
-rwxr-xr-xemail-api/email-api-network.c407
-rwxr-xr-xemail-api/email-api-rule.c26
-rwxr-xr-xemail-api/email-api-smime.c134
-rwxr-xr-xemail-api/include/email-api-account.h2
-rwxr-xr-xemail-api/include/email-api-etc.h2
-rwxr-xr-xemail-api/include/email-api-init.h2
-rwxr-xr-xemail-api/include/email-api-mail.h2
-rwxr-xr-xemail-api/include/email-api-mailbox.h2
-rwxr-xr-xemail-api/include/email-api-network.h45
-rwxr-xr-xemail-api/include/email-api-rule.h2
-rwxr-xr-xemail-api/include/email-api-smime.h20
17 files changed, 1128 insertions, 343 deletions
diff --git a/email-api/doc/email-service_doc.h b/email-api/doc/email-service_doc.h
index 0625199..6c31c9e 100755
--- a/email-api/doc/email-service_doc.h
+++ b/email-api/doc/email-service_doc.h
@@ -19,11 +19,9 @@
#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
*
diff --git a/email-api/email-api-account.c b/email-api/email-api-account.c
index 08702c3..648e17f 100755
--- a/email-api/email-api-account.c
+++ b/email-api/email-api-account.c
@@ -29,7 +29,6 @@
* email-service .
*/
-#include "email-api.h"
#include "string.h"
#include "email-convert.h"
#include "email-api-account.h"
@@ -45,10 +44,11 @@
EXPORT_API int email_add_account(email_account_t* account)
{
EM_DEBUG_API_BEGIN ("account[%p]", account);
- char* local_account_stream = NULL;
int size = 0;
int err = EMAIL_ERROR_NONE;
int ret_from_ipc = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
+ char* local_account_stream = NULL;
HIPC_API hAPI = NULL;
if (account == NULL || account->user_email_address == NULL || account->incoming_server_user_name == NULL || account->incoming_server_address == NULL||
@@ -57,38 +57,53 @@ EXPORT_API int email_add_account(email_account_t* account)
return EMAIL_ERROR_INVALID_PARAM;
}
- if(emstorage_check_duplicated_account(account, true, &err) == false) {
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
+ if (!emstorage_check_duplicated_account(multi_user_name, account, true, &err)) {
EM_DEBUG_EXCEPTION("emstorage_check_duplicated_account failed (%d) ", err);
- return err;
+ goto FINISH_OFF;
}
/* composing account information to be added */
hAPI = emipc_create_email_api(_EMAIL_API_ADD_ACCOUNT);
- EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE);
+ if (hAPI == NULL) {
+ EM_DEBUG_EXCEPTION("emipc_create_email_api failed");
+ err = EMAIL_ERROR_NULL_VALUE;
+ goto FINISH_OFF;
+ }
local_account_stream = em_convert_account_to_byte_stream(account, &size);
- EM_PROXY_IF_NULL_RETURN_VALUE(local_account_stream, hAPI, EMAIL_ERROR_NULL_VALUE);
+ if (local_account_stream == NULL) {
+ EM_DEBUG_EXCEPTION("em_convert_account_to_byte_stream failed");
+ err = EMAIL_ERROR_NULL_VALUE;
+ goto FINISH_OFF;
+ }
- if(!emipc_add_dynamic_parameter(hAPI, ePARAMETER_IN, local_account_stream, size)) {
+ if (!emipc_add_dynamic_parameter(hAPI, ePARAMETER_IN, local_account_stream, size)) {
EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
- EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE);
+ err = EMAIL_ERROR_NULL_VALUE;
+ goto FINISH_OFF;
}
EM_DEBUG_LOG("APPID[%d], APIID [%d]", emipc_get_app_id(hAPI), emipc_get_api_id(hAPI));
/* passing account information to service */
- 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);
+ err = EMAIL_ERROR_IPC_SOCKET_FAILURE;
+ goto FINISH_OFF;
}
/* get result from service */
- if( (ret_from_ipc = emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err)) != EMAIL_ERROR_NONE) {
+ if ((ret_from_ipc = emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err)) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emipc_get_parameter failed [%d]", ret_from_ipc);
err = ret_from_ipc;
goto FINISH_OFF;
}
- if(err == EMAIL_ERROR_NONE) {
+ if (err == EMAIL_ERROR_NONE) {
emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &account->account_id);
}
else { /* get error code */
@@ -97,9 +112,11 @@ EXPORT_API int email_add_account(email_account_t* account)
FINISH_OFF:
- if(hAPI)
+ if (hAPI)
emipc_destroy_email_api(hAPI);
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -182,6 +199,7 @@ EXPORT_API int email_delete_account(int account_id)
if(ret != EMAIL_ERROR_NONE) { /* get error code */
emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &err);
}
+
emipc_destroy_email_api(hAPI);
hAPI = NULL;
@@ -305,16 +323,21 @@ EXPORT_API int email_get_account(int account_id, int pulloption, email_account_t
{
EM_DEBUG_FUNC_BEGIN ("account_id[%d] pulloption[%d]", account_id, pulloption);
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
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);
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
if (pulloption == GET_FULL_DATA)
pulloption = EMAIL_ACC_GET_OPT_FULL_DATA;
- if (!emstorage_get_account_by_id(account_id, pulloption, &account_tbl, true, &err)) {
+ if (!emstorage_get_account_by_id(multi_user_name, account_id, pulloption, &account_tbl, true, &err)) {
if (err != EMAIL_ERROR_SECURED_STORAGE_FAILURE) {
EM_DEBUG_EXCEPTION("emstorage_get_account_by_id failed - %d", err);
goto FINISH_OFF;
@@ -325,7 +348,7 @@ EXPORT_API int email_get_account(int account_id, int pulloption, email_account_t
EM_DEBUG_LOG("change pulloption : disable password");
}
- if (!emstorage_get_account_by_id(account_id, pulloption, &account_tbl, true, &err)) {
+ if (!emstorage_get_account_by_id(multi_user_name, account_id, pulloption, &account_tbl, true, &err)) {
EM_DEBUG_EXCEPTION("emstorage_get_account_by_id failed - %d", err);
goto FINISH_OFF;
}
@@ -340,9 +363,12 @@ EXPORT_API int email_get_account(int account_id, int pulloption, email_account_t
em_convert_account_tbl_to_account(account_tbl, *account);
FINISH_OFF:
+
if (account_tbl)
emstorage_free_account(&account_tbl, 1, NULL);
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_FUNC_END ("err[%d]", err);
return err;
}
@@ -352,15 +378,20 @@ EXPORT_API int email_get_account_list(email_account_t** account_list, int* count
EM_DEBUG_FUNC_BEGIN ();
int err = EMAIL_ERROR_NONE, i = 0;
- emstorage_account_tbl_t *temp_account_tbl = NULL;
+ char *multi_user_name = NULL;
EM_IF_NULL_RETURN_VALUE(account_list, EMAIL_ERROR_INVALID_PARAM);
EM_IF_NULL_RETURN_VALUE(count, EMAIL_ERROR_INVALID_PARAM);
+ emstorage_account_tbl_t *temp_account_tbl = NULL;
+
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
- if (!emstorage_get_account_list(count, &temp_account_tbl , true, false, &err)) {
+ if (!emstorage_get_account_list(multi_user_name, count, &temp_account_tbl , true, false, &err)) {
EM_DEBUG_EXCEPTION("emstorage_get_account_list failed [%d]", err);
-
goto FINISH_OFF;
}
@@ -371,6 +402,7 @@ EXPORT_API int email_get_account_list(email_account_t** account_list, int* count
err = EMAIL_ERROR_OUT_OF_MEMORY;
goto FINISH_OFF;
}
+
memset((void*)*account_list, 0, sizeof(email_account_t) * (*count));
for(i = 0; i < (*count); i++)
em_convert_account_tbl_to_account(temp_account_tbl + i, (*account_list) + i);
@@ -378,9 +410,11 @@ EXPORT_API int email_get_account_list(email_account_t** account_list, int* count
FINISH_OFF:
-
if(temp_account_tbl)
emstorage_free_account(&temp_account_tbl, (*count), NULL);
+
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_FUNC_END ("err[%d]", err);
return err;
@@ -435,7 +469,8 @@ EXPORT_API int email_validate_account_ex(email_account_t* account, int *handle)
int size = 0;
int err = EMAIL_ERROR_NONE;
- if (account == NULL || account->user_email_address == NULL || account->incoming_server_user_name == NULL || account->incoming_server_address == NULL||
+ if (account == NULL || account->user_email_address == NULL ||
+ account->incoming_server_user_name == NULL || account->incoming_server_address == NULL||
account->outgoing_server_user_name == NULL || account->outgoing_server_address == NULL) {
EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM");
return EMAIL_ERROR_INVALID_PARAM;
@@ -480,6 +515,8 @@ EXPORT_API int email_add_account_with_validation(email_account_t* account, int *
int ret = -1;
int size = 0;
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
+ HIPC_API hAPI = NULL;
if (account == NULL || account->user_email_address == NULL || account->incoming_server_user_name == NULL || account->incoming_server_address == NULL||
account->outgoing_server_user_name == NULL || account->outgoing_server_address == NULL) {
@@ -487,25 +524,41 @@ EXPORT_API int email_add_account_with_validation(email_account_t* account, int *
return EMAIL_ERROR_INVALID_PARAM;
}
- if(emstorage_check_duplicated_account(account, true, &err) == false) {
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ return err;
+ }
+
+ if(emstorage_check_duplicated_account(multi_user_name, account, true, &err) == false) {
EM_DEBUG_EXCEPTION("emstorage_check_duplicated_account failed (%d) ", err);
- return err;
+ goto FINISH_OFF;
}
/* create account information */
- HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_ADD_ACCOUNT_WITH_VALIDATION);
- EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE);
+ hAPI = emipc_create_email_api(_EMAIL_API_ADD_ACCOUNT_WITH_VALIDATION);
+ if (hAPI == NULL) {
+ EM_DEBUG_EXCEPTION("emipc_create_email_api failed");
+ err = EMAIL_ERROR_NULL_VALUE;
+ goto FINISH_OFF;
+ }
local_account_stream = em_convert_account_to_byte_stream(account, &size);
- EM_PROXY_IF_NULL_RETURN_VALUE(local_account_stream, hAPI, EMAIL_ERROR_NULL_VALUE);
+ if (local_account_stream == NULL) {
+ EM_DEBUG_EXCEPTION("em_convert_account_to_byte_stream failed");
+ err = EMAIL_ERROR_NULL_VALUE;
+ goto FINISH_OFF;
+ }
+
if(!emipc_add_dynamic_parameter(hAPI, ePARAMETER_IN, local_account_stream, size)) {
EM_DEBUG_EXCEPTION(" emipc_add_parameter failed ");
- EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE);
+ err = EMAIL_ERROR_NULL_VALUE;
+ 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);
+ err = EMAIL_ERROR_IPC_SOCKET_FAILURE;
+ goto FINISH_OFF;
}
emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &ret);
@@ -517,8 +570,14 @@ EXPORT_API int email_add_account_with_validation(email_account_t* account, int *
emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &err);
}
- emipc_destroy_email_api(hAPI);
- hAPI = NULL;
+FINISH_OFF:
+
+ if (hAPI) {
+ emipc_destroy_email_api(hAPI);
+ hAPI = NULL;
+ }
+
+ EM_SAFE_FREE(multi_user_name);
EM_DEBUG_API_END ("err[%d]", err);
return err;
@@ -539,29 +598,46 @@ EXPORT_API int email_backup_accounts_into_secure_storage(const char *file_name)
}
HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_BACKUP_ACCOUNTS);
-
EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE);
+ /* Checked the existed account */
+ int account_count = 0;
+
+ if (!emstorage_get_account_count(NULL, &account_count, false, &err)) {
+ EM_DEBUG_EXCEPTION("emstorage_get_account_count failed - %d", err);
+ goto FINISH_OFF;
+ }
+
+ if (account_count == 0) {
+ EM_DEBUG_LOG("Account is empty");
+ err = EMAIL_ERROR_ACCOUNT_NOT_FOUND;
+ goto FINISH_OFF;
+ }
+
/* file_name */
- if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)file_name, EM_SAFE_STRLEN(file_name)+1)) {
+ 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);
+ err = EMAIL_ERROR_NULL_VALUE;
+ goto FINISH_OFF;
}
- 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);
+ err = EMAIL_ERROR_IPC_SOCKET_FAILURE;
+ goto FINISH_OFF;
}
emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &ret);
- if(0 == ret) { /* get error code */
+ if (ret == false) { /* get error code */
emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &err);
}
- emipc_destroy_email_api(hAPI);
+FINISH_OFF:
+ emipc_destroy_email_api(hAPI);
hAPI = NULL;
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -770,9 +846,25 @@ EXPORT_API int email_save_default_account_id(int input_account_id)
EM_DEBUG_EXCEPTION ("EMAIL_ERROR_INVALID_PARAM");
return EMAIL_ERROR_INVALID_PARAM;
}
+
+ HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_SAVE_DEFAULT_ACCOUNT_ID);
+ EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE);
+
+ /* Input account ID */
+ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char *)&input_account_id, sizeof(int))) {
+ EM_DEBUG_EXCEPTION("emipc_add_parameter input_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);
+ }
- err = emcore_save_default_account_id(input_account_id);
+ 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;
}
@@ -780,9 +872,30 @@ EXPORT_API int email_save_default_account_id(int input_account_id)
EXPORT_API int email_load_default_account_id(int *output_account_id)
{
EM_DEBUG_FUNC_BEGIN ("output_account_id[%p]", output_account_id);
+
int err = EMAIL_ERROR_NONE;
+ int account_id = 0;
+
+ EM_IF_NULL_RETURN_VALUE(output_account_id, EMAIL_ERROR_INVALID_PARAM);
+
+ HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_LOAD_DEFAULT_ACCOUNT_ID);
+ EM_IF_NULL_RETURN_VALUE(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);
+
+ if (err == EMAIL_ERROR_NONE) {
+ emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &account_id);
+ }
+
+ emipc_destroy_email_api(hAPI);
+ hAPI = NULL;
- err = emcore_load_default_account_id(output_account_id);
+ *output_account_id = account_id;
EM_DEBUG_FUNC_END ("ret[%d]", err);
return err;
diff --git a/email-api/email-api-etc.c b/email-api/email-api-etc.c
index 8f8e112..8b046c2 100755
--- a/email-api/email-api-etc.c
+++ b/email-api/email-api-etc.c
@@ -28,7 +28,6 @@
* @brief This file contains the data structures and interfaces of functionalities provided by email-service .
*/
-#include "email-api.h"
#include "email-types.h"
#include "email-ipc.h"
#include "email-debug-log.h"
@@ -44,7 +43,7 @@ EXPORT_API int email_show_user_message(int id, email_action_t action, int error_
EM_DEBUG_API_BEGIN ("id[%d] action[%d] error_code[%d]", id, action, error_code);
int err = EMAIL_ERROR_NONE;
- if(id < 0 || action < 0) {
+ if (id < 0 || action < 0) {
EM_DEBUG_LOG("EMAIL_ERROR_INVALID_PARAM");
return EMAIL_ERROR_INVALID_PARAM;
}
@@ -52,24 +51,24 @@ EXPORT_API int email_show_user_message(int id, email_action_t action, int error_
HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_SHOW_USER_MESSAGE);
/* id */
- if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&id, sizeof(int))) {
+ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&id, sizeof(int))) {
EM_DEBUG_LOG("emipc_add_parameter failed ");
EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE);
}
/* action */
- if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&action, sizeof(int))) {
+ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&action, sizeof(int))) {
EM_DEBUG_LOG("emipc_add_parameter failed ");
EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE);
}
/* error_code */
- if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&error_code, sizeof(int))) {
+ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&error_code, sizeof(int))) {
EM_DEBUG_LOG("emipc_add_parameter failed ");
EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE);
}
- if(!emipc_execute_proxy_api(hAPI)) {
+ if (!emipc_execute_proxy_api(hAPI)) {
EM_DEBUG_LOG("ipcProxy_ExecuteAsyncAPI failed");
EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE);
}
@@ -83,26 +82,32 @@ EXPORT_API int email_show_user_message(int id, email_action_t action, int error_
return err;
}
-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)
+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)
{
- EM_DEBUG_API_BEGIN ("eml_file_path[%p] output_mail_data[%p] output_attachment_data[%p]", eml_file_path, output_mail_data, output_attachment_data);
+ EM_DEBUG_API_BEGIN ("eml_file_path[%p] output_mail_data[%p] output_attachment_data[%p]",
+ eml_file_path, output_mail_data, output_attachment_data);
int err = EMAIL_ERROR_NONE;
EM_IF_NULL_RETURN_VALUE(eml_file_path, EMAIL_ERROR_INVALID_PARAM);
- if (!emcore_parse_mime_file_to_mail(eml_file_path, output_mail_data, output_attachment_data, output_attachment_count, &err) || !*output_mail_data)
+ if (!emcore_parse_mime_file_to_mail(eml_file_path, output_mail_data, output_attachment_data,
+ output_attachment_count, &err) || !*output_mail_data)
EM_DEBUG_EXCEPTION("emcore_parse_mime_file_to_mail failed [%d]", err);
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
-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)
+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)
{
- 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);
+ 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 *ret_nth_value = NULL;
+ int ret_from_ipc = EMAIL_ERROR_NONE;
HIPC_API hAPI = NULL;
EM_IF_NULL_RETURN_VALUE(input_mail_data, EMAIL_ERROR_INVALID_PARAM);
@@ -115,19 +120,21 @@ EXPORT_API int email_write_mime_file(email_mail_data_t *input_mail_data, email_a
goto FINISH_OFF;
}
- if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) {
+ if (!emipc_execute_proxy_api(hAPI)) {
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)) != EMAIL_ERROR_NONE) {
- EM_DEBUG_EXCEPTION("email_write_mime_file failed:[%d]", *ret_nth_value);
- err = *ret_nth_value;
+
+ if ((ret_from_ipc = emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_parameter failed:[%d]", ret_from_ipc);
+ err = ret_from_ipc;
goto FINISH_OFF;
}
- if (!emcore_make_rfc822_file(input_mail_data, input_attachment_data, input_attachment_count, false, output_file_path, &err)) {
+ if (!emcore_make_rfc822_file(NULL, input_mail_data, input_attachment_data, input_attachment_count, false,
+ output_file_path, &err)) {
EM_DEBUG_EXCEPTION("emcore_make_rfc822_file failed : [%d]", err);
}
@@ -144,12 +151,20 @@ EXPORT_API int email_delete_parsed_data(email_mail_data_t *input_mail_data)
{
EM_DEBUG_API_BEGIN ("mail_data[%p]", input_mail_data);
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
EM_IF_NULL_RETURN_VALUE(input_mail_data, EMAIL_ERROR_INVALID_PARAM);
- if (!emcore_delete_parsed_data(input_mail_data, &err))
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ return err;
+ }
+
+ if (!emcore_delete_parsed_data(multi_user_name, input_mail_data, &err))
EM_DEBUG_EXCEPTION("emcore_delete_parsed_data failed [%d]", err);
+ EM_SAFE_FREE(multi_user_name);
+
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 8068824..2adb5fb 100755
--- a/email-api/email-api-init.c
+++ b/email-api/email-api-init.c
@@ -30,7 +30,6 @@
* email-service .
*/
-#include "email-api.h"
#include "string.h"
#include "email-convert.h"
#include "email-storage.h"
@@ -39,6 +38,7 @@
#include "email-core-account.h"
#include "email-utilities.h"
#include "email-dbus-activation.h"
+#include "email-core-container.h"
#include <sqlite3.h>
#include <gio/gio.h>
@@ -46,12 +46,19 @@ EXPORT_API int email_open_db(void)
{
EM_DEBUG_API_BEGIN ();
int error = EMAIL_ERROR_NONE;
-
- if (emstorage_db_open(&error) == NULL)
+ char *multi_user_name = NULL;
+
+ if ((error = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", error);
+ return error;
+ }
+
+ if (emstorage_db_open(multi_user_name, &error) == NULL)
EM_DEBUG_EXCEPTION("emstorage_db_open failed [%d]", error);
-
- EM_DEBUG_API_END ("err[%d]", error);
+ EM_SAFE_FREE(multi_user_name);
+
+ EM_DEBUG_API_END ("error[%d]", error);
return error;
}
@@ -59,11 +66,19 @@ EXPORT_API int email_close_db(void)
{
EM_DEBUG_API_BEGIN ();
int error = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
- if ( !emstorage_db_close(&error))
+ if ((error = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", error);
+ return error;
+ }
+
+ if (!emstorage_db_close(multi_user_name, &error))
EM_DEBUG_EXCEPTION("emstorage_db_close failed [%d]", error);
- EM_DEBUG_API_END ("err[%d]", error);
+ EM_SAFE_FREE(multi_user_name);
+
+ EM_DEBUG_API_END ("error[%d]", error);
return error;
}
@@ -109,12 +124,20 @@ EXPORT_API int email_init_storage(void)
{
EM_DEBUG_API_BEGIN ();
int error = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
- if (!emstorage_create_table(EMAIL_CREATE_DB_NORMAL, &error)) {
+ if ((error = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", error);
+ return error;
+ }
+
+ if (!emstorage_create_table(multi_user_name, EMAIL_CREATE_DB_NORMAL, &error)) {
EM_DEBUG_EXCEPTION("emstorage_create_table failed [%d]", error);
}
- EM_DEBUG_API_END ("err[%d]", error);
+ EM_SAFE_FREE(multi_user_name);
+
+ EM_DEBUG_API_END ("error[%d]", error);
return error;
}
diff --git a/email-api/email-api-mail.c b/email-api/email-api-mail.c
index 46477c0..524da69 100755
--- a/email-api/email-api-mail.c
+++ b/email-api/email-api-mail.c
@@ -33,8 +33,9 @@
#include <stdlib.h>
#include <time.h>
#include <string.h>
-#include "email-api.h"
#include "email-ipc.h"
+#include "email-api-init.h"
+#include "email-api-mailbox.h"
#include "email-convert.h"
#include "email-core-tasks.h"
#include "email-core-utils.h"
@@ -70,19 +71,25 @@ EXPORT_API int email_add_mail(email_mail_data_t *input_mail_data, email_attachme
int *ret_nth_value = NULL;
int size = 0;
char *rfc822_file = NULL;
+ char *multi_user_name = NULL;
char *mail_data_stream = NULL;
char *attachment_data_list_stream = NULL;
char *meeting_request_stream = NULL;
HIPC_API hAPI = NULL;
-
+
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
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, true, &rfc822_file, &err)) {
+ if (!emcore_make_rfc822_file(multi_user_name, 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 = emcore_set_mime_entity(rfc822_file);
+ input_mail_data->file_path_mime_entity = EM_SAFE_STRDUP(emcore_set_mime_entity(rfc822_file));
emstorage_delete_file(rfc822_file, NULL);
EM_SAFE_FREE(rfc822_file);
@@ -165,7 +172,7 @@ EXPORT_API int email_add_mail(email_mail_data_t *input_mail_data, email_attachme
goto FINISH_OFF;
}
} else { /* take care of mails from eas */
- err = emcore_add_mail(input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_from_eas, false);
+ err = emcore_add_mail(multi_user_name, input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_from_eas, false);
if(err != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emcore_add_mail failed [%d]", err);
goto FINISH_OFF;
@@ -173,9 +180,11 @@ EXPORT_API int email_add_mail(email_mail_data_t *input_mail_data, email_attachme
}
FINISH_OFF:
+
if(hAPI)
emipc_destroy_email_api(hAPI);
+ EM_SAFE_FREE(multi_user_name);
EM_DEBUG_API_END ("err[%d]", err);
return err;
@@ -223,7 +232,7 @@ EXPORT_API int email_add_read_receipt(int input_read_mail_id, int *output_receip
#define TMP_BODY_PATH "/tmp/UTF-8"
-int email_create_db_full()
+EXPORT_API int email_create_db_full()
{
int mailbox_index, mail_index, mailbox_count, mail_slot_size;
int account_id = 0;
@@ -238,7 +247,7 @@ int email_create_db_full()
return err;
}
- if ((err = emcore_load_default_account_id(&account_id)) != EMAIL_ERROR_NONE) {
+ if ((err = emcore_load_default_account_id(NULL, &account_id)) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emcore_load_default_account_id failed : [%d]", err);
goto FINISH_OFF;
}
@@ -273,7 +282,8 @@ int email_create_db_full()
sprintf(mail_table_data.subject, "Subject #%d",mail_index);
mail_table_data.mailbox_id = mailbox_list[mailbox_index].mailbox_id;
mail_table_data.mailbox_type = mailbox_list[mailbox_index].mailbox_type;
- if( !emstorage_add_mail(&mail_table_data, 1, true, &err)) {
+
+ if( !emstorage_add_mail(NULL, &mail_table_data, 1, true, &err)) {
EM_DEBUG_EXCEPTION("emstorage_add_mail failed [%d]",err);
goto FINISH_OFF;
@@ -390,7 +400,7 @@ EXPORT_API int email_update_mail(email_mail_data_t *input_mail_data, email_attac
}
}
else {
- if( (err = emcore_update_mail(input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_from_eas)) != EMAIL_ERROR_NONE) {
+ if( (err = emcore_update_mail(NULL, input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_from_eas)) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emcore_update_mail failed [%d]", err);
goto FINISH_OFF;
}
@@ -477,6 +487,7 @@ EXPORT_API int email_count_mail(email_list_filter_t *input_filter_list, int inpu
int total_count = 0;
int unread = 0;
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
char *conditional_clause_string = NULL;
EM_IF_NULL_RETURN_VALUE(input_filter_list, EMAIL_ERROR_INVALID_PARAM);
@@ -484,13 +495,17 @@ 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);
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
- 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) {
+ if ((err = emstorage_write_conditional_clause_for_getting_mail_list(multi_user_name, 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);
goto FINISH_OFF;
}
- if ((err = emstorage_query_mail_count(conditional_clause_string, true, &total_count, &unread)) != EMAIL_ERROR_NONE) {
+ if ((err = emstorage_query_mail_count(multi_user_name, conditional_clause_string, true, &total_count, &unread)) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emstorage_query_mail_count failed [%d]", err);
goto FINISH_OFF;
}
@@ -499,6 +514,8 @@ 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(multi_user_name);
EM_SAFE_FREE (conditional_clause_string); /* detected by valgrind */
EM_DEBUG_API_END ("err[%d]", err);
return err;
@@ -743,15 +760,19 @@ EXPORT_API int email_query_mails(char *conditional_clause_string, email_mail_dat
EM_DEBUG_API_BEGIN ("conditional_clause_string[%s] mail_list[%p] result_count[%p]", conditional_clause_string, mail_list, result_count);
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
emstorage_mail_tbl_t *result_mail_tbl = NULL;
EM_IF_NULL_RETURN_VALUE(result_count, EMAIL_ERROR_INVALID_PARAM);
EM_IF_NULL_RETURN_VALUE(conditional_clause_string, EMAIL_ERROR_INVALID_PARAM);
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed :[%d]", err);
+ goto FINISH_OFF;
+ }
- if (!emstorage_query_mail_tbl(conditional_clause_string, true, &result_mail_tbl, result_count, &err)) {
+ if (!emstorage_query_mail_tbl(multi_user_name, conditional_clause_string, true, &result_mail_tbl, result_count, &err)) {
EM_DEBUG_EXCEPTION("emstorage_query_mail_list failed [%d]", err);
-
goto FINISH_OFF;
}
@@ -761,9 +782,12 @@ EXPORT_API int email_query_mails(char *conditional_clause_string, email_mail_dat
}
FINISH_OFF:
+
if(result_mail_tbl && !emstorage_free_mail(&result_mail_tbl, *result_count, NULL))
EM_DEBUG_EXCEPTION("emstorage_free_mail failed");
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -773,17 +797,24 @@ EXPORT_API int email_query_mail_list(char *input_conditional_clause_string, emai
EM_DEBUG_API_BEGIN ("input_conditional_clause_string[%s] output_mail_list[%p] output_result_count[%p]", input_conditional_clause_string, output_mail_list, output_result_count);
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
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);
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed :[%d]", err);
+ goto FINISH_OFF;
+ }
- if (!emstorage_query_mail_list(input_conditional_clause_string, true, output_mail_list, output_result_count, &err)) {
+ if (!emstorage_query_mail_list(multi_user_name, input_conditional_clause_string, true, output_mail_list, output_result_count, &err)) {
EM_DEBUG_EXCEPTION("emstorage_query_mail_list failed [%d]", err);
goto FINISH_OFF;
}
FINISH_OFF:
+
+ EM_SAFE_FREE(multi_user_name);
EM_DEBUG_API_END ("err [%d]", err);
return err;
}
@@ -864,12 +895,19 @@ FINISH_OFF:
EXPORT_API int email_get_attachment_data_list(int input_mail_id, email_attachment_data_t **output_attachment_data, int *output_attachment_count)
{
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;
+ int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
+
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ return err;
+ }
- if((err = emcore_get_attachment_data_list(input_mail_id, output_attachment_data, output_attachment_count)) != EMAIL_ERROR_NONE) {
+ if((err = emcore_get_attachment_data_list(multi_user_name, input_mail_id, output_attachment_data, output_attachment_count)) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emcore_get_attachment_data_list failed [%d]", err);
}
+ EM_SAFE_FREE(multi_user_name);
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -891,27 +929,34 @@ EXPORT_API int email_get_mail_list_ex(email_list_filter_t *input_filter_list, in
EM_DEBUG_FUNC_BEGIN ("input_filter_list[%p] input_filter_count[%d] input_sorting_rule_list[%p] input_sorting_rule_count[%d] input_start_index[%d] input_limit_count[%d] output_mail_list[%p] output_result_count[%p]", input_filter_list, input_filter_count, input_sorting_rule_list, input_sorting_rule_count, input_start_index, input_limit_count, output_mail_list, output_result_count);
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
char *conditional_clause_string = NULL;
EM_IF_NULL_RETURN_VALUE(output_mail_list, EMAIL_ERROR_INVALID_PARAM);
EM_IF_NULL_RETURN_VALUE(output_result_count, EMAIL_ERROR_INVALID_PARAM);
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
- 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) {
+ if( (err = emstorage_write_conditional_clause_for_getting_mail_list(multi_user_name, 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);
goto FINISH_OFF;
}
EM_DEBUG_LOG_DEV ("conditional_clause_string[%s].", conditional_clause_string);
- if(!emstorage_query_mail_list(conditional_clause_string, true, output_mail_list, output_result_count, &err)) {
+ if(!emstorage_query_mail_list(multi_user_name, conditional_clause_string, true, output_mail_list, output_result_count, &err)) {
if (err != EMAIL_ERROR_MAIL_NOT_FOUND) /* there is no mail and it is definitely common */
EM_DEBUG_EXCEPTION("emstorage_query_mail_list [%d]", err);
goto FINISH_OFF;
}
FINISH_OFF:
+
EM_SAFE_FREE(conditional_clause_string);
+ EM_SAFE_FREE(multi_user_name);
EM_DEBUG_FUNC_END ("err[%d]", err);
return err;
@@ -935,6 +980,7 @@ EXPORT_API int email_get_mails(int account_id , int mailbox_id, int thread_id, i
EM_DEBUG_API_BEGIN ("account_id[%d] mailbox_id[%d] thread_id[%d]", account_id, mailbox_id, thread_id);
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
emstorage_mail_tbl_t *mail_tbl_list = NULL;
EM_IF_NULL_RETURN_VALUE(result_count, EMAIL_ERROR_INVALID_PARAM);
@@ -944,10 +990,13 @@ EXPORT_API int email_get_mails(int account_id , int mailbox_id, int thread_id, i
goto FINISH_OFF;
}
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
- if (!emstorage_get_mails(account_id, mailbox_id, NULL, thread_id, start_index, limit_count, sorting, true, &mail_tbl_list, result_count, &err)) {
+ if (!emstorage_get_mails(multi_user_name, 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);
-
goto FINISH_OFF;
}
@@ -957,9 +1006,12 @@ EXPORT_API int email_get_mails(int account_id , int mailbox_id, int thread_id, i
}
FINISH_OFF:
+
if(mail_tbl_list && !emstorage_free_mail(&mail_tbl_list, *result_count, NULL))
EM_DEBUG_EXCEPTION("emstorage_free_mail failed");
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -969,6 +1021,7 @@ EXPORT_API int email_get_mail_list(int account_id , int mailbox_id, int thread_i
EM_DEBUG_API_BEGIN ("account_id[%d] mailbox_id[%d] thread_id[%d]", account_id, mailbox_id, thread_id);
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
EM_IF_NULL_RETURN_VALUE(result_count, EMAIL_ERROR_INVALID_PARAM);
@@ -977,14 +1030,20 @@ EXPORT_API int email_get_mail_list(int account_id , int mailbox_id, int thread_i
return EMAIL_ERROR_INVALID_PARAM;
}
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
- 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)) {
+ if (!emstorage_get_mail_list(multi_user_name, 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);
-
goto FINISH_OFF;
}
FINISH_OFF:
+
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -994,7 +1053,7 @@ EXPORT_API int email_get_mail_by_address(int account_id , int mailbox_id, email_
{
EM_DEBUG_API_BEGIN ("account_id[%d] mailbox_id[%d]", account_id, mailbox_id);
int err = EMAIL_ERROR_NONE;
-
+ char *multi_user_name = NULL;
email_mail_list_item_t* mail_list_item = NULL;
EM_IF_NULL_RETURN_VALUE(mail_list, EMAIL_ERROR_INVALID_PARAM);
@@ -1006,16 +1065,22 @@ EXPORT_API int email_get_mail_by_address(int account_id , int mailbox_id, email_
return err;
}
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
- 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)) {
+ if (!emstorage_get_mail_list(multi_user_name, 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);
-
goto FINISH_OFF;
}
*mail_list = mail_list_item;
FINISH_OFF:
+
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -1024,12 +1089,17 @@ EXPORT_API int email_get_thread_information_by_thread_id(int thread_id, email_ma
{
EM_DEBUG_API_BEGIN ("thread_id[%d]", thread_id);
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
emstorage_mail_tbl_t *mail_table_data = NULL;
EM_IF_NULL_RETURN_VALUE(thread_info, EMAIL_ERROR_INVALID_PARAM);
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
- if (!emstorage_get_thread_information(thread_id, &mail_table_data , true, &err)) {
+ if (!emstorage_get_thread_information(multi_user_name, thread_id, &mail_table_data , true, &err)) {
EM_DEBUG_EXCEPTION("emstorage_get_thread_information failed [%d]", err);
goto FINISH_OFF;
}
@@ -1044,6 +1114,8 @@ FINISH_OFF:
if(mail_table_data && !emstorage_free_mail(&mail_table_data, 1, NULL))
EM_DEBUG_EXCEPTION("emstorage_free_mail failed");
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -1052,13 +1124,18 @@ EXPORT_API int email_get_thread_information_ex(int thread_id, email_mail_list_it
{
EM_DEBUG_API_BEGIN ("thread_id[%d]", thread_id);
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
emstorage_mail_tbl_t *mail_table_data = NULL;
email_mail_list_item_t *temp_thread_info = NULL;
EM_IF_NULL_RETURN_VALUE(thread_info, EMAIL_ERROR_INVALID_PARAM);
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
- if (!emstorage_get_thread_information(thread_id, &mail_table_data , true, &err)) {
+ if (!emstorage_get_thread_information(multi_user_name, thread_id, &mail_table_data , true, &err)) {
EM_DEBUG_EXCEPTION("emstorage_get_thread_information -- failed [%d]", err);
goto FINISH_OFF;
}
@@ -1100,6 +1177,8 @@ FINISH_OFF:
if(mail_table_data)
emstorage_free_mail(&mail_table_data, 1, NULL);
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -1108,10 +1187,18 @@ 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;
-
- if ( ((err = emcore_get_mail_data(input_mail_id, output_mail_data)) != EMAIL_ERROR_NONE) || !output_mail_data)
+ char *multi_user_name = NULL;
+
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ return err;
+ }
+
+ if ( ((err = emcore_get_mail_data(multi_user_name, input_mail_id, output_mail_data)) != EMAIL_ERROR_NONE) || !output_mail_data)
EM_DEBUG_EXCEPTION("emcore_get_mail_data failed [%d]", err);
-
+
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -1382,12 +1469,17 @@ EXPORT_API int email_cancel_sending_mail(int mail_id)
int err = EMAIL_ERROR_NONE;
int account_id = 0;
+ char *multi_user_name = NULL;
email_mail_data_t* mail_data = NULL;
email_account_server_t account_server_type;
HIPC_API hAPI = NULL;
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_container_name error : [%d]", err);
+ goto FINISH_OFF;
+ }
- if (((err = emcore_get_mail_data(mail_id, &mail_data)) != EMAIL_ERROR_NONE) || mail_data == NULL) {
+ if (((err = emcore_get_mail_data(multi_user_name, mail_id, &mail_data)) != EMAIL_ERROR_NONE) || mail_data == NULL) {
EM_DEBUG_EXCEPTION("emcore_get_mail_data failed [%d]", err);
goto FINISH_OFF;
}
@@ -1395,7 +1487,7 @@ EXPORT_API int email_cancel_sending_mail(int mail_id)
account_id = mail_data->account_id;
/* check account bind type and branch off */
- if ( em_get_account_server_type_by_account_id(account_id, &account_server_type, false, &err) == false ) {
+ if ( em_get_account_server_type_by_account_id(multi_user_name, account_id, &account_server_type, false, &err) == false ) {
EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err);
err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE;
goto FINISH_OFF;
@@ -1412,9 +1504,10 @@ EXPORT_API int email_cancel_sending_mail(int mail_id)
}
/* noti to active sync */
- as_noti_data.cancel_sending_mail.handle = as_handle;
- as_noti_data.cancel_sending_mail.mail_id = mail_id;
- as_noti_data.cancel_sending_mail.account_id = account_id;
+ as_noti_data.cancel_sending_mail.handle = as_handle;
+ as_noti_data.cancel_sending_mail.mail_id = mail_id;
+ as_noti_data.cancel_sending_mail.account_id = account_id;
+ as_noti_data.cancel_sending_mail.multi_user_name = EM_SAFE_STRDUP(multi_user_name);
if ( em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_CANCEL_SENDING_MAIL, &as_noti_data) == false) {
EM_DEBUG_EXCEPTION("em_send_notification_to_active_sync_engine failed.");
@@ -1463,6 +1556,8 @@ FINISH_OFF:
if(mail_data)
emcore_free_mail_data_list(&mail_data, 1);
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
@@ -1557,6 +1652,7 @@ EXPORT_API int email_get_address_info_list(int mail_id, email_address_info_list_
EM_DEBUG_FUNC_BEGIN ("mail_id[%d] address_info_list[%p]", mail_id, address_info_list);
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
email_address_info_list_t *temp_address_info_list = NULL;
@@ -1566,22 +1662,28 @@ EXPORT_API int email_get_address_info_list(int mail_id, email_address_info_list_
err = EMAIL_ERROR_INVALID_PARAM ;
return err;
}
-
- 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);
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+ if (!emcore_get_mail_address_info_list(multi_user_name, mail_id, &temp_address_info_list, &err)) {
+ EM_DEBUG_EXCEPTION("emcore_get_mail_address_info_list failed [%d]", err);
goto FINISH_OFF;
}
- if ( address_info_list ) {
+ if (address_info_list) {
*address_info_list = temp_address_info_list;
temp_address_info_list = NULL;
}
FINISH_OFF:
- if ( temp_address_info_list )
+
+ if (temp_address_info_list)
emstorage_free_address_info_list(&temp_address_info_list);
+
+ EM_SAFE_FREE(multi_user_name);
EM_DEBUG_FUNC_END ("err[%d]", err);
return err;
}
@@ -1603,14 +1705,22 @@ EXPORT_API int email_query_meeting_request(char *input_conditional_clause_string
{
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);
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
EM_IF_NULL_RETURN_VALUE(input_conditional_clause_string, EMAIL_ERROR_INVALID_PARAM);
EM_IF_NULL_RETURN_VALUE(output_count, EMAIL_ERROR_INVALID_PARAM);
- if ((err = emstorage_query_meeting_request(input_conditional_clause_string, output_meeting_req, output_count, true)) != EMAIL_ERROR_NONE) {
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ return err;
+ }
+
+ if ((err = emstorage_query_meeting_request(multi_user_name, input_conditional_clause_string, output_meeting_req, output_count, true)) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emstorage_query_meeting_request failed [%d]", err);
}
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -1620,27 +1730,33 @@ EXPORT_API int email_get_meeting_request(int mail_id, email_meeting_request_t **
EM_DEBUG_API_BEGIN ("mail_id[%d] meeting_req[%p]", mail_id, meeting_req);
int err = EMAIL_ERROR_NONE;
-
+ char *multi_user_name = NULL;
email_meeting_request_t *temp_meeting_req = NULL;
EM_IF_NULL_RETURN_VALUE(meeting_req, EMAIL_ERROR_INVALID_PARAM);
- if( mail_id <= 0 ) {
+ if (mail_id <= 0) {
EM_DEBUG_EXCEPTION(" Invalid Mail Id Param ");
err = EMAIL_ERROR_INVALID_PARAM ;
return err;
}
-
- if ( !emstorage_get_meeting_request(mail_id, &temp_meeting_req, 1, &err) ) {
- EM_DEBUG_EXCEPTION("emstorage_get_meeting_request failed[%d]", err);
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ return err;
+ }
+ if (!emstorage_get_meeting_request(multi_user_name, mail_id, &temp_meeting_req, 1, &err)) {
+ EM_DEBUG_EXCEPTION("emstorage_get_meeting_request failed[%d]", err);
goto FINISH_OFF;
}
- if ( meeting_req )
+ if (meeting_req)
*meeting_req = temp_meeting_req;
FINISH_OFF:
+
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -1760,6 +1876,7 @@ EXPORT_API int email_delete_thread(int thread_id, int delete_always_flag)
emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
FINISH_OFF:
+
if(hAPI)
emipc_destroy_email_api(hAPI);
@@ -1828,10 +1945,16 @@ EXPORT_API int email_expunge_mails_deleted_flagged(int input_mailbox_id, int inp
EM_DEBUG_API_BEGIN ("input_mailbox_id[%d] input_on_server[%d] output_handle[%p]", input_mailbox_id, input_on_server, output_handle);
int err = EMAIL_ERROR_NONE;
int return_value = 0;
+ char *multi_user_name = NULL;
HIPC_API hAPI = NULL;
emstorage_mailbox_tbl_t *mailbox_tbl_data = NULL;
- if( (err = emstorage_get_mailbox_by_id(input_mailbox_id, &mailbox_tbl_data)) != EMAIL_ERROR_NONE) {
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
+ if( (err = emstorage_get_mailbox_by_id(multi_user_name, input_mailbox_id, &mailbox_tbl_data)) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_id failed[%d]", err);
goto FINISH_OFF;
}
@@ -1841,7 +1964,7 @@ EXPORT_API int email_expunge_mails_deleted_flagged(int input_mailbox_id, int inp
memset(&as_noti_data, 0, sizeof(ASNotiData)); /* initialization of union members */
- if ( em_get_account_server_type_by_account_id(mailbox_tbl_data->account_id, &account_server_type, true, &err) == false ) {
+ if ( em_get_account_server_type_by_account_id(multi_user_name, mailbox_tbl_data->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;
}
@@ -1855,10 +1978,11 @@ EXPORT_API int email_expunge_mails_deleted_flagged(int input_mailbox_id, int inp
}
/* noti to active sync */
- as_noti_data.expunge_mails_deleted_flagged.handle = as_handle;
- as_noti_data.expunge_mails_deleted_flagged.account_id = mailbox_tbl_data->account_id;
- as_noti_data.expunge_mails_deleted_flagged.mailbox_id = input_mailbox_id;
- as_noti_data.expunge_mails_deleted_flagged.on_server = input_on_server;
+ as_noti_data.expunge_mails_deleted_flagged.handle = as_handle;
+ as_noti_data.expunge_mails_deleted_flagged.account_id = mailbox_tbl_data->account_id;
+ as_noti_data.expunge_mails_deleted_flagged.mailbox_id = input_mailbox_id;
+ as_noti_data.expunge_mails_deleted_flagged.on_server = input_on_server;
+ as_noti_data.expunge_mails_deleted_flagged.multi_user_name = multi_user_name;
return_value = em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_EXPUNGE_MAILS_DELETED_FLAGGED, &as_noti_data);
@@ -1917,6 +2041,7 @@ FINISH_OFF:
emstorage_free_mailbox(&mailbox_tbl_data, 1, NULL);
}
+ EM_SAFE_FREE(multi_user_name);
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
diff --git a/email-api/email-api-mailbox.c b/email-api/email-api-mailbox.c
index 97be170..e9c8681 100755
--- a/email-api/email-api-mailbox.c
+++ b/email-api/email-api-mailbox.c
@@ -30,11 +30,11 @@
* email-service .
*/
-#include "email-api.h"
#include "string.h"
#include "email-convert.h"
#include "email-storage.h"
#include "email-core-utils.h"
+#include "email-core-gmime.h"
#include "email-core-signal.h"
#include "email-utilities.h"
#include "email-ipc.h"
@@ -48,16 +48,22 @@ EXPORT_API int email_add_mailbox(email_mailbox_t* new_mailbox, int on_server, in
int size = 0;
int err = EMAIL_ERROR_NONE;
char* local_mailbox_stream = NULL;
+ char *multi_user_name = NULL;
email_account_server_t account_server_type;
HIPC_API hAPI = NULL;
ASNotiData as_noti_data;
- memset(&as_noti_data, 0x00, sizeof(ASNotiData));
-
EM_IF_NULL_RETURN_VALUE(new_mailbox, EMAIL_ERROR_INVALID_PARAM);
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
+ memset(&as_noti_data, 0x00, sizeof(ASNotiData));
+
/* check account bind type and branch off */
- if ( em_get_account_server_type_by_account_id(new_mailbox->account_id, &account_server_type, false, &err) == false ) {
+ if ( em_get_account_server_type_by_account_id(multi_user_name, new_mailbox->account_id, &account_server_type, false, &err) == false ) {
EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err);
err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE;
goto FINISH_OFF;
@@ -73,20 +79,21 @@ EXPORT_API int email_add_mailbox(email_mailbox_t* new_mailbox, int on_server, in
}
/* noti to active sync */
- as_noti_data.add_mailbox.handle = as_handle;
- as_noti_data.add_mailbox.account_id = new_mailbox->account_id;
- as_noti_data.add_mailbox.mailbox_alias = new_mailbox->alias;
- as_noti_data.add_mailbox.mailbox_path = new_mailbox->mailbox_name;
- as_noti_data.add_mailbox.eas_data = new_mailbox->eas_data;
+ as_noti_data.add_mailbox.handle = as_handle;
+ as_noti_data.add_mailbox.account_id = new_mailbox->account_id;
+ as_noti_data.add_mailbox.mailbox_alias = new_mailbox->alias;
+ as_noti_data.add_mailbox.mailbox_path = new_mailbox->mailbox_name;
+ as_noti_data.add_mailbox.eas_data = new_mailbox->eas_data;
as_noti_data.add_mailbox.eas_data_length = new_mailbox->eas_data_length;
+ as_noti_data.add_mailbox.multi_user_name = multi_user_name;
- if ( em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_ADD_MAILBOX, &as_noti_data) == false) {
+ if (em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_ADD_MAILBOX, &as_noti_data) == false) {
EM_DEBUG_EXCEPTION("em_send_notification_to_active_sync_engine failed.");
err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE;
goto FINISH_OFF;
}
- if(handle)
+ if (handle)
*handle = as_handle;
}
else {
@@ -98,25 +105,25 @@ EXPORT_API int email_add_mailbox(email_mailbox_t* new_mailbox, int on_server, in
EM_PROXY_IF_NULL_RETURN_VALUE(local_mailbox_stream, hAPI, EMAIL_ERROR_NULL_VALUE);
- if(!emipc_add_parameter(hAPI, ePARAMETER_IN, local_mailbox_stream, size)) {
+ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, local_mailbox_stream, size)) {
EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
EM_SAFE_FREE(local_mailbox_stream);
EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE);
}
- if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &on_server, sizeof(int))) {
+ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &on_server, sizeof(int))) {
EM_DEBUG_EXCEPTION("emipc_add_parameter 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), &err);
- if(handle) {
+ if (handle) {
emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), handle);
EM_DEBUG_LOG(" >>>>> Handle [%d]", *handle);
}
@@ -130,6 +137,7 @@ EXPORT_API int email_add_mailbox(email_mailbox_t* new_mailbox, int on_server, in
FINISH_OFF:
EM_SAFE_FREE(local_mailbox_stream);
+ EM_SAFE_FREE(multi_user_name);
EM_DEBUG_API_END ("err[%d]", err);
return err;
@@ -140,6 +148,7 @@ EXPORT_API int email_rename_mailbox(int input_mailbox_id, char *input_mailbox_na
EM_DEBUG_API_BEGIN ("input_mailbox_id[%d] input_mailbox_name[%p] input_mailbox_alias[%p] input_on_server[%d] output_handle[%p]", input_mailbox_id, input_mailbox_name, input_mailbox_alias, input_on_server, output_handle);
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
email_account_server_t account_server_type;
HIPC_API hAPI = NULL;
ASNotiData as_noti_data;
@@ -149,43 +158,49 @@ EXPORT_API int email_rename_mailbox(int input_mailbox_id, char *input_mailbox_na
EM_IF_NULL_RETURN_VALUE(input_mailbox_name, EMAIL_ERROR_INVALID_PARAM);
EM_IF_NULL_RETURN_VALUE(input_mailbox_alias, EMAIL_ERROR_INVALID_PARAM);
- if ((err = emstorage_get_mailbox_by_id(input_mailbox_id, &mailbox_tbl)) != EMAIL_ERROR_NONE || !mailbox_tbl) {
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
+ if ((err = emstorage_get_mailbox_by_id(multi_user_name, input_mailbox_id, &mailbox_tbl)) != EMAIL_ERROR_NONE || !mailbox_tbl) {
EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_id failed. [%d]", err);
goto FINISH_OFF;
}
/* check account bind type and branch off */
- if ( em_get_account_server_type_by_account_id(mailbox_tbl->account_id, &account_server_type, false, &err) == false ) {
+ if (em_get_account_server_type_by_account_id(multi_user_name, mailbox_tbl->account_id, &account_server_type, false, &err) == false) {
EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err);
err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE;
goto FINISH_OFF;
}
- if ( account_server_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC && input_on_server) {
+ if (account_server_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC && input_on_server) {
int as_handle;
- if ( em_get_handle_for_activesync(&as_handle, &err) == false ) {
+ if (em_get_handle_for_activesync(&as_handle, &err) == false) {
EM_DEBUG_EXCEPTION("em_get_handle_for_activesync failed[%d].", err);
err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE;
goto FINISH_OFF;
}
/* noti to active sync */
- as_noti_data.rename_mailbox.handle = as_handle;
- as_noti_data.rename_mailbox.account_id = mailbox_tbl->account_id;
- as_noti_data.rename_mailbox.mailbox_id = input_mailbox_id;
- as_noti_data.rename_mailbox.mailbox_name = input_mailbox_name;
- as_noti_data.rename_mailbox.mailbox_alias = input_mailbox_alias;
+ as_noti_data.rename_mailbox.handle = as_handle;
+ as_noti_data.rename_mailbox.account_id = mailbox_tbl->account_id;
+ as_noti_data.rename_mailbox.mailbox_id = input_mailbox_id;
+ as_noti_data.rename_mailbox.mailbox_name = input_mailbox_name;
+ as_noti_data.rename_mailbox.mailbox_alias = input_mailbox_alias;
as_noti_data.rename_mailbox.eas_data = NULL;
as_noti_data.rename_mailbox.eas_data_length = 0;
+ as_noti_data.rename_mailbox.multi_user_name = multi_user_name;
- if ( em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_RENAME_MAILBOX, &as_noti_data) == false) {
+ if (em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_RENAME_MAILBOX, &as_noti_data) == 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)
+ if (output_handle)
*output_handle = as_handle;
}
else {
@@ -227,6 +242,7 @@ FINISH_OFF:
if (mailbox_tbl)
emstorage_free_mailbox(&mailbox_tbl, 1, NULL);
+ EM_SAFE_FREE(multi_user_name);
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -236,6 +252,7 @@ EXPORT_API int email_rename_mailbox_ex(int input_mailbox_id, char *input_mailbox
EM_DEBUG_API_BEGIN ("input_mailbox_id[%d] input_mailbox_name[%p] input_mailbox_alias[%p] input_eas_data[%p] input_eas_data_length[%d] input_on_server[%d] output_handle[%p]", input_mailbox_id, input_mailbox_name, input_mailbox_alias, input_eas_data, input_eas_data_length, input_on_server, output_handle);
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
email_account_server_t account_server_type;
HIPC_API hAPI = NULL;
ASNotiData as_noti_data;
@@ -245,22 +262,27 @@ EXPORT_API int email_rename_mailbox_ex(int input_mailbox_id, char *input_mailbox
EM_IF_NULL_RETURN_VALUE(input_mailbox_name, EMAIL_ERROR_INVALID_PARAM);
EM_IF_NULL_RETURN_VALUE(input_mailbox_alias, EMAIL_ERROR_INVALID_PARAM);
- if ((err = emstorage_get_mailbox_by_id(input_mailbox_id, &mailbox_tbl)) != EMAIL_ERROR_NONE || !mailbox_tbl) {
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
+ if ((err = emstorage_get_mailbox_by_id(multi_user_name, input_mailbox_id, &mailbox_tbl)) != EMAIL_ERROR_NONE || !mailbox_tbl) {
EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_id failed. [%d]", err);
goto FINISH_OFF;
}
/* check account bind type and branch off */
- if ( em_get_account_server_type_by_account_id(mailbox_tbl->account_id, &account_server_type, false, &err) == false ) {
+ if (em_get_account_server_type_by_account_id(multi_user_name, mailbox_tbl->account_id, &account_server_type, false, &err) == false) {
EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err);
err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE;
goto FINISH_OFF;
}
- if ( account_server_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC && input_on_server) {
+ if (account_server_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC && input_on_server) {
int as_handle;
- if ( em_get_handle_for_activesync(&as_handle, &err) == false ) {
+ if (em_get_handle_for_activesync(&as_handle, &err) == false) {
EM_DEBUG_EXCEPTION("em_get_handle_for_activesync failed[%d].", err);
err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE;
goto FINISH_OFF;
@@ -274,45 +296,46 @@ EXPORT_API int email_rename_mailbox_ex(int input_mailbox_id, char *input_mailbox
as_noti_data.rename_mailbox.mailbox_alias = input_mailbox_alias;
as_noti_data.rename_mailbox.eas_data = input_eas_data;
as_noti_data.rename_mailbox.eas_data_length = input_eas_data_length;
+ as_noti_data.rename_mailbox.multi_user_name = multi_user_name;
- if ( em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_RENAME_MAILBOX, &as_noti_data) == false) {
+ if (em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_RENAME_MAILBOX, &as_noti_data) == 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)
+ if (output_handle)
*output_handle = as_handle;
}
else {
hAPI = emipc_create_email_api(_EMAIL_API_RENAME_MAILBOX_EX);
- if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_mailbox_id, sizeof(int))) {
+ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_mailbox_id, sizeof(int))) {
EM_DEBUG_EXCEPTION(" emipc_add_parameter for input_mailbox_id failed");
EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE);
}
- if(!emipc_add_parameter(hAPI, ePARAMETER_IN, input_mailbox_name, EM_SAFE_STRLEN(input_mailbox_name)+1 )) {
+ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, input_mailbox_name, EM_SAFE_STRLEN(input_mailbox_name)+1 )) {
EM_DEBUG_EXCEPTION(" emipc_add_parameter for input_mailbox_path failed");
EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE);
}
- if(!emipc_add_parameter(hAPI, ePARAMETER_IN, input_mailbox_alias, EM_SAFE_STRLEN(input_mailbox_alias)+1 )) {
+ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, input_mailbox_alias, EM_SAFE_STRLEN(input_mailbox_alias)+1 )) {
EM_DEBUG_EXCEPTION(" emipc_add_parameter for input_mailbox_alias failed");
EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE);
}
- if(!emipc_add_parameter(hAPI, ePARAMETER_IN, input_eas_data, input_eas_data_length )) {
+ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, input_eas_data, input_eas_data_length )) {
EM_DEBUG_EXCEPTION(" emipc_add_parameter for input_eas_data failed");
EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE);
}
- if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_on_server, sizeof(int))) {
+ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_on_server, sizeof(int))) {
EM_DEBUG_EXCEPTION("emipc_add_parameter 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);
}
@@ -328,6 +351,7 @@ FINISH_OFF:
if (mailbox_tbl)
emstorage_free_mailbox(&mailbox_tbl, 1, NULL);
+ EM_SAFE_FREE(multi_user_name);
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -340,6 +364,7 @@ EXPORT_API int email_delete_mailbox(int input_mailbox_id, int input_on_server, i
EM_DEBUG_API_BEGIN ("input_mailbox_id[%d] input_on_server[%d] output_handle[%p]", input_mailbox_id, input_on_server, output_handle);
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
email_account_server_t account_server_type;
emstorage_mailbox_tbl_t *mailbox_tbl = NULL;
HIPC_API hAPI = NULL;
@@ -347,39 +372,45 @@ EXPORT_API int email_delete_mailbox(int input_mailbox_id, int input_on_server, i
EM_IF_NULL_RETURN_VALUE(input_mailbox_id, EMAIL_ERROR_INVALID_PARAM);
- if ( (err = emstorage_get_mailbox_by_id(input_mailbox_id, &mailbox_tbl)) != EMAIL_ERROR_NONE) {
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
+ if ((err = emstorage_get_mailbox_by_id(multi_user_name, input_mailbox_id, &mailbox_tbl)) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_id failed[%d]", err);
goto FINISH_OFF;
}
/* check account bind type and branch off */
- if ( em_get_account_server_type_by_account_id(mailbox_tbl->account_id, &account_server_type, false, &err) == false ) {
+ if (em_get_account_server_type_by_account_id(multi_user_name, mailbox_tbl->account_id, &account_server_type, false, &err) == false) {
EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err);
err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE;
goto FINISH_OFF;
}
- if ( account_server_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC && input_on_server) {
+ if (account_server_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC && input_on_server) {
int as_handle;
- if ( em_get_handle_for_activesync(&as_handle, &err) == false ) {
+ if (em_get_handle_for_activesync(&as_handle, &err) == false) {
EM_DEBUG_EXCEPTION("em_get_handle_for_activesync failed[%d].", err);
err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE;
goto FINISH_OFF;
}
/* noti to active sync */
- as_noti_data.delete_mailbox.handle = as_handle;
- as_noti_data.delete_mailbox.account_id = mailbox_tbl->account_id;
- as_noti_data.delete_mailbox.mailbox_id = input_mailbox_id;
+ as_noti_data.delete_mailbox.handle = as_handle;
+ as_noti_data.delete_mailbox.account_id = mailbox_tbl->account_id;
+ as_noti_data.delete_mailbox.mailbox_id = input_mailbox_id;
+ as_noti_data.delete_mailbox.multi_user_name = multi_user_name;
- if ( em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_DELETE_MAILBOX, &as_noti_data) == false) {
+ if (em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_DELETE_MAILBOX, &as_noti_data) == 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)
+ if (output_handle)
*output_handle = as_handle;
}
else {
@@ -387,17 +418,17 @@ EXPORT_API int email_delete_mailbox(int input_mailbox_id, int input_on_server, i
EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE);
- if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_mailbox_id, sizeof(int))) {
+ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_mailbox_id, sizeof(int))) {
EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE);
}
- if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_on_server, sizeof(int))) {
+ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_on_server, sizeof(int))) {
EM_DEBUG_EXCEPTION("emipc_add_parameter 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);
}
@@ -405,7 +436,7 @@ EXPORT_API int email_delete_mailbox(int input_mailbox_id, int input_on_server, i
emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
EM_DEBUG_LOG("error VALUE [%d]", err);
- if(input_on_server) {
+ if (input_on_server) {
emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), output_handle);
EM_DEBUG_LOG("output_handle [%d]", output_handle);
}
@@ -418,35 +449,52 @@ FINISH_OFF:
emstorage_free_mailbox(&mailbox_tbl, 1, NULL);
}
+ EM_SAFE_FREE(multi_user_name);
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
-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)
+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)
{
- EM_DEBUG_API_BEGIN ("input_account_id[%d] input_mailbox_id_array[%p] input_mailbox_id_count[%d] input_on_server[%d] output_handle[%p]", input_mailbox_id_array, input_mailbox_id_array, input_mailbox_id_count, input_on_server, output_handle);
+ EM_DEBUG_API_BEGIN ("input_account_id[%d] input_mailbox_id_array[%p] "
+ "input_mailbox_id_count[%d] input_on_server[%d] "
+ "output_handle[%p]", input_mailbox_id_array, input_mailbox_id_array,
+ input_mailbox_id_count, input_on_server, output_handle);
+
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
email_account_server_t account_server_type;
task_parameter_EMAIL_ASYNC_TASK_DELETE_MAILBOX_EX task_parameter;
- if(input_account_id == 0 || input_mailbox_id_count <= 0 || input_mailbox_id_array == NULL) {
+ if (input_account_id == 0 || input_mailbox_id_count <= 0 || input_mailbox_id_array == NULL) {
EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM");
err = EMAIL_ERROR_INVALID_PARAM;
goto FINISH_OFF;
}
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
/* check account bind type and branch off */
- if ( em_get_account_server_type_by_account_id(input_account_id, &account_server_type, false, &err) == false ) {
+ if (em_get_account_server_type_by_account_id(multi_user_name,
+ input_account_id,
+ &account_server_type,
+ false,
+ &err) == false) {
EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err);
err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE;
goto FINISH_OFF;
}
- if ( account_server_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC && input_on_server) {
+ if (account_server_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC && input_on_server) {
int as_handle;
ASNotiData as_noti_data;
- if ( em_get_handle_for_activesync(&as_handle, &err) == false ) {
+ if (em_get_handle_for_activesync(&as_handle, &err) == false) {
EM_DEBUG_EXCEPTION("em_get_handle_for_activesync failed[%d].", err);
err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE;
goto FINISH_OFF;
@@ -458,14 +506,15 @@ EXPORT_API int email_delete_mailbox_ex(int input_account_id, int *input_mailbox_
as_noti_data.delete_mailbox_ex.mailbox_id_array = input_mailbox_id_array;
as_noti_data.delete_mailbox_ex.mailbox_id_count = input_mailbox_id_count;
as_noti_data.delete_mailbox_ex.on_server = input_on_server;
+ as_noti_data.delete_mailbox_ex.multi_user_name = EM_SAFE_STRDUP(multi_user_name);
- if ( em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_DELETE_MAILBOX_EX, &as_noti_data) == false) {
+ if (em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_DELETE_MAILBOX_EX, &as_noti_data) == 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)
+ if (output_handle)
*output_handle = as_handle;
}
else {
@@ -474,7 +523,8 @@ EXPORT_API int email_delete_mailbox_ex(int input_account_id, int *input_mailbox_
task_parameter.mailbox_id_count = input_mailbox_id_count;
task_parameter.on_server = input_on_server;
- if((err = emipc_execute_proxy_task(EMAIL_ASYNC_TASK_DELETE_MAILBOX_EX, &task_parameter)) != EMAIL_ERROR_NONE) {
+ if ((err = emipc_execute_proxy_task(EMAIL_ASYNC_TASK_DELETE_MAILBOX_EX,
+ &task_parameter)) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("execute_proxy_task failed [%d]", err);
goto FINISH_OFF;
}
@@ -482,6 +532,8 @@ EXPORT_API int email_delete_mailbox_ex(int input_account_id, int *input_mailbox_
FINISH_OFF:
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -497,17 +549,17 @@ EXPORT_API int email_set_mailbox_type(int input_mailbox_id, email_mailbox_type_e
EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE);
- if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_mailbox_id, sizeof(int))) {
+ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_mailbox_id, sizeof(int))) {
EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE);
}
- if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_mailbox_type, sizeof(int))) {
+ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_mailbox_type, sizeof(int))) {
EM_DEBUG_EXCEPTION("emipc_add_parameter 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);
}
@@ -532,17 +584,17 @@ EXPORT_API int email_set_local_mailbox(int input_mailbox_id, int input_is_local_
EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE);
- if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_mailbox_id, sizeof(int))) {
+ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_mailbox_id, sizeof(int))) {
EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE);
}
- if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_is_local_mailbox, sizeof(int))) {
+ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_is_local_mailbox, sizeof(int))) {
EM_DEBUG_EXCEPTION("emipc_add_parameter 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);
}
@@ -562,16 +614,20 @@ EXPORT_API int email_get_sync_mailbox_list(int account_id, email_mailbox_t** mai
int mailbox_count = 0;
int err = EMAIL_ERROR_NONE ;
int i = 0;
+ char *multi_user_name = NULL;
emstorage_mailbox_tbl_t* mailbox_tbl_list = NULL;
EM_IF_NULL_RETURN_VALUE(mailbox_list, EMAIL_ERROR_INVALID_PARAM);
EM_IF_ACCOUNT_ID_NULL(account_id, EMAIL_ERROR_INVALID_PARAM);
EM_IF_NULL_RETURN_VALUE(count, EMAIL_ERROR_INVALID_PARAM);
- if (!emstorage_get_mailbox_list(account_id, 0, EMAIL_MAILBOX_SORT_BY_NAME_ASC, &mailbox_count, &mailbox_tbl_list, true, &err)) {
- EM_DEBUG_EXCEPTION("emstorage_get_mailbox failed [%d]", err);
-
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+ if (!emstorage_get_mailbox_list(multi_user_name, account_id, 0, EMAIL_MAILBOX_SORT_BY_NAME_ASC, &mailbox_count, &mailbox_tbl_list, true, &err)) {
+ EM_DEBUG_EXCEPTION("emstorage_get_mailbox failed [%d]", err);
goto FINISH_OFF;
} else
err = EMAIL_ERROR_NONE;
@@ -589,9 +645,12 @@ EXPORT_API int email_get_sync_mailbox_list(int account_id, email_mailbox_t** mai
*count = mailbox_count;
- FINISH_OFF:
+FINISH_OFF:
+
if (mailbox_tbl_list != NULL)
emstorage_free_mailbox(&mailbox_tbl_list, mailbox_count, NULL);
+
+ EM_SAFE_FREE(multi_user_name);
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -605,15 +664,19 @@ EXPORT_API int email_get_mailbox_list(int account_id, int mailbox_sync_type, ema
emstorage_mailbox_tbl_t* mailbox_tbl_list = NULL;
int err =EMAIL_ERROR_NONE;
int i;
+ char *multi_user_name = NULL;
EM_IF_NULL_RETURN_VALUE(mailbox_list, EMAIL_ERROR_INVALID_PARAM);
EM_IF_ACCOUNT_ID_NULL(account_id, EMAIL_ERROR_INVALID_PARAM);
EM_IF_NULL_RETURN_VALUE(count, EMAIL_ERROR_INVALID_PARAM);
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
- if (!emstorage_get_mailbox_list(account_id, mailbox_sync_type, EMAIL_MAILBOX_SORT_BY_NAME_ASC, &mailbox_count, &mailbox_tbl_list, true, &err)) {
+ if (!emstorage_get_mailbox_list(multi_user_name, 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);
-
goto FINISH_OFF;
} else
err = EMAIL_ERROR_NONE;
@@ -633,15 +696,16 @@ EXPORT_API int email_get_mailbox_list(int account_id, int mailbox_sync_type, ema
*count = mailbox_count;
FINISH_OFF:
+
if (mailbox_tbl_list != NULL)
emstorage_free_mailbox(&mailbox_tbl_list, mailbox_count, NULL);
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err [%d]", err);
return err;
}
-
-
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)
{
EM_DEBUG_FUNC_BEGIN ();
@@ -650,19 +714,27 @@ EXPORT_API int email_get_mailbox_list_ex(int account_id, int mailbox_sync_type,
emstorage_mailbox_tbl_t* mailbox_tbl_list = NULL;
int err =EMAIL_ERROR_NONE;
int i;
-
+ char *multi_user_name = NULL;
+
EM_IF_NULL_RETURN_VALUE(mailbox_list, EMAIL_ERROR_INVALID_PARAM);
EM_IF_ACCOUNT_ID_NULL(account_id, EMAIL_ERROR_INVALID_PARAM);
EM_IF_NULL_RETURN_VALUE(count, EMAIL_ERROR_INVALID_PARAM);
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
- if (!emstorage_get_mailbox_list_ex(account_id, mailbox_sync_type, with_count, &mailbox_count, &mailbox_tbl_list, true, &err)) {
+ emcore_gmime_init();
+ if (!emstorage_get_mailbox_list_ex(multi_user_name, account_id, mailbox_sync_type, with_count, &mailbox_count, &mailbox_tbl_list, true, &err)) {
+ emcore_gmime_shutdown();
EM_DEBUG_EXCEPTION("emstorage_get_mailbox_list_ex failed [%d]", err);
-
goto FINISH_OFF;
} else
err = EMAIL_ERROR_NONE;
-
+
+ emcore_gmime_shutdown();
+
if (mailbox_count > 0) {
if (!(*mailbox_list = em_malloc(sizeof(email_mailbox_t) * mailbox_count))) {
EM_DEBUG_EXCEPTION("malloc failed for mailbox_list");
@@ -670,7 +742,7 @@ EXPORT_API int email_get_mailbox_list_ex(int account_id, int mailbox_sync_type,
goto FINISH_OFF;
}
- for (i = 0; i < mailbox_count; i++)
+ for (i = 0; i < mailbox_count; i++)
em_convert_mailbox_tbl_to_mailbox(mailbox_tbl_list + i, (*mailbox_list) + i);
}
else
@@ -680,9 +752,12 @@ EXPORT_API int email_get_mailbox_list_ex(int account_id, int mailbox_sync_type,
*count = mailbox_count;
FINISH_OFF:
+
if (mailbox_tbl_list != NULL)
emstorage_free_mailbox(&mailbox_tbl_list, mailbox_count, NULL);
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_FUNC_END ("err[%d]", err);
return err;
}
@@ -695,12 +770,17 @@ EXPORT_API int email_get_mailbox_list_by_keyword(int account_id, char *keyword,
emstorage_mailbox_tbl_t* mailbox_tbl_list = NULL;
int err = EMAIL_ERROR_NONE;
int i = 0;
+ char *multi_user_name = NULL;
EM_IF_NULL_RETURN_VALUE(mailbox_list, EMAIL_ERROR_INVALID_PARAM);
EM_IF_NULL_RETURN_VALUE(count, EMAIL_ERROR_INVALID_PARAM);
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
- if (!emstorage_get_mailbox_by_keyword(account_id, keyword, &mailbox_tbl_list, &mailbox_count, true, &err)) {
+ if (!emstorage_get_mailbox_by_keyword(multi_user_name, account_id, keyword, &mailbox_tbl_list, &mailbox_count, true, &err)) {
EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_keyword failed [%d]", err);
goto FINISH_OFF;
}
@@ -725,6 +805,8 @@ FINISH_OFF:
if (mailbox_tbl_list != NULL)
emstorage_free_mailbox(&mailbox_tbl_list, mailbox_count, NULL);
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -734,19 +816,25 @@ EXPORT_API int email_get_mailbox_by_mailbox_type(int account_id, email_mailbox_t
EM_DEBUG_FUNC_BEGIN ();
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
email_mailbox_t* curr_mailbox = NULL;
emstorage_mailbox_tbl_t* local_mailbox = NULL;
EM_IF_NULL_RETURN_VALUE(mailbox, EMAIL_ERROR_INVALID_PARAM);
EM_IF_NULL_RETURN_VALUE(account_id, EMAIL_ERROR_INVALID_PARAM) ;
- if(mailbox_type < EMAIL_MAILBOX_TYPE_INBOX || mailbox_type > EMAIL_MAILBOX_TYPE_USER_DEFINED)
- return EMAIL_ERROR_INVALID_PARAM;
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+ if (mailbox_type < EMAIL_MAILBOX_TYPE_INBOX || mailbox_type > EMAIL_MAILBOX_TYPE_USER_DEFINED) {
+ err = EMAIL_ERROR_INVALID_PARAM;
+ goto FINISH_OFF;
+ }
- if (!emstorage_get_mailbox_by_mailbox_type(account_id, mailbox_type, &local_mailbox, true, &err)) {
+ if (!emstorage_get_mailbox_by_mailbox_type(multi_user_name, account_id, mailbox_type, &local_mailbox, true, &err)) {
EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_mailbox_type failed [%d]", err);
-
goto FINISH_OFF;
} else {
err = EMAIL_ERROR_NONE;
@@ -762,10 +850,14 @@ EXPORT_API int email_get_mailbox_by_mailbox_type(int account_id, email_mailbox_t
}
*mailbox = curr_mailbox;
+
FINISH_OFF:
- if(local_mailbox)
+ if (local_mailbox)
emstorage_free_mailbox(&local_mailbox, 1, NULL);
+
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_FUNC_END ("err[%d]", err);
return err;
}
@@ -775,29 +867,41 @@ EXPORT_API int email_get_mailbox_by_mailbox_id(int input_mailbox_id, email_mailb
EM_DEBUG_API_BEGIN ();
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
email_mailbox_t* curr_mailbox = NULL;
emstorage_mailbox_tbl_t* local_mailbox = NULL;
EM_IF_NULL_RETURN_VALUE(output_mailbox, EMAIL_ERROR_INVALID_PARAM);
- if ((err = emstorage_get_mailbox_by_id(input_mailbox_id, &local_mailbox)) != EMAIL_ERROR_NONE) {
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
+ if ((err = emstorage_get_mailbox_by_id(multi_user_name, input_mailbox_id, &local_mailbox)) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_id failed [%d]", err);
- return err;
+ goto FINISH_OFF;
} else {
curr_mailbox = em_malloc(sizeof(email_mailbox_t));
if (curr_mailbox == NULL) {
EM_DEBUG_EXCEPTION("em_malloc failed");
err = EMAIL_ERROR_OUT_OF_MEMORY;
- return err;
+ goto FINISH_OFF;
}
memset(curr_mailbox, 0x00, sizeof(email_mailbox_t));
+
em_convert_mailbox_tbl_to_mailbox(local_mailbox, curr_mailbox);
}
*output_mailbox = curr_mailbox;
- emstorage_free_mailbox(&local_mailbox, 1, &err);
+FINISH_OFF:
+
+ if (local_mailbox)
+ emstorage_free_mailbox(&local_mailbox, 1, &err);
+
+ EM_SAFE_FREE(multi_user_name);
EM_DEBUG_API_END ("err[%d]", err);
return err;
@@ -809,32 +913,31 @@ EXPORT_API int email_set_mail_slot_size(int account_id, int mailbox_id, int new_
int err = EMAIL_ERROR_NONE;
- if(new_slot_size < 0) {
+ if (new_slot_size < 0) {
EM_DEBUG_EXCEPTION("new_slot_size should be greater than 0 or should be equal to 0");
return EMAIL_ERROR_INVALID_PARAM;
}
HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_SET_MAIL_SLOT_SIZE);
-
EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE);
if (hAPI) {
- if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &account_id, sizeof(int))) {
+ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &account_id, sizeof(int))) {
EM_DEBUG_EXCEPTION(" emipc_add_parameter for account_id failed");
EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE);
}
- if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &mailbox_id, sizeof(int))) {
+ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &mailbox_id, sizeof(int))) {
EM_DEBUG_EXCEPTION(" emipc_add_parameter for account_id failed");
EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE);
}
- if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &new_slot_size, sizeof(int))) {
+ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &new_slot_size, sizeof(int))) {
EM_DEBUG_EXCEPTION(" emipc_add_parameter for new_slot_size 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);
}
@@ -862,7 +965,25 @@ 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);
- err = emstorage_stamp_last_sync_time_of_mailbox(input_mailbox_id, 1);
+ HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_STAMP_SYNC_TIME_OF_MAILBOX);
+ EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE);
+
+ if (hAPI) {
+ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_mailbox_id, sizeof(int))) {
+ EM_DEBUG_EXCEPTION(" emipc_add_parameter for 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);
+ EM_DEBUG_LOG("email_stamp_sync_time_of_mailbox error VALUE [%d]", err);
+ emipc_destroy_email_api(hAPI);
+ hAPI = NULL;
+ }
EM_DEBUG_API_END ("err[%d]", err);
return err;
diff --git a/email-api/email-api-network.c b/email-api/email-api-network.c
index a02556c..08ef234 100755
--- a/email-api/email-api-network.c
+++ b/email-api/email-api-network.c
@@ -30,7 +30,6 @@
* email-service .
*/
-#include "email-api.h"
#include "string.h"
#include "email-convert.h"
#include "email-api-mailbox.h"
@@ -46,18 +45,24 @@ EXPORT_API int email_send_mail(int mail_id, int *handle)
EM_DEBUG_API_BEGIN ("mail_id[%d] handle[%p]", mail_id, handle);
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
emstorage_mail_tbl_t* mail_table_data = NULL;
email_account_server_t account_server_type;
HIPC_API hAPI = NULL;
ASNotiData as_noti_data;
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
if(mail_id <= 0) {
EM_DEBUG_EXCEPTION("mail_id is not valid");
- err= EMAIL_ERROR_INVALID_PARAM;
+ err = EMAIL_ERROR_INVALID_PARAM;
goto FINISH_OFF;
}
- if(!emstorage_get_mail_by_id(mail_id, &mail_table_data, true, &err) || !mail_table_data) {
+ if(!emstorage_get_mail_by_id(multi_user_name, mail_id, &mail_table_data, true, &err) || !mail_table_data) {
EM_DEBUG_EXCEPTION("Failed to get mail by mail_id [%d]", err);
goto FINISH_OFF;
}
@@ -73,7 +78,7 @@ EXPORT_API int email_send_mail(int mail_id, int *handle)
memset(&as_noti_data, 0x00, sizeof(ASNotiData));
/* check account bind type and branch off */
- if ( em_get_account_server_type_by_account_id(mail_table_data->account_id, &account_server_type, false, &err) == false ) {
+ if (em_get_account_server_type_by_account_id(multi_user_name, mail_table_data->account_id, &account_server_type, false, &err) == false ) {
EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err);
err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE;
goto FINISH_OFF;
@@ -88,9 +93,10 @@ EXPORT_API int email_send_mail(int mail_id, int *handle)
}
/* noti to active sync */
- as_noti_data.send_mail.handle = as_handle;
- as_noti_data.send_mail.account_id = mail_table_data->account_id;
- as_noti_data.send_mail.mail_id = mail_id;
+ as_noti_data.send_mail.handle = as_handle;
+ as_noti_data.send_mail.account_id = mail_table_data->account_id;
+ as_noti_data.send_mail.mail_id = mail_id;
+ as_noti_data.send_mail.multi_user_name = multi_user_name;
if ( em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_SEND_MAIL, &as_noti_data) == false) {
EM_DEBUG_EXCEPTION("em_send_notification_to_active_sync_engine failed.");
@@ -136,6 +142,8 @@ FINISH_OFF:
emstorage_free_mail(&mail_table_data, 1, NULL);
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -145,18 +153,24 @@ EXPORT_API int email_send_mail_with_downloading_attachment_of_original_mail(int
EM_DEBUG_API_BEGIN ("input_mail_id[%d] output_handle[%p]", input_mail_id, output_handle);
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
emstorage_mail_tbl_t* mail_table_data = NULL;
email_account_server_t account_server_type;
HIPC_API hAPI = NULL;
task_parameter_EMAIL_ASYNC_TASK_SEND_MAIL_WITH_DOWNLOADING_ATTACHMENT_OF_ORIGINAL_MAIL task_parameter;
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
if(input_mail_id <= 0) {
EM_DEBUG_EXCEPTION("mail_id is not valid");
err= EMAIL_ERROR_INVALID_PARAM;
goto FINISH_OFF;
}
- if(!emstorage_get_mail_by_id(input_mail_id, &mail_table_data, true, &err) || !mail_table_data) {
+ if(!emstorage_get_mail_by_id(multi_user_name, input_mail_id, &mail_table_data, true, &err) || !mail_table_data) {
EM_DEBUG_EXCEPTION("Failed to get mail by mail_id [%d]", err);
goto FINISH_OFF;
}
@@ -170,7 +184,7 @@ EXPORT_API int email_send_mail_with_downloading_attachment_of_original_mail(int
EM_DEBUG_LOG("mail_table_data->account_id[%d], mail_table_data->mailbox_id[%d]", mail_table_data->account_id, mail_table_data->mailbox_id);
/* check account bind type and branch off */
- if ( em_get_account_server_type_by_account_id(mail_table_data->account_id, &account_server_type, false, &err) == false ) {
+ if ( em_get_account_server_type_by_account_id(multi_user_name, mail_table_data->account_id, &account_server_type, false, &err) == false ) {
EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err);
err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE;
goto FINISH_OFF;
@@ -189,9 +203,10 @@ EXPORT_API int email_send_mail_with_downloading_attachment_of_original_mail(int
}
/* noti to active sync */
- as_noti_data.send_mail_with_downloading_attachment_of_original_mail.handle = as_handle;
- as_noti_data.send_mail_with_downloading_attachment_of_original_mail.mail_id = input_mail_id;
- as_noti_data.send_mail_with_downloading_attachment_of_original_mail.account_id = mail_table_data->account_id;
+ as_noti_data.send_mail_with_downloading_attachment_of_original_mail.handle = as_handle;
+ as_noti_data.send_mail_with_downloading_attachment_of_original_mail.mail_id = input_mail_id;
+ as_noti_data.send_mail_with_downloading_attachment_of_original_mail.account_id = mail_table_data->account_id;
+ as_noti_data.send_mail_with_downloading_attachment_of_original_mail.multi_user_name = multi_user_name;
if ( em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_SEND_MAIL_WITH_DOWNLOADING_OF_ORIGINAL_MAIL, &as_noti_data) == false) {
EM_DEBUG_EXCEPTION("em_send_notification_to_active_sync_engine failed.");
@@ -217,6 +232,8 @@ FINISH_OFF:
emstorage_free_mail(&mail_table_data, 1, NULL);
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -226,24 +243,30 @@ EXPORT_API int email_schedule_sending_mail(int input_mail_id, time_t input_sched
EM_DEBUG_API_BEGIN ("mail_id[%d] input_time[%d]", input_mail_id, input_scheduled_time);
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
emstorage_mail_tbl_t* mail_table_data = NULL;
email_account_server_t account_server_type;
HIPC_API hAPI = NULL;
task_parameter_EMAIL_SYNC_TASK_SCHEDULE_SENDING_MAIL task_parameter;
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
if(input_mail_id <= 0) {
EM_DEBUG_EXCEPTION("mail_id is not valid");
err = EMAIL_ERROR_INVALID_PARAM;
goto FINISH_OFF;
}
- if(!emstorage_get_mail_by_id(input_mail_id, &mail_table_data, true, &err) || !mail_table_data) {
+ if(!emstorage_get_mail_by_id(multi_user_name, input_mail_id, &mail_table_data, true, &err) || !mail_table_data) {
EM_DEBUG_EXCEPTION("Failed to get mail by mail_id [%d]", err);
goto FINISH_OFF;
}
/* check account bind type and branch off */
- if ( em_get_account_server_type_by_account_id(mail_table_data->account_id, &account_server_type, false, &err) == false ) {
+ if ( em_get_account_server_type_by_account_id(multi_user_name, mail_table_data->account_id, &account_server_type, false, &err) == false ) {
EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err);
err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE;
goto FINISH_OFF;
@@ -262,10 +285,11 @@ EXPORT_API int email_schedule_sending_mail(int input_mail_id, time_t input_sched
}
/* noti to active sync */
- as_noti_data.schedule_sending_mail.handle = as_handle;
- as_noti_data.schedule_sending_mail.account_id = mail_table_data->account_id;
- as_noti_data.schedule_sending_mail.mail_id = input_mail_id;
- as_noti_data.schedule_sending_mail.scheduled_time = input_scheduled_time;
+ as_noti_data.schedule_sending_mail.handle = as_handle;
+ as_noti_data.schedule_sending_mail.account_id = mail_table_data->account_id;
+ as_noti_data.schedule_sending_mail.mail_id = input_mail_id;
+ as_noti_data.schedule_sending_mail.scheduled_time = input_scheduled_time;
+ as_noti_data.schedule_sending_mail.multi_user_name = multi_user_name;
if ( em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_SCHEDULE_SENDING_MAIL, &as_noti_data) == false) {
EM_DEBUG_EXCEPTION("em_send_notification_to_active_sync_engine failed.");
@@ -289,6 +313,8 @@ FINISH_OFF:
emstorage_free_mail(&mail_table_data, 1, NULL);
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -334,6 +360,7 @@ EXPORT_API int email_sync_header(int input_account_id, int input_mailbox_id, int
{
EM_DEBUG_API_BEGIN ("input_account_id[%d] input_mailbox_id[%d] handle[%p]", input_account_id, input_mailbox_id, handle);
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
/* int total_count = 0; */
EM_IF_ACCOUNT_ID_NULL(input_account_id, EMAIL_ERROR_INVALID_PARAM);
@@ -343,8 +370,13 @@ EXPORT_API int email_sync_header(int input_account_id, int input_mailbox_id, int
ASNotiData as_noti_data;
memset(&as_noti_data, 0x00, sizeof(ASNotiData));
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
/* 2010/02/12 ch715.lee : check account bind type and branch off */
- if ( em_get_account_server_type_by_account_id(input_account_id, &account_server_type, true, &err) == false ) {
+ if (em_get_account_server_type_by_account_id(multi_user_name, 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;
}
@@ -357,18 +389,19 @@ EXPORT_API int email_sync_header(int input_account_id, int input_mailbox_id, int
}
/* noti to active sync */
- as_noti_data.sync_header.handle = as_handle;
- as_noti_data.sync_header.account_id = input_account_id;
+ as_noti_data.sync_header.handle = as_handle;
+ as_noti_data.sync_header.account_id = input_account_id;
/* In case that Mailbox is NULL, SYNC ALL MAILBOX */
- as_noti_data.sync_header.mailbox_id = input_mailbox_id;
+ as_noti_data.sync_header.mailbox_id = input_mailbox_id;
+ as_noti_data.sync_header.multi_user_name = multi_user_name;
- if ( em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_SYNC_HEADER, &as_noti_data) == false) {
+ if (em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_SYNC_HEADER, &as_noti_data) == false) {
EM_DEBUG_EXCEPTION("em_send_notification_to_active_sync_engine failed.");
err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE;
goto FINISH_OFF;
}
- if(handle)
+ if (handle)
*handle = as_handle;
}
@@ -406,9 +439,12 @@ EXPORT_API int email_sync_header(int input_account_id, int input_mailbox_id, int
}
FINISH_OFF:
+
emipc_destroy_email_api(hAPI);
hAPI = NULL;
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -417,7 +453,7 @@ FINISH_OFF:
EXPORT_API int email_sync_header_for_all_account(int *handle)
{
EM_DEBUG_API_BEGIN ("handle[%p]", handle);
- char* mailbox_stream = NULL;
+ char *multi_user_name = NULL;
int err = EMAIL_ERROR_NONE;
HIPC_API hAPI = NULL;
int return_handle;
@@ -428,6 +464,11 @@ EXPORT_API int email_sync_header_for_all_account(int *handle)
int input_account_id = ALL_ACCOUNT;
int input_mailbox_id = 0; /* all case */
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
hAPI = emipc_create_email_api(_EMAIL_API_SYNC_HEADER);
EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE);
@@ -448,7 +489,7 @@ EXPORT_API int email_sync_header_for_all_account(int *handle)
if(emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
- EM_SAFE_FREE(mailbox_stream);
+ EM_SAFE_FREE(multi_user_name);
EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE);
}
@@ -457,14 +498,13 @@ EXPORT_API int email_sync_header_for_all_account(int *handle)
if (err != EMAIL_ERROR_NONE)
goto FINISH_OFF;
- emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &return_handle);
+ emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &return_handle);
memset(&as_noti_data, 0x00, sizeof(ASNotiData));
/* Get all accounts for sending notification to active sync engine. */
- if (!emstorage_get_account_list(&account_count, &account_tbl_array , true, false, &as_err)) {
+ if (!emstorage_get_account_list(multi_user_name, &account_count, &account_tbl_array , true, false, &as_err)) {
EM_DEBUG_EXCEPTION("emstorage_get_account_list failed [ %d ] ", as_err);
-
goto FINISH_OFF;
}
@@ -480,10 +520,11 @@ EXPORT_API int email_sync_header_for_all_account(int *handle)
*/
/* noti to active sync */
- as_noti_data.sync_header.handle = return_handle;
- as_noti_data.sync_header.account_id = account_tbl_array[i].account_id;
+ as_noti_data.sync_header.handle = return_handle;
+ as_noti_data.sync_header.account_id = account_tbl_array[i].account_id;
/* In case that Mailbox is NULL, SYNC ALL MAILBOX */
- as_noti_data.sync_header.mailbox_id = 0;
+ as_noti_data.sync_header.mailbox_id = 0;
+ as_noti_data.sync_header.multi_user_name = multi_user_name;
if ( em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_SYNC_HEADER, &as_noti_data) == false) {
EM_DEBUG_EXCEPTION("em_send_notification_to_active_sync_engine failed.");
@@ -503,7 +544,8 @@ FINISH_OFF:
if ( account_tbl_array )
emstorage_free_account(&account_tbl_array, account_count, NULL);
-
+
+ EM_SAFE_FREE(multi_user_name);
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -517,6 +559,13 @@ EXPORT_API int email_download_body(int mail_id, int with_attachment, int *handle
email_account_server_t account_server_type;
HIPC_API hAPI = NULL;
ASNotiData as_noti_data;
+ char *multi_user_name = NULL;
+
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
memset(&as_noti_data, 0x00, sizeof(ASNotiData));
if(mail_id <= 0) {
@@ -525,7 +574,7 @@ EXPORT_API int email_download_body(int mail_id, int with_attachment, int *handle
goto FINISH_OFF;
}
- if(!emstorage_get_mail_by_id(mail_id, &mail_table_data, true, &err) || !mail_table_data ) {
+ if(!emstorage_get_mail_by_id(multi_user_name, mail_id, &mail_table_data, true, &err) || !mail_table_data ) {
EM_DEBUG_EXCEPTION("Failed to get mail by mail_id [%d]", err);
goto FINISH_OFF;
}
@@ -538,7 +587,7 @@ EXPORT_API int email_download_body(int mail_id, int with_attachment, int *handle
account_id = mail_table_data->account_id;
/* 2010/02/12 ch715.lee : check account bind type and branch off */
- if ( em_get_account_server_type_by_account_id(account_id, &account_server_type, true, &err) == false ) {
+ if ( em_get_account_server_type_by_account_id(multi_user_name, 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;
}
@@ -551,10 +600,11 @@ EXPORT_API int email_download_body(int mail_id, int with_attachment, int *handle
}
/* noti to active sync */
- as_noti_data.download_body.handle = as_handle;
- as_noti_data.download_body.account_id = account_id;
- as_noti_data.download_body.mail_id = mail_id;
+ as_noti_data.download_body.handle = as_handle;
+ as_noti_data.download_body.account_id = account_id;
+ as_noti_data.download_body.mail_id = mail_id;
as_noti_data.download_body.with_attachment = with_attachment;
+ as_noti_data.download_body.multi_user_name = multi_user_name;
if ( em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_DOWNLOAD_BODY, &as_noti_data) == false) {
EM_DEBUG_EXCEPTION("em_send_notification_to_active_sync_engine failed.");
@@ -595,11 +645,9 @@ EXPORT_API int email_download_body(int mail_id, int with_attachment, int *handle
if (err != EMAIL_ERROR_NONE)
goto FINISH_OFF;
- if(handle)
- {
+ if(handle) {
emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), handle);
EM_DEBUG_LOG("RETURN VALUE : %d handle %d", err, *handle);
-
}
}
@@ -611,6 +659,8 @@ FINISH_OFF:
emstorage_free_mail(&mail_table_data, 1, &err);
}
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
@@ -622,13 +672,19 @@ FINISH_OFF:
EXPORT_API int email_download_attachment(int mail_id, int nth, int *handle)
{
EM_DEBUG_API_BEGIN ("mail_id[%d] nth[%d] handle[%p]", mail_id, nth, handle);
- char* mailbox_stream = NULL;
int err = EMAIL_ERROR_NONE;
emstorage_mail_tbl_t* mail_table_data = NULL;
int account_id = 0;
email_account_server_t account_server_type;
HIPC_API hAPI = NULL;
ASNotiData as_noti_data;
+ char *multi_user_name = NULL;
+
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
memset(&as_noti_data, 0x00, sizeof(ASNotiData));
if(mail_id <= 0) {
@@ -637,7 +693,7 @@ EXPORT_API int email_download_attachment(int mail_id, int nth, int *handle)
goto FINISH_OFF;
}
- if(!emstorage_get_mail_by_id(mail_id, &mail_table_data, true, &err) || !mail_table_data ) {
+ if(!emstorage_get_mail_by_id(multi_user_name, mail_id, &mail_table_data, true, &err) || !mail_table_data ) {
EM_DEBUG_EXCEPTION("Failed to get mail by mail_id [%d]", err);
goto FINISH_OFF;
}
@@ -648,8 +704,8 @@ EXPORT_API int email_download_attachment(int mail_id, int nth, int *handle)
}
account_id = mail_table_data->account_id;
-
- if ( em_get_account_server_type_by_account_id(account_id, &account_server_type, true, &err) == false ) {
+
+ if ( em_get_account_server_type_by_account_id(multi_user_name, 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;
}
@@ -662,10 +718,12 @@ EXPORT_API int email_download_attachment(int mail_id, int nth, int *handle)
}
/* noti to active sync */
- as_noti_data.download_attachment.handle = as_handle;
- as_noti_data.download_attachment.account_id = account_id;
- as_noti_data.download_attachment.mail_id = mail_id;
+ as_noti_data.download_attachment.handle = as_handle;
+ as_noti_data.download_attachment.account_id = account_id;
+ as_noti_data.download_attachment.mail_id = mail_id;
as_noti_data.download_attachment.attachment_order = nth;
+ as_noti_data.download_attachment.multi_user_name = multi_user_name;
+
if ( em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_DOWNLOAD_ATTACHMENT, &as_noti_data) == false) {
EM_DEBUG_EXCEPTION("em_send_notification_to_active_sync_engine failed.");
err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE;
@@ -700,7 +758,6 @@ EXPORT_API int email_download_attachment(int mail_id, int nth, int *handle)
/* Execute API */
if(emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
- EM_SAFE_FREE(mailbox_stream);
EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE);
}
@@ -721,6 +778,8 @@ FINISH_OFF:
emstorage_free_mail(&mail_table_data, 1, &err);
}
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
@@ -736,30 +795,36 @@ EXPORT_API int email_cancel_job(int input_account_id, int input_handle, email_ca
ASNotiData as_noti_data;
emstorage_account_tbl_t *account_list = NULL;
int i, account_count = 0;
+ char *multi_user_name = NULL;
if(input_account_id < 0)
return EMAIL_ERROR_INVALID_PARAM;
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
if ( input_account_id == ALL_ACCOUNT ) {
/* this means that job is executed with all account */
/* Get all accounts for sending notification to active sync engine. */
- if (!emstorage_get_account_list(&account_count, &account_list , true, false, &err)) {
+ if (!emstorage_get_account_list(multi_user_name, &account_count, &account_list , true, false, &err)) {
EM_DEBUG_EXCEPTION("emstorage_get_account_list failed [%d]", err);
goto FINISH_OFF;
}
for(i = 0; i < account_count; i++) {
- if ( em_get_account_server_type_by_account_id(account_list[i].account_id, &account_server_type, true, &err) == false ) {
+ if ( em_get_account_server_type_by_account_id(multi_user_name, account_list[i].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 ) {
memset(&as_noti_data, 0x00, sizeof(ASNotiData));
- as_noti_data.cancel_job.account_id = account_list[i].account_id;
- as_noti_data.cancel_job.handle = input_handle;
- as_noti_data.cancel_job.cancel_type = input_cancel_type;
-
+ as_noti_data.cancel_job.account_id = account_list[i].account_id;
+ as_noti_data.cancel_job.handle = input_handle;
+ as_noti_data.cancel_job.cancel_type = input_cancel_type;
+ as_noti_data.cancel_job.multi_user_name = multi_user_name;
if ( em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_CANCEL_JOB, &as_noti_data) == false) {
EM_DEBUG_EXCEPTION("em_send_notification_to_active_sync_engine failed.");
@@ -802,15 +867,16 @@ EXPORT_API int email_cancel_job(int input_account_id, int input_handle, email_ca
hAPI = NULL;
}
else {
- if ( em_get_account_server_type_by_account_id(input_account_id, &account_server_type, true, &err) == false ) {
+ if ( em_get_account_server_type_by_account_id(multi_user_name, 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 ) {
memset(&as_noti_data, 0x00, sizeof(ASNotiData));
- as_noti_data.cancel_job.account_id = input_account_id;
- as_noti_data.cancel_job.handle = input_handle;
+ as_noti_data.cancel_job.account_id = input_account_id;
+ as_noti_data.cancel_job.handle = input_handle;
+ as_noti_data.cancel_job.multi_user_name = multi_user_name;
if ( em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_CANCEL_JOB, &as_noti_data) == false) {
EM_DEBUG_EXCEPTION("em_send_notification_to_active_sync_engine failed.");
@@ -848,7 +914,8 @@ FINISH_OFF:
hAPI = NULL;
if (account_list)
emstorage_free_account(&account_list, account_count, NULL);
-
+
+ EM_SAFE_FREE(multi_user_name);
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -891,7 +958,7 @@ EXPORT_API int email_get_task_information(email_task_information_t **output_task
goto FINISH_OFF;
}
- 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");
err = EMAIL_ERROR_IPC_CRASH;
goto FINISH_OFF;
@@ -967,10 +1034,222 @@ 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;
+ char *multi_user_name = 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);
+
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
+ memset(&as_noti_data, 0, sizeof(ASNotiData)); /* initialization of union members */
+
+ if (em_get_account_server_type_by_account_id(multi_user_name,
+ 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;
+ as_noti_data.search_mail_on_server.multi_user_name = multi_user_name;
+
+ 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_SAFE_FREE(multi_user_name);
+ 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;
+ char *multi_user_name = 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);
+
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
+ memset(&as_noti_data, 0, sizeof(ASNotiData)); /* initialization of union members */
+
+ if (em_get_account_server_type_by_account_id(multi_user_name,
+ 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;
+ as_noti_data.clear_result_of_search_mail_on_server.multi_user_name = multi_user_name;
+
+ 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_SAFE_FREE(multi_user_name);
+ 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);
int err = EMAIL_ERROR_NONE;
+ char *multi_user_name = NULL;
email_account_server_t account_server_type;
HIPC_API hAPI = NULL;
@@ -980,7 +1259,12 @@ EXPORT_API int email_query_smtp_mail_size_limit(int account_id, int *handle)
goto FINISH_OFF;
}
- if (em_get_account_server_type_by_account_id(account_id, &account_server_type, false, &err) == false ) {
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
+ if (em_get_account_server_type_by_account_id(multi_user_name, account_id, &account_server_type, false, &err) == false ) {
EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err);
goto FINISH_OFF;
}
@@ -1015,6 +1299,7 @@ FINISH_OFF:
emipc_destroy_email_api(hAPI);
hAPI = (HIPC_API)NULL;
+ EM_SAFE_FREE(multi_user_name);
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
diff --git a/email-api/email-api-rule.c b/email-api/email-api-rule.c
index 3290150..4bd92c0 100755
--- a/email-api/email-api-rule.c
+++ b/email-api/email-api-rule.c
@@ -30,7 +30,6 @@
* email-service .
*/
-#include "email-api.h"
#include "string.h"
#include "email-convert.h"
#include "email-storage.h"
@@ -43,19 +42,26 @@ EXPORT_API int email_get_rule(int filter_id, email_rule_t** filtering_set)
EM_DEBUG_API_BEGIN ("filter_id[%d] filtering_set[%p]", filter_id, filtering_set);
int err = 0;
+ char *multi_user_name = NULL;
EM_IF_NULL_RETURN_VALUE(filtering_set, EMAIL_ERROR_INVALID_PARAM);
EM_IF_NULL_RETURN_VALUE(filter_id, EMAIL_ERROR_INVALID_PARAM);
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
- if (!emstorage_get_rule_by_id(filter_id, (emstorage_rule_tbl_t**)filtering_set, true, &err)) {
+ if (!emstorage_get_rule_by_id(multi_user_name, filter_id, (emstorage_rule_tbl_t**)filtering_set, true, &err)) {
EM_DEBUG_EXCEPTION("emstorage_get_rule_by_id failed [%d]", err);
-
goto FINISH_OFF;
} else
err = EMAIL_ERROR_NONE;
FINISH_OFF:
+
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -67,22 +73,28 @@ EXPORT_API int email_get_rule_list(email_rule_t** filtering_set, int* count)
int err = EMAIL_ERROR_NONE;
int is_completed = 0;
+ char *multi_user_name = NULL;
EM_IF_NULL_RETURN_VALUE(filtering_set, EMAIL_ERROR_INVALID_PARAM);
EM_IF_NULL_RETURN_VALUE(count, EMAIL_ERROR_INVALID_PARAM);
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
*count = 1000;
-
- if (!emstorage_get_rule(0, 0, 0, count, &is_completed, (emstorage_rule_tbl_t**)filtering_set, true, &err)) {
- EM_DEBUG_EXCEPTION("emstorage_get_rule failed [%d]", err);
-
+ if (!emstorage_get_rule(multi_user_name, 0, 0, 0, count, &is_completed, (emstorage_rule_tbl_t**)filtering_set, true, &err)) {
+ EM_DEBUG_EXCEPTION("emstorage_get_rule failed [%d]", err);
goto FINISH_OFF;
} else
err = EMAIL_ERROR_NONE;
FINISH_OFF:
+
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
diff --git a/email-api/email-api-smime.c b/email-api/email-api-smime.c
index c84890b..293f08e 100755
--- a/email-api/email-api-smime.c
+++ b/email-api/email-api-smime.c
@@ -30,8 +30,8 @@
* Email Engine .
*/
-#include "email-api.h"
#include "string.h"
+#include "email-api-mail.h"
#include "email-convert.h"
#include "email-api-account.h"
#include "email-storage.h"
@@ -150,36 +150,48 @@ EXPORT_API int email_get_certificate(char *email_address, email_certificate_t **
EM_DEBUG_API_BEGIN ();
int err = EMAIL_ERROR_NONE;
char temp_email_address[130] = {0, };
+ char *multi_user_name = NULL;
emstorage_certificate_tbl_t *cert = NULL;
EM_IF_NULL_RETURN_VALUE(email_address, EMAIL_ERROR_INVALID_PARAM);
EM_IF_NULL_RETURN_VALUE(certificate, EMAIL_ERROR_INVALID_PARAM);
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
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)) {
+
+ if (!emstorage_get_certificate_by_email_address(multi_user_name, temp_email_address, &cert, false, 0, &err)) {
EM_DEBUG_EXCEPTION("emstorage_get_certificate_by_index failed - %d", err);
- return err;
+ goto FINISH_OFF;
}
if (!em_convert_certificate_tbl_to_certificate(cert, certificate, &err)) {
EM_DEBUG_EXCEPTION("em_convert_certificate_tbl_to_certificate failed");
- return err;
+ goto FINISH_OFF;
}
-
+
+FINISH_OFF:
+
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
-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(int mail_id, email_mail_data_t **output_mail_data,
+ email_attachment_data_t **output_attachment_data,
+ int *output_attachment_count, int *verify)
{
EM_DEBUG_API_BEGIN ("mail_id[%d]", mail_id);
int err = EMAIL_ERROR_NONE;
int p_output_attachment_count = 0;
- int i = 0;
- int verify = 0;
+ int i = 0;
char *decrypt_filepath = NULL;
- char *search = NULL;
+ char *search = NULL;
+ char *multi_user_name = NULL;
email_mail_data_t *p_output_mail_data = NULL;
email_attachment_data_t *p_output_attachment_data = NULL;
emstorage_account_tbl_t *p_account_tbl = NULL;
@@ -192,17 +204,22 @@ EXPORT_API int email_get_decrypt_message(int mail_id, email_mail_data_t **output
goto FINISH_OFF;
}
- if ((err = emcore_get_mail_data(mail_id, &p_output_mail_data)) != EMAIL_ERROR_NONE) {
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]");
+ goto FINISH_OFF;
+ }
+
+ if ((err = emcore_get_mail_data(multi_user_name, mail_id, &p_output_mail_data)) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emcore_get_mail_data failed");
goto FINISH_OFF;
}
- if (!emstorage_get_account_by_id(p_output_mail_data->account_id, EMAIL_ACC_GET_OPT_OPTIONS, &p_account_tbl, false, &err)) {
+ if (!emstorage_get_account_by_id(multi_user_name, p_output_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;
}
- if ((err = emcore_get_attachment_data_list(mail_id, &p_output_attachment_data, &p_output_attachment_count)) != EMAIL_ERROR_NONE) {
+ if ((err = emcore_get_attachment_data_list(multi_user_name, mail_id, &p_output_attachment_data, &p_output_attachment_count)) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emcore_get_attachment_data_list failed");
goto FINISH_OFF;
}
@@ -233,12 +250,12 @@ EXPORT_API int email_get_decrypt_message(int mail_id, email_mail_data_t **output
}
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) {
+ 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) {
+ 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;
}
@@ -279,19 +296,26 @@ FINISH_OFF:
if (p_output_attachment_data)
email_free_attachment_data(&p_output_attachment_data, p_output_attachment_count);
+ EM_SAFE_FREE(multi_user_name);
+
EM_DEBUG_API_END ("err[%d]", err);
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)
+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,
+ int *verify)
{
EM_DEBUG_API_BEGIN ();
int err = EMAIL_ERROR_NONE;
- int i = 0;
- int verify = 0;
+ int i = 0;
char *decrypt_filepath = NULL;
- char *search = NULL;
+ char *search = NULL;
+ char *multi_user_name = NULL;
emstorage_account_tbl_t *p_account_tbl = NULL;
EM_IF_NULL_RETURN_VALUE(input_mail_data, EMAIL_ERROR_INVALID_PARAM);
@@ -302,7 +326,12 @@ EXPORT_API int email_get_decrypt_message_ex(email_mail_data_t *input_mail_data,
goto FINISH_OFF;
}
- if (!emstorage_get_account_by_id(input_mail_data->account_id, EMAIL_ACC_GET_OPT_OPTIONS, &p_account_tbl, false, &err)) {
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
+ if (!emstorage_get_account_by_id(multi_user_name, 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;
}
@@ -325,20 +354,20 @@ EXPORT_API int email_get_decrypt_message_ex(email_mail_data_t *input_mail_data,
}
if (input_mail_data->smime_type == EMAIL_SMIME_ENCRYPTED || input_mail_data->smime_type == EMAIL_SMIME_SIGNED_AND_ENCRYPTED) {
- emcore_init_openssl_library();
+ 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();
+ emcore_clean_openssl_library();
goto FINISH_OFF;
}
- emcore_clean_openssl_library();
+ 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) {
+ 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) {
+ 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;
}
@@ -369,6 +398,7 @@ EXPORT_API int email_get_decrypt_message_ex(email_mail_data_t *input_mail_data,
FINISH_OFF:
EM_SAFE_FREE(decrypt_filepath);
+ EM_SAFE_FREE(multi_user_name);
if (p_account_tbl)
emstorage_free_account(&p_account_tbl, 1, NULL);
@@ -380,11 +410,15 @@ FINISH_OFF:
EXPORT_API int email_verify_signature(int mail_id, int *verify)
{
EM_DEBUG_API_BEGIN ("mail_id[%d]", mail_id);
+
+ if (mail_id <= 0) {
+ EM_DEBUG_EXCEPTION("Invalid parameter");
+ return EMAIL_ERROR_INVALID_PARAM;
+ }
+
int result_from_ipc = 0;
- int err = EMAIL_ERROR_NONE;
int p_verify = 0;
-
- EM_IF_NULL_RETURN_VALUE(mail_id, EMAIL_ERROR_INVALID_PARAM);
+ int err = EMAIL_ERROR_NONE;
HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_VERIFY_SIGNATURE);
if (hAPI == NULL) {
@@ -441,12 +475,18 @@ EXPORT_API int email_verify_signature_ex(email_mail_data_t *input_mail_data, ema
break;
}
+ if (count == input_attachment_count) {
+ EM_DEBUG_LOG("No have the signed attachment");
+ EM_DEBUG_EXCEPTION("Invalid parameter");
+ return EMAIL_ERROR_INVALID_PARAM;
+ }
+
if (input_mail_data->smime_type == EMAIL_SMIME_SIGNED) {
- emcore_init_openssl_library();
+ 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();
+ 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);
@@ -540,10 +580,10 @@ EXPORT_API int email_check_ocsp_status(char *email_address, char *response_url,
EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE);
}
- emipc_get_paramter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+ emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
if (err == EMAIL_ERROR_NONE) {
if (handle)
- emipc_get_paramter(hAPI, ePARAMETER_OUT, 1, sizeof(int), handle);
+ emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), handle);
}
}
*/
@@ -557,12 +597,18 @@ EXPORT_API int email_validate_certificate(int account_id, char *email_address, u
int err = EMAIL_ERROR_NONE;
int as_handle = 0;
+ char *multi_user_name = NULL;
email_account_server_t account_server_type;
ASNotiData as_noti_data;
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
memset(&as_noti_data, 0x00, sizeof(ASNotiData));
- if (em_get_account_server_type_by_account_id(account_id, &account_server_type, false, &err) == false) {
+ if (em_get_account_server_type_by_account_id(multi_user_name, account_id, &account_server_type, false, &err) == false) {
EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err);
err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE;
goto FINISH_OFF;
@@ -582,7 +628,8 @@ EXPORT_API int email_validate_certificate(int account_id, char *email_address, u
as_noti_data.validate_certificate.handle = as_handle;
as_noti_data.validate_certificate.account_id = account_id;
- as_noti_data.validate_certificate.email_address = strdup(email_address);
+ as_noti_data.validate_certificate.email_address = email_address;
+ as_noti_data.validate_certificate.multi_user_name = multi_user_name;
if (em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_VALIDATE_CERTIFICATE, &as_noti_data) == false) {
EM_DEBUG_EXCEPTION("em_send_notification_to_active_sync_engine failed");
@@ -595,6 +642,7 @@ EXPORT_API int email_validate_certificate(int account_id, char *email_address, u
FINISH_OFF:
+ EM_SAFE_FREE(multi_user_name);
EM_DEBUG_API_END ("err[%d]", err);
return err;
}
@@ -609,12 +657,18 @@ EXPORT_API int email_get_resolve_recipients(int account_id, char *email_address,
int err = EMAIL_ERROR_NONE;
int as_handle = 0;
+ char *multi_user_name = NULL;
email_account_server_t account_server_type;
ASNotiData as_noti_data;
+ if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err);
+ goto FINISH_OFF;
+ }
+
memset(&as_noti_data, 0x00, sizeof(ASNotiData));
- if (em_get_account_server_type_by_account_id(account_id, &account_server_type, false, &err) == false) {
+ if (em_get_account_server_type_by_account_id(multi_user_name, account_id, &account_server_type, false, &err) == false) {
EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err);
err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE;
goto FINISH_OFF;
@@ -632,9 +686,10 @@ EXPORT_API int email_get_resolve_recipients(int account_id, char *email_address,
goto FINISH_OFF;
}
- as_noti_data.get_resolve_recipients.handle = as_handle;
- as_noti_data.get_resolve_recipients.account_id = account_id;
- as_noti_data.get_resolve_recipients.email_address = strdup(email_address);
+ as_noti_data.get_resolve_recipients.handle = as_handle;
+ as_noti_data.get_resolve_recipients.account_id = account_id;
+ as_noti_data.get_resolve_recipients.email_address = email_address;
+ as_noti_data.get_resolve_recipients.multi_user_name = multi_user_name;
if (em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_RESOLVE_RECIPIENT, &as_noti_data) == false) {
EM_DEBUG_EXCEPTION("em_send_notification_to_active_sync_engine failed");
@@ -647,6 +702,7 @@ EXPORT_API int email_get_resolve_recipients(int account_id, char *email_address,
FINISH_OFF:
+ EM_SAFE_FREE(multi_user_name);
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 6da101a..f9c7ced 100755
--- a/email-api/include/email-api-account.h
+++ b/email-api/include/email-api-account.h
@@ -26,7 +26,6 @@
#include "email-types.h"
/**
- * @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.
@@ -145,7 +144,6 @@
*/
/**
- * @internal
* @addtogroup EMAIL_SERVICE_ACCOUNT_MODULE
* @{
*/
diff --git a/email-api/include/email-api-etc.h b/email-api/include/email-api-etc.h
index f97a49c..f6d3821 100755
--- a/email-api/include/email-api-etc.h
+++ b/email-api/include/email-api-etc.h
@@ -25,7 +25,6 @@
*/
/**
- * @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.
@@ -38,7 +37,6 @@
*/
/**
- * @internal
* @addtogroup EMAIL_SERVICE_FRAMEWORK
* @{
*/
diff --git a/email-api/include/email-api-init.h b/email-api/include/email-api-init.h
index 6e15f3f..22f4e93 100755
--- a/email-api/include/email-api-init.h
+++ b/email-api/include/email-api-init.h
@@ -26,7 +26,6 @@
#include "email-types.h"
/**
- * @internal
* @file email-api-init.h
* @brief This file contains the data structures and interfaces of Email FW Initialization provided by email-service.
*
@@ -74,7 +73,6 @@
*/
/**
- * @internal
* @addtogroup EMAIL_SERVICE_ETC_MODULE
* @{
*/
diff --git a/email-api/include/email-api-mail.h b/email-api/include/email-api-mail.h
index b2cdf1a..9ff8c12 100755
--- a/email-api/include/email-api-mail.h
+++ b/email-api/include/email-api-mail.h
@@ -34,7 +34,6 @@
*/
/**
- * @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.
@@ -47,7 +46,6 @@
*/
/**
- * @internal
* @addtogroup EMAIL_SERVICE_MAIL_MODULE
* @{
*/
diff --git a/email-api/include/email-api-mailbox.h b/email-api/include/email-api-mailbox.h
index 60ceeea..52e98a8 100755
--- a/email-api/include/email-api-mailbox.h
+++ b/email-api/include/email-api-mailbox.h
@@ -105,7 +105,6 @@
*/
/**
- * @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.
@@ -118,7 +117,6 @@
*/
/**
- * @internal
* @addtogroup EMAIL_SERVICE_MAILBOX_MODULE
* @{
*/
diff --git a/email-api/include/email-api-network.h b/email-api/include/email-api-network.h
index cbce793..f439578 100755
--- a/email-api/include/email-api-network.h
+++ b/email-api/include/email-api-network.h
@@ -26,7 +26,6 @@
#include "email-types.h"
/**
- * @internal
* @file email-api-network.h
* @brief This file contains the data structures and interfaces of Network related Functionality provided by
* email-service.
@@ -141,7 +140,6 @@
*/
/**
- * @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.
@@ -154,7 +152,6 @@
*/
/**
- * @internal
* @addtogroup EMAIL_SERVICE_NETWORK_MODULE
* @{
*/
@@ -367,6 +364,48 @@ EXPORT_API int email_send_saved(int account_id, int *handle);
EXPORT_API int email_sync_imap_mailbox_list(int account_id, int *handle);
/**
+ * @brief Searches the mails on the server.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/email
+ *
+ * @param[in] account_id The Account ID
+ * @param[in] mailbox_id The Mailbox ID
+ * @param[in] input_search_filter_list The searching type \n
+ * #EMAIL_SEARCH_FILTER_SUBJECT, #EMAIL_SEARCH_FILTER_SENDER, \n
+ * #EMAIL_SEARCH_FILTER_RECIPIENT, #EMAIL_SEARCH_FILTER_ALL, etc \n
+ * and The value to use for searching \n
+ * Example: Subject, email address, display name
+ * @param[in] input_search_filter_count Count of input_search_filter_list
+ * @param[out] output_handle The handle for search on server
+ *
+ * @return #EMAIL_ERROR_NONE on success,
+ * otherwise an error code (see #EMAIL_ERROR_XXX) on failure
+ *
+ * @see #email_search_filter_t
+ */
+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);
+
+/**
+ * @brief Deletes temporarily downloaded mails from the local storage.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/email
+ *
+ * @param[in] input_account_id The Account ID
+ *
+ * @return #EMAIL_ERROR_NONE on success,
+ * otherwise an error code (see #EMAIL_ERROR_XXX) on failure
+ *
+ * @see #email_search_filter_t
+ */
+EXPORT_API int email_clear_result_of_search_mail_on_server(int input_account_id);
+
+/**
* @brief Queries the maximum mail size limit from the SMTP server.
*
* @since_tizen 2.3
diff --git a/email-api/include/email-api-rule.h b/email-api/include/email-api-rule.h
index 68b5644..e9b6e90 100755
--- a/email-api/include/email-api-rule.h
+++ b/email-api/include/email-api-rule.h
@@ -92,7 +92,6 @@
*/
/**
- * @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.
@@ -105,7 +104,6 @@
*/
/**
- * @internal
* @addtogroup EMAIL_SERVICE_RULE_MOUDLE
* @{
*/
diff --git a/email-api/include/email-api-smime.h b/email-api/include/email-api-smime.h
index a9d27d8..4019d90 100755
--- a/email-api/include/email-api-smime.h
+++ b/email-api/include/email-api-smime.h
@@ -33,7 +33,6 @@ extern "C" {
*/
/**
- * @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.
@@ -46,7 +45,6 @@ extern "C" {
*/
/**
- * @internal
* @addtogroup EMAIL_SERVICE_SMIME_MODULE
* @{
*/
@@ -103,11 +101,15 @@ EXPORT_API int email_get_certificate(char *email_address, email_certificate_t **
* @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
+ * @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_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(int mail_id, email_mail_data_t **output_mail_data,
+ email_attachment_data_t **output_attachment_data,
+ int *output_attachment_count, int *verify);
/**
* @brief Gets a decrypted message.
@@ -120,10 +122,18 @@ EXPORT_API int email_get_decrypt_message(int mail_id, email_mail_data_t **output
* @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
+ * @param[out] verify The verification state \n
+ * [false : failed verification, true : verification successful]
+
* @return EMAIL_ERROR_NONE on success or an error code (refer to EMAIL_ERROR_XXX) on failure
*/
-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);
+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,
+ int *verify);
/**
* @brief Verifies a signed mail.
*