summaryrefslogtreecommitdiff
path: root/email-daemon
diff options
context:
space:
mode:
authorMinsoo Kim <minnsoo.kim@samsung.com>2013-04-12 10:55:15 +0900
committerMinsoo Kim <minnsoo.kim@samsung.com>2013-04-12 10:55:15 +0900
commit6a8e93a8dcdec88628560de64cbced6a534f4063 (patch)
tree0554277f0fed822fc017c776aced826588e2d3d3 /email-daemon
parentfe4c0288642939dbe5414bb465e50cae0a9787f4 (diff)
downloademail-service-6a8e93a8dcdec88628560de64cbced6a534f4063.tar.gz
email-service-6a8e93a8dcdec88628560de64cbced6a534f4063.tar.bz2
email-service-6a8e93a8dcdec88628560de64cbced6a534f4063.zip
apply removal of mailbox_name field
Diffstat (limited to 'email-daemon')
-rwxr-xr-xemail-daemon/email-daemon-etc.c12
-rwxr-xr-xemail-daemon/email-daemon-init.c25
-rwxr-xr-xemail-daemon/email-daemon-mailbox.c74
-rwxr-xr-xemail-daemon/include/email-daemon.h22
-rwxr-xr-xemail-daemon/main.c130
5 files changed, 68 insertions, 195 deletions
diff --git a/email-daemon/email-daemon-etc.c b/email-daemon/email-daemon-etc.c
index 1026eae..c75d1ab 100755
--- a/email-daemon/email-daemon-etc.c
+++ b/email-daemon/email-daemon-etc.c
@@ -57,18 +57,6 @@ int emdaemon_unregister_event_callback(email_action_t action, email_event_callba
return emcore_unregister_event_callback(action, callback);
}
-INTERNAL_FUNC void emdaemon_get_event_queue_status(int* on_sending, int* on_receiving)
-{
- emcore_get_event_queue_status(on_sending, on_receiving);
-}
-
-INTERNAL_FUNC int emdaemon_get_pending_job(email_action_t action, int account_id, int mail_id, email_event_status_type_t* status)
-{
- EM_DEBUG_FUNC_BEGIN("action[%d], account_id[%d], mail_id[%d]", action, account_id, mail_id);
-
- return emcore_get_pending_event(action, account_id, mail_id, status);
-}
-
INTERNAL_FUNC int emdaemon_cancel_job(int account_id, int handle, int* err_code)
{
EM_DEBUG_FUNC_BEGIN("account_id[%d], handle[%d], err_code[%p]", account_id, handle, err_code);
diff --git a/email-daemon/email-daemon-init.c b/email-daemon/email-daemon-init.c
index 756c3c4..bb33235 100755
--- a/email-daemon/email-daemon-init.c
+++ b/email-daemon/email-daemon-init.c
@@ -293,6 +293,27 @@ INTERNAL_FUNC void callback_for_BLOCKING_MODE_STATUS(keynode_t *input_node, void
}
#endif /* __FEATURE_BLOCKING_MODE__ */
+static void callback_for_VCONFKEY_MSG_SERVER_READY(keynode_t *input_node, void *input_user_data)
+{
+ EM_DEBUG_FUNC_BEGIN();
+ int msg_server_ready = 0;
+
+ if (!input_node) {
+ EM_DEBUG_EXCEPTION("Invalid param");
+ return;
+ }
+
+ msg_server_ready = vconf_keynode_get_bool(input_node);
+
+ if(msg_server_ready) {
+ if(emdaemon_initialize_emn() != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emdaemon_initialize_emn failed");
+ }
+ }
+
+ return;
+}
+
INTERNAL_FUNC int emdaemon_initialize(int* err_code)
{
EM_DEBUG_FUNC_BEGIN();
@@ -343,7 +364,9 @@ INTERNAL_FUNC int emdaemon_initialize(int* err_code)
}
#ifdef __FEATURE_OMA_EMN__
- emdaemon_initialize_emn();
+ if(emdaemon_initialize_emn() != EMAIL_ERROR_NONE) {
+ vconf_notify_key_changed(VCONFKEY_MSG_SERVER_READY, callback_for_VCONFKEY_MSG_SERVER_READY, NULL);
+ }
#endif
/* Subscribe Events */
diff --git a/email-daemon/email-daemon-mailbox.c b/email-daemon/email-daemon-mailbox.c
index 77142c1..d71f8e5 100755
--- a/email-daemon/email-daemon-mailbox.c
+++ b/email-daemon/email-daemon-mailbox.c
@@ -248,60 +248,6 @@ FINISH_OFF:
return ret;
}
-
-INTERNAL_FUNC int emdaemon_update_mailbox(email_mailbox_t* old_mailbox, email_mailbox_t* new_mailbox, int on_server, int *handle, int* err_code)
-{
- EM_DEBUG_FUNC_BEGIN("old_mailbox[%p], new_mailbox[%p], on_server[%d], handle[%p], err_code[%p]", old_mailbox, new_mailbox, on_server, handle, err_code);
-
- /* default variable */
- int ret = false;;
- int err = EMAIL_ERROR_NONE;
- email_account_t* ref_account = NULL;
-
- if (!old_mailbox || old_mailbox->account_id <= 0 || !old_mailbox->mailbox_name
- || !new_mailbox || new_mailbox->account_id <= 0 || !new_mailbox->mailbox_name) {
- EM_DEBUG_EXCEPTION("INVALID PARAM");
- if (old_mailbox != NULL)
- EM_DEBUG_EXCEPTION("old_mailbox->account_id[%d], old_mailbox->mailbox_name[%p]", old_mailbox->account_id, old_mailbox->mailbox_name);
- if (new_mailbox != NULL)
- EM_DEBUG_EXCEPTION("new_mailbox->account_id[%d], new_mailbox->mailbox_name[%p]", new_mailbox->account_id, new_mailbox->mailbox_name);
-
- err = EMAIL_ERROR_INVALID_PARAM;
- goto FINISH_OFF;
- }
-
- ref_account = emcore_get_account_reference(old_mailbox->account_id);
-
- if (!ref_account) {
- EM_DEBUG_EXCEPTION("emcore_get_account_reference failed [%d]", old_mailbox->account_id);
- err = EMAIL_ERROR_INVALID_ACCOUNT; /* instead of EMAIL_ERROR_INVALID_PARAM; */
- goto FINISH_OFF;
- }
-
- email_event_t event_data;
- memset(&event_data, 0x00, sizeof(email_event_t));
-
- /* Update mailbox information only on local db */
- if (!emcore_update_mailbox(old_mailbox, new_mailbox, &err)) {
- EM_DEBUG_EXCEPTION("emcore_modify failed [%d]", err);
- goto FINISH_OFF;
- }
-
- ret = true;
-
-FINISH_OFF:
-
- if (ref_account) {
- emcore_free_account(ref_account);
- EM_SAFE_FREE(ref_account);
- }
-
- if (err_code)
- *err_code = err;
- EM_DEBUG_FUNC_END();
- return ret;
-}
-
INTERNAL_FUNC int emdaemon_set_mailbox_type(int input_mailbox_id, email_mailbox_type_e input_mailbox_type)
{
EM_DEBUG_FUNC_BEGIN("input_mailbox_id [%d], input_mailbox_type [%d]", input_mailbox_id, input_mailbox_type);
@@ -491,7 +437,6 @@ INTERNAL_FUNC int emdaemon_sync_header(int input_account_id, int input_mailbox_i
int err = EMAIL_ERROR_NONE;
email_event_t event_data;
- email_account_t* ref_account = NULL;
memset(&event_data, 0x00, sizeof(email_event_t));
@@ -514,15 +459,7 @@ INTERNAL_FUNC int emdaemon_sync_header(int input_account_id, int input_mailbox_i
EM_DEBUG_EXCEPTION("emcore_insert_event falied [%d]", err);
goto FINISH_OFF;
}
- }
- else {
-
- if (!(ref_account = emcore_get_account_reference(input_account_id))) {
- EM_DEBUG_EXCEPTION("emcore_get_account_reference failed [%d]", input_account_id);
- err = EMAIL_ERROR_INVALID_ACCOUNT;
- goto FINISH_OFF;
- }
-
+ } else {
/* Modified the code to sync all mailbox in a Single Event */
event_data.type = EMAIL_EVENT_SYNC_HEADER;
event_data.account_id = input_account_id;
@@ -547,11 +484,6 @@ INTERNAL_FUNC int emdaemon_sync_header(int input_account_id, int input_mailbox_i
FINISH_OFF:
- if (ref_account) {
- emcore_free_account(ref_account);
- EM_SAFE_FREE(ref_account);
- }
-
if (err_code)
*err_code = err;
EM_DEBUG_FUNC_END();
@@ -636,8 +568,8 @@ INTERNAL_FUNC int emdaemon_rename_mailbox(int input_mailbox_id, char *input_mail
}
}
else {
- if ((err = emstorage_rename_mailbox(input_mailbox_id, input_mailbox_path, input_mailbox_alias, true)) != EMAIL_ERROR_NONE) {
- EM_DEBUG_EXCEPTION("emstorage_rename_mailbox failed [%d]", err);
+ if ((err = emcore_rename_mailbox(input_mailbox_id, input_mailbox_path, input_mailbox_alias, false, true, 0)) != EMAIL_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("emcore_rename_mailbox failed [%d]", err);
goto FINISH_OFF;
}
}
diff --git a/email-daemon/include/email-daemon.h b/email-daemon/include/email-daemon.h
index dced421..06a742c 100755
--- a/email-daemon/include/email-daemon.h
+++ b/email-daemon/include/email-daemon.h
@@ -557,26 +557,6 @@ INTERNAL_FUNC int emdaemon_register_event_callback(email_action_t action, email_
INTERNAL_FUNC int emdaemon_unregister_event_callback(email_action_t action, email_event_callback callback);
/**
- * Get current event queue status.
- *
- * @param[out] on_sending True if sending is in progress.
- * @param[out] on_receiving True if receiving is in progress.
- * @remarks N/A
- */
-INTERNAL_FUNC void emdaemon_get_event_queue_status(int* on_sending, int* on_receiving);
-
-/**
- * Get the handle of a pending job.
- *
- * @param[in] action Specifies kind of the job.
- * @param[in] account_id Specifies the account ID.
- * @param[in] mail_id Specifies the mail ID.
- * @remarks N/A
- * @return This function return its handle if a pending job exists, otherwise -1.
- */
-INTERNAL_FUNC int emdaemon_get_pending_job(email_action_t action, int account_id, int mail_id, email_event_status_type_t* status);
-
-/**
* Cancel a progressive work.
*
* @param[in] account_id Specifies the account ID.
@@ -640,8 +620,6 @@ INTERNAL_FUNC int emdaemon_insert_accountinfo_to_contact(email_account_t* accoun
INTERNAL_FUNC int emdaemon_update_accountinfo_to_contact(email_account_t* old_account, email_account_t* new_account);
-INTERNAL_FUNC int emdaemon_update_mailbox(email_mailbox_t* old_mailbox, email_mailbox_t* new_mailbox, int on_server, int *handle, int* err_code);
-
INTERNAL_FUNC int emdaemon_set_mailbox_type(int input_mailbox_id, email_mailbox_type_e input_mailbox_type);
INTERNAL_FUNC int emdaemon_set_local_mailbox(int input_mailbox_id, int input_is_local_mailbox);
diff --git a/email-daemon/main.c b/email-daemon/main.c
index 959a349..6c2109b 100755
--- a/email-daemon/main.c
+++ b/email-daemon/main.c
@@ -1765,30 +1765,6 @@ void stb_retry_sending_mail(HIPC_API a_hAPI)
EM_DEBUG_FUNC_END();
}
-void stb_get_event_queue_status(HIPC_API a_hAPI)
-{
- EM_DEBUG_FUNC_BEGIN();
- int on_sending = 0;
- int on_receiving = 0;
-
- /*get the network status */
- emdaemon_get_event_queue_status(&on_sending, &on_receiving);
-
- /* on_sending */
- if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &on_sending, sizeof(int)))
- EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
-
- /* on_receving */
- if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &on_receiving, sizeof(int)))
- EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
-
- EM_DEBUG_LOG("stb_get_event_queue_status - Before Execute API");
- if (!emipc_execute_stub_api(a_hAPI))
- EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
-
- EM_DEBUG_FUNC_END();
-}
-
void stb_cancel_job(HIPC_API a_hAPI)
{
EM_DEBUG_FUNC_BEGIN();
@@ -1812,61 +1788,6 @@ void stb_cancel_job(HIPC_API a_hAPI)
EM_DEBUG_FUNC_END();
}
-void stb_get_pending_job(HIPC_API a_hAPI)
-{
- EM_DEBUG_FUNC_BEGIN();
- email_action_t action = -1;
- int account_id = 0;
- int mail_id = -1;
- int err = EMAIL_ERROR_NONE;
- email_event_status_type_t status = 0;
-
- emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &action);
- EM_DEBUG_LOG("action [%d]", action);
-
- emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, sizeof(int), &account_id);
- EM_DEBUG_LOG("account_id [%d]", account_id);
-
- emipc_get_parameter(a_hAPI, ePARAMETER_IN, 2, sizeof(int), &mail_id);
- EM_DEBUG_LOG("mail_id [%d]", mail_id);
-
- if(emdaemon_get_pending_job(action, account_id, mail_id, &status))
- err = EMAIL_ERROR_NONE;
- else
- err = EMAIL_ERROR_UNKNOWN;
-
- if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
- EM_DEBUG_EXCEPTION("emipc_add_parameter local_result failed ");
- if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &status, sizeof(int)))
- EM_DEBUG_EXCEPTION("emipc_add_parameter status failed ");
- if (!emipc_execute_stub_api(a_hAPI))
- EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed ");
- EM_DEBUG_FUNC_END();
-}
-
-void stb_print_receiving_event_queue_via_debug_msg(HIPC_API a_hAPI)
-{
- email_event_t *event_queue = NULL;
- int event_active_queue = 0, err, i;
-
- emcore_get_receiving_event_queue(&event_queue, &event_active_queue, &err);
-
- EM_DEBUG_LOG("======================================================================");
- EM_DEBUG_LOG("Event active index [%d]", event_active_queue);
- EM_DEBUG_LOG("======================================================================");
- for(i = 1; i < 32; i++)
- EM_DEBUG_LOG("event[%d] : type[%d], account_id[%d], arg[%d], status[%d]", i, event_queue[i].type, event_queue[i].account_id, event_queue[i].event_param_data_4, event_queue[i].status);
- EM_DEBUG_LOG("======================================================================");
- EM_DEBUG_LOG("======================================================================");
-
- if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
- EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
-
- if (!emipc_execute_stub_api(a_hAPI))
- EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
- EM_DEBUG_FUNC_END();
-}
-
void stb_cancel_send_mail_job(HIPC_API a_hAPI)
{
EM_DEBUG_FUNC_BEGIN();
@@ -2185,6 +2106,40 @@ void stb_get_password_length(HIPC_API a_hAPI)
EM_DEBUG_FUNC_END();
}
+void stb_get_task_information(HIPC_API a_hAPI)
+{
+ EM_DEBUG_FUNC_BEGIN();
+ int err = 0;
+ int task_information_count = 0;
+ int stream_length;
+ email_task_information_t *task_information = NULL;
+ char *task_information_stream = NULL;
+
+ err = emcore_get_task_information(&task_information, &task_information_count);
+
+ if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+ EM_DEBUG_LOG("emipc_add_parameter failed ");
+
+ /* email_task_information_t */
+ if(task_information_count) {
+ task_information_stream = em_convert_task_information_to_byte_stream(task_information, task_information_count, &stream_length);
+
+ if((stream_length > 0) && !emipc_add_dynamic_parameter(a_hAPI, ePARAMETER_OUT, task_information_stream, stream_length)) {
+ EM_DEBUG_EXCEPTION("emipc_add_dynamic_parameter failed");
+ err = EMAIL_ERROR_OUT_OF_MEMORY;
+ }
+ }
+
+ if (!emipc_execute_stub_api(a_hAPI))
+ EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
+
+ if(task_information) {
+ EM_SAFE_FREE(task_information);
+ }
+
+ EM_DEBUG_FUNC_END();
+}
+
void stb_add_certificate(HIPC_API a_hAPI)
{
int err = EMAIL_ERROR_NONE;
@@ -2836,6 +2791,11 @@ FINISH_OFF:
EM_DEBUG_LOG("emcore_send_task_status_signal failed [%d]", err_for_signal);
}
+ if (ref_account) { /*prevent 49435*/
+ emcore_free_account(ref_account);
+ EM_SAFE_FREE(ref_account);
+ }
+
/* Free task parameter */
EM_SAFE_FREE(task_param->mailbox_id_array);
EM_SAFE_FREE(task_param);
@@ -3151,14 +3111,6 @@ void stb_API_mapper(HIPC_API a_hAPI)
stb_cancel_job(a_hAPI);
break;
- case _EMAIL_API_GET_PENDING_JOB:
- stb_get_pending_job(a_hAPI);
- break;
-
- case _EMAIL_API_NETWORK_GET_STATUS:
- stb_get_event_queue_status(a_hAPI);
- break;
-
case _EMAIL_API_SEND_RETRY:
stb_retry_sending_mail(a_hAPI);
break;
@@ -3195,8 +3147,8 @@ void stb_API_mapper(HIPC_API a_hAPI)
stb_get_password_length(a_hAPI);
break;
- case _EMAIL_API_PRINT_RECEIVING_EVENT_QUEUE :
- stb_print_receiving_event_queue_via_debug_msg(a_hAPI);
+ case _EMAIL_API_GET_TASK_INFORMATION:
+ stb_get_task_information(a_hAPI);
break;
case _EMAIL_API_ADD_CERTIFICATE: