apply removal of mailbox_name field
authorMinsoo Kim <minnsoo.kim@samsung.com>
Fri, 12 Apr 2013 01:55:15 +0000 (10:55 +0900)
committerMinsoo Kim <minnsoo.kim@samsung.com>
Fri, 12 Apr 2013 01:55:15 +0000 (10:55 +0900)
35 files changed:
email-api/email-api-network.c
email-api/include/email-api-network.h
email-common-use/email-convert.c
email-common-use/email-utilities.c
email-common-use/include/email-convert.h
email-common-use/include/email-internal-types.h
email-common-use/include/email-types.h
email-core/email-core-alarm.c
email-core/email-core-event.c
email-core/email-core-imap-mailbox.c
email-core/email-core-mail.c
email-core/email-core-mailbox-sync.c
email-core/email-core-mailbox.c
email-core/email-core-mime.c
email-core/email-core-smtp.c
email-core/email-core-sound.c
email-core/email-core-utils.c
email-core/email-storage/email-storage.c
email-core/include/email-core-event.h
email-core/include/email-core-imap-mailbox.h
email-core/include/email-core-mailbox.h
email-daemon/email-daemon-etc.c
email-daemon/email-daemon-init.c
email-daemon/email-daemon-mailbox.c
email-daemon/include/email-daemon.h
email-daemon/main.c
email-ipc/email-ipc-api/email-ipc-param-list.c
email-ipc/email-ipc-api/include/email-ipc-api-info.h
email-ipc/email-proxy/email-proxy-main.c
email-ipc/email-proxy/email-proxy-socket.c
email-ipc/email-socket/email-ipc-socket.c
res/email-service.sql
utilities/test-application/testapp-mail.c
utilities/test-application/testapp-others.c
utilities/test-application/testapp-utility.c

index 902f3c3..56eacea 100755 (executable)
@@ -859,79 +859,73 @@ FINISH_OFF:
 EXPORT_API int email_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], status[%p]", action, account_id, mail_id, status);
-       
-       int err = EMAIL_ERROR_NONE;
+       int err = EMAIL_ERROR_NOT_SUPPORTED;
+       EM_DEBUG_FUNC_END("err [%d]", err);  
+       return err;
 
-       EM_IF_ACCOUNT_ID_NULL(account_id, EMAIL_ERROR_NULL_VALUE);
-       
-       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_GET_PENDING_JOB);
+}
 
-       EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE);
+EXPORT_API int email_get_network_status(int* on_sending, int* on_receiving)
+{
+       EM_DEBUG_FUNC_BEGIN("on_sending[%p], on_receiving[%p]", on_sending, on_receiving);
+       int err = EMAIL_ERROR_NOT_SUPPORTED;
+       EM_DEBUG_FUNC_END("err [%d]", err);  
+       return err;
+}
 
-       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &action, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("emipc_add_parameter action failed ");
-               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE);
-       }
+EXPORT_API int email_get_task_information(email_task_information_t **output_task_information, int *output_task_information_count)
+{
+       EM_DEBUG_FUNC_BEGIN("output_task_information[%p] output_task_information_count[%p]", output_task_information, output_task_information_count);
+       int err = EMAIL_ERROR_NONE;
+       int task_information_stream_length = 0;
+       HIPC_API hAPI = NULL;
+       char *task_information_stream = NULL;
 
-       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &account_id, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("emipc_add_parameter account_id failed ");
-               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE);
+       if(output_task_information == NULL || output_task_information_count == NULL) {
+               EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM");
+               return EMAIL_ERROR_INVALID_PARAM;
        }
 
-       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &mail_id, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("emipc_add_parameter account_id failed ");
-               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE);
+       if((hAPI = emipc_create_email_api(_EMAIL_API_GET_TASK_INFORMATION)) == NULL) {
+               EM_DEBUG_EXCEPTION("emipc_create_email_api failed");
+               err = EMAIL_ERROR_IPC_CRASH;
+               goto FINISH_OFF;
        }
 
-       /* Execute API */
        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);
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+               err = EMAIL_ERROR_IPC_CRASH;
+               goto FINISH_OFF;
        }
-
        emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
 
-       if(status) {
-               emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), status);
-               EM_DEBUG_LOG("status : %d ", *status);
-       }
-       
-       emipc_destroy_email_api(hAPI);
-       hAPI = NULL;
+       if(EMAIL_ERROR_NONE == err) {
+               task_information_stream_length = emipc_get_parameter_length(hAPI, ePARAMETER_OUT, 1);
+               if(task_information_stream_length > 0) {
+                       task_information_stream = (char*)em_malloc(task_information_stream_length + 1);
 
-       EM_DEBUG_FUNC_END("err [%d]", err);  
-       return err;
-
-}
-
-
-
-EXPORT_API int email_get_network_status(int* on_sending, int* on_receiving)
-{
-       EM_DEBUG_FUNC_BEGIN("on_sending[%p], on_receiving[%p]", on_sending, on_receiving);
-       int err = EMAIL_ERROR_NONE;
-       
-       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_NETWORK_GET_STATUS);
+                       if(!task_information_stream) {
+                               EM_DEBUG_EXCEPTION("em_malloc failed");
+                               err = EMAIL_ERROR_OUT_OF_MEMORY;
+                               goto FINISH_OFF;
+                       }
 
-       EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE);
+                       emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, task_information_stream_length, task_information_stream);
+                       em_convert_byte_stream_to_task_information(task_information_stream, task_information_stream_length, output_task_information, output_task_information_count);
+               }
 
-       /* Execute API */
-       if(emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) {
-               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
-               emipc_destroy_email_api(hAPI);
-               hAPI = NULL;
-               err = EMAIL_ERROR_IPC_SOCKET_FAILURE ;
-               EM_DEBUG_FUNC_END("err [%d]", err); return err;
+               if(!output_task_information) {
+                       EM_DEBUG_EXCEPTION("EMAIL_ERROR_NULL_VALUE");
+                       err = EMAIL_ERROR_NULL_VALUE;
+                       goto FINISH_OFF;
+               }
        }
 
-       if(on_sending)
-               emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), on_sending );
-       if(on_receiving)        
-               emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), on_receiving);
+FINISH_OFF:
+       if(hAPI)
+               emipc_destroy_email_api(hAPI);
 
-       emipc_destroy_email_api(hAPI);
-       hAPI = NULL;
-       EM_DEBUG_FUNC_END("err [%d]", err);  
+       EM_DEBUG_FUNC_END("err [%d]", err);
        return err;
 }
 
@@ -942,7 +936,7 @@ EXPORT_API int email_sync_imap_mailbox_list(int account_id, int *handle)
        int err = EMAIL_ERROR_NONE;
 
        if(account_id <= 0) {
-               EM_DEBUG_LOG("invalid parameters");
+               EM_DEBUG_EXCEPTION("invalid parameters");
                return EMAIL_ERROR_INVALID_PARAM;
        }
 
index 8f94b06..47519e1 100755 (executable)
@@ -232,7 +232,6 @@ EXPORT_API int email_download_body(int mail_id, int with_attachment, int *handle
 
 
 /**
-
  * @fn email_download_attachment(int mail_id, const char* nth, int *handle);
  * @brief      Download a email nth-attachment from server.This function is invoked if user wants to download only specific attachment of a mail whose body is already downloaded.
  *
@@ -248,7 +247,6 @@ EXPORT_API int email_download_attachment(int mail_id, int nth, int *handle);
 
 
 /**
-
  * @fn email_cancel_job(int account_id, int handle);
  * @brief      cancel the ongoing job.This function is invoked if user wants to cancel any ongoing job of a specified account.
  *
@@ -263,41 +261,24 @@ EXPORT_API int email_download_attachment(int mail_id, int nth, int *handle);
 
 EXPORT_API int email_cancel_job(int input_account_id, int input_handle, email_cancelation_type input_cancel_type);
 
+EXPORT_API int email_get_pending_job(email_action_t action, int account_id, int mail_id, email_event_status_type_t * status) DEPRECATED;
 
-/**
-
- * @fn email_get_pending_job(email_action_t action, int account_id, int mail_id, email_event_status_type_t * status);
- * @brief      get pending job list.This function is invoked if user wants to get the pending job list with status information .
- *             Based on action item of a mail is for a specific account this will give all pending job list.
- *
- * @return     This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
- * @param[in] account_id       Specifies the action of the job.
- * @param[in] account_id       Specifies the account ID.
- * @param[in] mail_id          Specifies the mail ID.
- * @param[out]status           Specifies the status of the job.
- * @exception   none
- * @see        email_action_t and email_event_status_type_t
- * @remarks N/A
- */
-EXPORT_API int email_get_pending_job(email_action_t action, int account_id, int mail_id, email_event_status_type_t * status);
-
+EXPORT_API int email_get_network_status(int* on_sending, int* on_receiving) DEPRECATED;
 
 /**
-
- * @fn email_get_network_status(int* on_sending, int* on_receiving)
- * @brief      This function gives the  current network status.This gives the information to the user whether sending operation is in progress or receiving operation.
+ * @fn email_get_task_information(email_task_information_t *output_task_information)
+ * @brief      This function gives the current job information.
  *
  * @return     This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
- * @param[out] on_sending              True if sending is in progress.
- * @param[out] on_receiving            True if receivng is in progress.
+ * @param[out] output_task_information The array of job information.
+ * @param[out] output_task_information_count   The count of job information.
  * @exception  none
  * @see        none
  * @remarks N/A
  */
-EXPORT_API int email_get_network_status(int* on_sending, int* on_receiving);
+EXPORT_API int email_get_task_information(email_task_information_t **output_task_information, int *output_task_information_count);
 
 /**
-
  * @fn email_send_saved(int account_id, int *handle)
  * @brief      Send all mails to been saved in Offline-mode.This function is invoked when user wants to send an email and after saving it.
  *             This will save the email in draft mailbox and then sends.
index fd9ae77..340b678 100755 (executable)
@@ -1154,6 +1154,81 @@ FINISH_OFF:
        EM_DEBUG_FUNC_END();
 }
 
+
+#define EMAIL_JOB_INFORMATION_FMT   "A(S(iiii))"
+
+INTERNAL_FUNC char* em_convert_task_information_to_byte_stream(email_task_information_t *input_task_information, int input_task_information_count, int *stream_len)
+{
+       EM_DEBUG_FUNC_BEGIN("input_task_information[%p] input_task_information_count[%d] stream_len[%p]", input_task_information, input_task_information_count, stream_len);
+       EM_IF_NULL_RETURN_VALUE(input_task_information, NULL);
+       EM_IF_NULL_RETURN_VALUE(stream_len, NULL);
+
+       email_task_information_t cur = {0};
+       tpl_node *tn = NULL;
+       int i = 0;
+
+       tn = tpl_map(EMAIL_JOB_INFORMATION_FMT, &cur);
+
+       for( ; i < input_task_information_count ; i++ ) {
+               memcpy(&cur, input_task_information + i, sizeof(email_task_information_t));
+               tpl_pack(tn, 1);
+       }
+
+       /* write data to buffer */
+       void *buf = NULL;
+       size_t len = 0;
+       tpl_dump(tn, TPL_MEM, &buf, &len);
+       tpl_free(tn);
+
+       *stream_len = len;
+
+       EM_DEBUG_FUNC_END("serialized len: %d", len);
+       return (char*) buf;
+}
+
+INTERNAL_FUNC void em_convert_byte_stream_to_task_information(char *input_stream, int input_stream_len, email_task_information_t **output_task_information, int *output_task_information_count)
+{
+       EM_DEBUG_FUNC_BEGIN("input_stream[%p] input_stream_len[%d] output_task_information[%p] output_task_information_count[%p]", input_stream, input_stream_len, output_task_information, output_task_information_count);
+       EM_NULL_CHECK_FOR_VOID(input_stream);
+       EM_NULL_CHECK_FOR_VOID(output_task_information);
+
+       email_task_information_t cur = {0};
+       tpl_node *tn = NULL;
+       int i = 0;
+       int count = 0;
+       GList *head = NULL;
+
+       tn = tpl_map(EMAIL_JOB_INFORMATION_FMT, &cur);
+       tpl_load(tn, TPL_MEM, input_stream, input_stream_len);
+
+       while( tpl_unpack(tn, 1) > 0) {
+               email_task_information_t* pdata = (email_task_information_t*) em_malloc(sizeof(email_task_information_t));
+               memcpy(pdata, &cur, sizeof(email_task_information_t));
+               head = g_list_prepend(head, pdata);
+               memset(&cur, 0, sizeof(email_task_information_t));
+               count++;
+       }
+       tpl_free(tn);
+
+       email_task_information_t *deserialized = (email_task_information_t*) em_malloc(sizeof(email_task_information_t)*count);
+
+       head = g_list_reverse(head);
+       GList *p = g_list_first(head);
+
+       for( ; p ; p = g_list_next(p), i++ ) {
+               email_task_information_t* pdata = (email_task_information_t*) g_list_nth_data(p, 0);
+               memcpy( deserialized+i, pdata, sizeof(email_task_information_t));
+               EM_SAFE_FREE(pdata);
+       }
+
+       g_list_free(head);
+
+       *output_task_information_count = count;
+       *output_task_information       = deserialized;
+
+       EM_DEBUG_FUNC_END();
+}
+
 INTERNAL_FUNC int em_convert_certificate_tbl_to_certificate(emstorage_certificate_tbl_t *certificate_tbl, email_certificate_t **certificate, int *error)
 {
        EM_DEBUG_FUNC_BEGIN("certficate_tbl[%p], certificate[%p]", certificate_tbl, certificate);
index 1bb6ec2..fe52ddb 100755 (executable)
@@ -198,51 +198,61 @@ INTERNAL_FUNC char* em_skip_whitespace_without_strdup(char *source_string)
        return source_string + i;
 }
 
-/*refactoring required*/
 INTERNAL_FUNC char* em_replace_all_string(char *source_string, char *old_string, char *new_string)
 {
        EM_DEBUG_FUNC_BEGIN();
        char *result_buffer = NULL;
-       char *p = NULL;
-       int i = 0, count = 0;
+       int i = 0, j = 0;
        int old_str_length = 0;
        int new_str_length = 0;
+       int realloc_len = 0;
 
        EM_IF_NULL_RETURN_VALUE(source_string, NULL);
        EM_IF_NULL_RETURN_VALUE(old_string, NULL);
        EM_IF_NULL_RETURN_VALUE(new_string, NULL);
 
+       int src_len = EM_SAFE_STRLEN(source_string);
        old_str_length = EM_SAFE_STRLEN(old_string);
        new_str_length = EM_SAFE_STRLEN(new_string);
 
-       if (old_str_length != new_str_length) {
-               for (i = 0; source_string[i] != '\0';) {
-                       if (memcmp(&source_string[i], old_string, old_str_length) == 0) {
-                               count++;
-                               i += old_str_length;
-                       } else {
-                               i++;
-                       }
-               }
-       } else {
-               i = EM_SAFE_STRLEN(source_string);
+       if (src_len <= 0) {
+               EM_DEBUG_LOG("source_string is invalid");
+               return NULL;
        }
 
-       result_buffer = (char *)malloc(i + 1 + count*(new_str_length-old_str_length));
-       if (result_buffer == NULL)
+       result_buffer = calloc(src_len+1, sizeof(char));
+       if (!result_buffer) {
+               EM_DEBUG_EXCEPTION("calloc failed");
                return NULL;
-
-       p = result_buffer;
-       while (*source_string) {
-               if (memcmp(source_string, old_string, old_str_length) == 0) {
-                       memcpy(p, new_string, new_str_length);
-                       p += new_str_length;
-                       source_string += old_str_length;
+       }
+       realloc_len = src_len + 1;
+
+       for (i = 0; i < src_len && source_string[i] != '\0';) {
+               if (old_str_length <= src_len - i &&
+                               memcmp(&source_string[i], old_string, old_str_length) == 0) {
+
+                       if (old_str_length != new_str_length) {
+                               realloc_len = realloc_len - old_str_length + new_str_length;
+                               result_buffer = realloc(result_buffer, realloc_len);
+                               if (!result_buffer) {
+                                       EM_DEBUG_EXCEPTION("realloc failed");
+                                       return NULL;
+                               }
+                       }
+                       memcpy(&result_buffer[j], new_string, new_str_length);
+                       i += old_str_length;
+                       j += new_str_length;
                } else {
-                       *p++ = *source_string++;
+                       result_buffer[j] = source_string[i];
+                       i++;
+                       j++;
                }
        }
-       *p = '\0';
+
+       if (j < realloc_len)
+               result_buffer[j] = '\0';
+       else
+               result_buffer[realloc_len-1] = '\0';
 
        EM_DEBUG_FUNC_END("result_buffer : %s", result_buffer);
        return result_buffer;
index 39d5553..9dcbcf3 100755 (executable)
@@ -49,7 +49,6 @@ INTERNAL_FUNC void  em_convert_byte_stream_to_attachment_data(char *stream, int
 INTERNAL_FUNC int   em_convert_mailbox_to_mailbox_tbl(email_mailbox_t *mailbox, emstorage_mailbox_tbl_t *mailbox_tbl);
 INTERNAL_FUNC int   em_convert_mailbox_tbl_to_mailbox(emstorage_mailbox_tbl_t *mailbox_tbl, email_mailbox_t *mailbox);
 
-
 INTERNAL_FUNC char* em_convert_mailbox_to_byte_stream(email_mailbox_t* mailbox, int* stream_len);
 INTERNAL_FUNC void  em_convert_byte_stream_to_mailbox(char* stream, int stream_len, email_mailbox_t* mailbox);
 
@@ -73,6 +72,10 @@ INTERNAL_FUNC void  em_convert_byte_stream_to_meeting_req(char* stream, int stre
 INTERNAL_FUNC char* em_convert_search_filter_to_byte_stream(email_search_filter_t *input_search_filter_list, int input_search_filter_count, int *output_stream_size);
 INTERNAL_FUNC void  em_convert_byte_stream_to_search_filter(char *input_stream, email_search_filter_t **output_search_filter_list, int *output_search_filter_count);
 
+/* Job information */
+INTERNAL_FUNC char* em_convert_task_information_to_byte_stream(email_task_information_t *input_task_information, int input_task_information_count, int *stream_len);
+INTERNAL_FUNC void  em_convert_byte_stream_to_task_information(char *input_stream, int input_stream_len, email_task_information_t **output_task_information, int *output_task_information_count);
+
 /* convert certificate */
 INTERNAL_FUNC int em_convert_certificate_tbl_to_certificate(emstorage_certificate_tbl_t *certificate_tbl, email_certificate_t **certificate, int *error);
 
index 9d37cb2..9e207b9 100755 (executable)
@@ -70,10 +70,9 @@ extern "C"
 /*  #define __FEATURE_USE_SHARED_MUTEX_FOR_PROTECTED_FUNC_CALL__ */
 /*  #define __FEATURE_IMAP_IDLE__ */
 #define __FEATURE_DRIVING_MODE__
-/* #define __FEATURE_DELETE_MAILBOX_RECURSIVELY__ */
-/* #define __FEATURE_RENAME_MAILBOX_RECURSIVELY__ */
-
-/*#define __FEATURE_BODY_SEARCH__*/
+#define __FEATURE_DELETE_MAILBOX_RECURSIVELY__
+#define __FEATURE_RENAME_MAILBOX_RECURSIVELY__
+#define __FEATURE_BODY_SEARCH__
 
 /* ----------------------------------------------------------------------------- */
 /*  Macro */
@@ -218,6 +217,8 @@ typedef pthread_t thread_t;
 #define EMAIL_ALARM_CLASS_NEW_MAIL_ALERT      2
 #define EMAIL_ALARM_CLASS_AUTO_POLLING        3
 
+#define EVENT_QUEUE_MAX 32
+
 /* __FEATURE_LOCAL_ACTIVITY__ supported
 #define BULK_OPERATION_COUNT              50
 #define ALL_ACTIVITIES                    0
@@ -284,17 +285,17 @@ enum
 /*  event information */
 typedef struct
 {
-       int                      account_id;         /*  in general, account id */
+       int                        account_id;         /*  in general, account id */
        email_event_type_t         type;
        email_event_status_type_t  status;
-       char                    *event_param_data_1; /*  in general, mailbox name (exception in emcore_send_mail, emcore_send_saved_mail it is email_option_t **/
-       char                    *event_param_data_2;
-       char                    *event_param_data_3;
-       int                      event_param_data_4;
-       int                      event_param_data_5;
-       int                      event_param_data_6; /* in general, notification parameter #1 */
-       int                      event_param_data_7; /* in general, notification parameter #2 */
-       int                      event_param_data_8;
+       char                      *event_param_data_1; /*  in general, mailbox name (exception in emcore_send_mail, emcore_send_saved_mail it is email_option_t **/
+       char                      *event_param_data_2;
+       char                      *event_param_data_3;
+       int                        event_param_data_4;
+       int                        event_param_data_5;
+       int                        event_param_data_6; /* in general, notification parameter #1 */
+       int                        event_param_data_7; /* in general, notification parameter #2 */
+       int                        event_param_data_8;
 } email_event_t;
 
 
index fd2c11a..8659284 100755 (executable)
@@ -197,7 +197,6 @@ enum {
        _EMAIL_API_SYNC_HEADER                               = 0x01300001,
        _EMAIL_API_DOWNLOAD_BODY                             = 0x01300002,
        _EMAIL_API_DOWNLOAD_ATTACHMENT                       = 0x01300003,
-       _EMAIL_API_NETWORK_GET_STATUS                        = 0x01300004,
        _EMAIL_API_SEND_SAVED                                = 0x01300005,
        _EMAIL_API_DELETE_EMAIL                              = 0x01300007,
        _EMAIL_API_DELETE_EMAIL_ALL                          = 0x01300008,
@@ -215,17 +214,16 @@ enum {
        _EMAIL_API_UPDATE_RULE                               = 0x01400005,
        _EMAIL_API_APPLY_RULE                                = 0x01400006,
        _EMAIL_API_CANCEL_JOB                                = 0x01400007,
-       _EMAIL_API_GET_PENDING_JOB                           = 0x01400008,
        _EMAIL_API_SEND_RETRY                                = 0x01400009,
        _EMAIL_API_UPDATE_ACTIVITY                           = 0x0140000A,
        _EMAIL_API_SYNC_LOCAL_ACTIVITY                       = 0x0140000B,
-       _EMAIL_API_PRINT_RECEIVING_EVENT_QUEUE               = 0x0140000C,
 
        /* Etc */
        _EMAIL_API_PING_SERVICE                              = 0x01500000,
        _EMAIL_API_UPDATE_NOTIFICATION_BAR_FOR_UNREAD_MAIL   = 0x01500001,
        _EMAIL_API_SHOW_USER_MESSAGE                         = 0x01500002,
        _EMAIL_API_WRITE_MIME_FILE                           = 0x01500003,
+       _EMAIL_API_GET_TASK_INFORMATION                       = 0x01500004,
 
        /* Smime */
        _EMAIL_API_ADD_CERTIFICATE                           = 0x01600000,
@@ -1069,6 +1067,11 @@ typedef enum {
 } email_mail_attribute_type;
 
 typedef enum {
+       EMAIL_MAIL_TEXT_ATTRIBUTE_FULL_TEXT = 1,
+       EMAIL_MAIL_TEXT_ATTRIBUTE_END
+} email_mail_text_attribute_type;
+
+typedef enum {
        EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_NONE         = 0,
        EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER      = 1,
        EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_STRING       = 2,
@@ -1538,8 +1541,9 @@ typedef enum {
        EMAIL_LIST_FILTER_RULE_LESS_THAN_OR_EQUAL     = 4,
        EMAIL_LIST_FILTER_RULE_GREATER_THAN_OR_EQUAL  = 5,
        EMAIL_LIST_FILTER_RULE_INCLUDE                = 6,
-       EMAIL_LIST_FILTER_RULE_IN                     = 7,
-       EMAIL_LIST_FILTER_RULE_NOT_IN                 = 8
+       EMAIL_LIST_FILTER_RULE_MATCH                  = 7,
+       EMAIL_LIST_FILTER_RULE_IN                     = 8,
+       EMAIL_LIST_FILTER_RULE_NOT_IN                 = 9
 } email_list_filter_rule_type_t;
 
 typedef enum {
@@ -1560,9 +1564,16 @@ typedef struct {
        email_list_filter_case_sensitivity_t   case_sensitivity;
 } email_list_filter_rule_t;
 
+typedef struct {
+       email_list_filter_rule_type_t          rule_type;
+       email_mail_text_attribute_type         target_attribute;
+       email_mail_attribute_value_t           key_value;
+} email_list_filter_rule_fts_t;
+
 typedef enum {
        EMAIL_LIST_FILTER_ITEM_RULE                     = 0,
-       EMAIL_LIST_FILTER_ITEM_OPERATOR                 = 1,
+       EMAIL_LIST_FILTER_ITEM_RULE_FTS                 = 1,
+       EMAIL_LIST_FILTER_ITEM_OPERATOR                 = 2,
 } email_list_filter_item_type_t;
 
 typedef enum {
@@ -1577,6 +1588,7 @@ typedef struct {
 
        union {
                email_list_filter_rule_t           rule;
+               email_list_filter_rule_fts_t       rule_fts;
                email_list_filter_operator_type_t  operator_type;
        } list_filter_item;
 
@@ -1587,6 +1599,7 @@ typedef enum {
        EMAIL_SORT_ORDER_DESCEND                            = 1
 } email_list_filter_sort_order_t;
 
+
 typedef struct {
        email_mail_attribute_type              target_attribute;
        bool                                   force_boolean_check;
@@ -1594,12 +1607,18 @@ typedef struct {
 } email_list_sorting_rule_t;
 
 
+typedef struct {
+       int                                    handle;
+       int                                    account_id;
+       email_event_type_t                     type;
+       email_event_status_type_t              status;
+} email_task_information_t;
 
 /*****************************************************************************/
 /*  For Active Sync                                                          */
 /*****************************************************************************/
 
-#define VCONFKEY_EMAIL_SERVICE_ACTIVE_SYNC_HANDLE "db/email_handle/active_sync_handle"
+#define VCONFKEY_EMAIL_SERVICE_ACTIVE_SYNC_HANDLE   "db/email_handle/active_sync_handle"
 #define EMAIL_ACTIVE_SYNC_NOTI                      "User.Email.ActiveSync"
 
 typedef enum
index d12c866..2600288 100755 (executable)
@@ -37,9 +37,6 @@
 #include <vconf.h>\r
 #include <glib.h>\r
 #include <alarm.h>\r
-#ifdef __FEATURE_USE_APPSYNC__\r
-#include <appsync.h>
-#endif\r
 \r
 #include "email-convert.h"\r
 #include "email-types.h"\r
 #include "email-core-utils.h"\r
 #include "email-core-global.h"\r
 #include "email-core-alarm.h"\r
+
+#ifdef __FEATURE_USE_APPSYNC__\r
+#include <appsync.h>
+#endif\r
 \r
 \r
 #define EMAIL_ALARM_DESTINATION "email-service-0"\r
index 05f26b8..77a3add 100755 (executable)
@@ -108,8 +108,6 @@ INTERNAL_FUNC int g_save_local_activity_run = 0;
 #endif
 
 
-#define EVENT_QUEUE_MAX 32
-
 typedef struct EVENT_CALLBACK_ELEM
 {
        email_event_callback callback;
@@ -173,182 +171,6 @@ static int is_gdk_lock_needed()
        return false;
 }
 
-INTERNAL_FUNC int emcore_get_pending_event(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);
-
-       int found = false;
-       int i;
-
-       ENTER_RECURSIVE_CRITICAL_SECTION(_event_queue_lock);
-
-       for (i = 1; i < EVENT_QUEUE_MAX; i++)  {
-               switch (g_event_que[i].type)  {
-                       case EMAIL_EVENT_SEND_MAIL:
-                       case EMAIL_EVENT_SEND_MAIL_SAVED:
-                               if (action == EMAIL_ACTION_SEND_MAIL && account_id == g_event_que[i].account_id && mail_id == g_event_que[i].event_param_data_4) {
-                                       found = true;
-                                       goto EXIT;
-                               }
-                               break;
-
-                       case EMAIL_EVENT_SYNC_HEADER:
-                               if (action == EMAIL_ACTION_SYNC_HEADER && account_id == g_event_que[i].account_id) {
-                                       found = true;
-                                       goto EXIT;
-                               }
-                               break;
-
-                       case EMAIL_EVENT_SYNC_HEADER_OMA:
-                               if (action == EMAIL_ACTION_SYNC_HEADER_OMA && account_id == g_event_que[i].account_id) {
-                                       found = true;
-                                       goto EXIT;
-                               }
-                               break;
-
-                       case EMAIL_EVENT_DOWNLOAD_BODY:
-                               if (action == EMAIL_ACTION_DOWNLOAD_BODY && account_id == g_event_que[i].account_id && mail_id == g_event_que[i].event_param_data_4) {
-                                       found = true;
-                                       goto EXIT;
-                               }
-                               break;
-                       case EMAIL_EVENT_SYNC_MAIL_FLAG_TO_SERVER:
-                               if (action == EMAIL_ACTION_SYNC_MAIL_FLAG_TO_SERVER && account_id == g_event_que[i].account_id && mail_id == g_event_que[i].event_param_data_4) {
-                                       found = true;
-                                       goto EXIT;
-                               }
-                               break;
-                       case EMAIL_EVENT_SYNC_FLAGS_FIELD_TO_SERVER:
-                               if (action == EMAIL_ACTION_SYNC_FLAGS_FIELD_TO_SERVER && account_id == g_event_que[i].account_id && mail_id == g_event_que[i].event_param_data_4) {
-                                       found = true;
-                                       goto EXIT;
-                               }
-                               break;
-                       case EMAIL_EVENT_DOWNLOAD_ATTACHMENT:
-                               if (action == EMAIL_ACTION_DOWNLOAD_ATTACHMENT && account_id == g_event_que[i].account_id && mail_id == g_event_que[i].event_param_data_4) {
-                                       found = true;
-                                       goto EXIT;
-                               }
-                               break;
-                       case EMAIL_EVENT_DELETE_MAIL:
-                       case EMAIL_EVENT_DELETE_MAIL_ALL:
-                               if (action == EMAIL_ACTION_DELETE_MAIL && account_id == g_event_que[i].account_id) {
-                                       found = true;
-                                       goto EXIT;
-                               }
-                               break;
-
-                       case EMAIL_EVENT_CREATE_MAILBOX:
-                               if (action == EMAIL_ACTION_CREATE_MAILBOX && account_id == g_event_que[i].account_id) {
-                                       found = true;
-                                       goto EXIT;
-                               }
-                               break;
-
-                       case EMAIL_EVENT_DELETE_MAILBOX:
-                               if (action == EMAIL_ACTION_DELETE_MAILBOX && account_id == g_event_que[i].account_id) {
-                                       found = true;
-                                       goto EXIT;
-                               }
-                               break;
-
-                       case EMAIL_EVENT_MOVE_MAIL:
-                               if (action == EMAIL_ACTION_MOVE_MAIL && account_id == g_event_que[i].account_id && mail_id == g_event_que[i].event_param_data_4) {
-                                       found = true;
-                                       goto EXIT;
-                               }
-                               break;
-
-                       case EMAIL_EVENT_VALIDATE_ACCOUNT:
-                               if (action == EMAIL_ACTION_VALIDATE_ACCOUNT && account_id == g_event_que[i].account_id) {
-                                       found = true;
-                                       goto EXIT;
-                               }
-                               break;
-
-                       case EMAIL_EVENT_VALIDATE_AND_UPDATE_ACCOUNT:
-                               if (action == EMAIL_ACTION_VALIDATE_AND_UPDATE_ACCOUNT && account_id == 0) {
-                                       found = true;
-                                       goto EXIT;
-                               }
-                               break;
-
-                       case EMAIL_EVENT_VALIDATE_AND_CREATE_ACCOUNT:
-                               if (action == EMAIL_ACTION_VALIDATE_AND_CREATE_ACCOUNT && account_id == 0) {
-                                       found = true;
-                                       goto EXIT;
-                               }
-                               break;
-
-                       case EMAIL_EVENT_VALIDATE_ACCOUNT_EX:
-                               if (action == EMAIL_ACTION_VALIDATE_ACCOUNT_EX && account_id == 0) {
-                                       found = true;
-                                       goto EXIT;
-                               }
-                               break;
-
-                       case EMAIL_EVENT_UPDATE_MAIL:
-                               if (action == EMAIL_ACTION_UPDATE_MAIL)  {
-                                       found = true;
-                                       goto EXIT;
-                               }
-                               break;
-
-                       case EMAIL_EVENT_SET_MAIL_SLOT_SIZE:
-                               if (action == EMAIL_ACTION_SET_MAIL_SLOT_SIZE)  {
-                                       found = true;
-                                       goto EXIT;
-                               }
-                               break;
-
-                       case EMAIL_EVENT_EXPUNGE_MAILS_DELETED_FLAGGED:
-                               if (action == EMAIL_ACTION_EXPUNGE_MAILS_DELETED_FLAGGED)  {
-                                       found = true;
-                                       goto EXIT;
-                               }
-                               break;
-
-                       case EMAIL_EVENT_SEARCH_ON_SERVER:
-                               if (action == EMAIL_ACTION_SEARCH_ON_SERVER && account_id == g_event_que[i].account_id) {
-                                       found = true;
-                                       goto EXIT;
-                               }
-                               break;
-
-                       case EMAIL_EVENT_RENAME_MAILBOX_ON_IMAP_SERVER:
-                               if (action == EMAIL_ACTION_MOVE_MAILBOX && account_id == g_event_que[i].account_id) {
-                                       found = true;
-                                       goto EXIT;
-                               }
-                               break;
-
-                       default:
-                               break;
-               }
-       }
-
-EXIT:
-       LEAVE_RECURSIVE_CRITICAL_SECTION(_event_queue_lock);
-
-       if (found) {
-               if (status)
-                       *status = g_event_que[i].status;
-
-               return i;
-       }
-
-       return FAILURE;
-}
-
-INTERNAL_FUNC void emcore_get_event_queue_status(int *on_sending, int *on_receiving)
-{
-       if (on_sending != NULL)
-               *on_sending = g_sending_busy_cnt;
-
-       if (on_receiving != NULL)
-               *on_receiving = g_receiving_busy_cnt;
-}
-
 static void _sending_busy_ref(void)
 {
        g_sending_busy_cnt++;
@@ -2225,21 +2047,12 @@ static int event_handler_EMAIL_EVENT_RENAME_MAILBOX_ON_IMAP_SERVER(int input_acc
        EM_DEBUG_FUNC_BEGIN("input_account_id [%d], input_mailbox_id [%d], input_old_mailbox_path %s], input_new_mailbox_path [%s], input_new_mailbox_alias [%s], handle_to_be_published [%d]", input_account_id, input_mailbox_id, input_old_mailbox_path, input_new_mailbox_path, input_new_mailbox_alias, handle_to_be_published);
        int err = EMAIL_ERROR_NONE;
 
-       if ((err = emcore_move_mailbox_on_imap_server(input_account_id, input_old_mailbox_path, input_new_mailbox_path)) != EMAIL_ERROR_NONE) {
-               EM_DEBUG_EXCEPTION("emcore_move_mailbox_on_imap_server failed [%d]", err);
-       }
 
        if (err == EMAIL_ERROR_NONE) {
-               if(!emcore_notify_network_event(NOTI_RENAME_MAILBOX_FINISH, input_mailbox_id, input_new_mailbox_path, handle_to_be_published, 0))
-                       EM_DEBUG_EXCEPTION("emcore_notify_network_event[NOTI_RENAME_MAILBOX_FINISH] failed");
-
-               if ((err = emstorage_rename_mailbox(input_mailbox_id, input_new_mailbox_path, input_new_mailbox_alias, true)) != EMAIL_ERROR_NONE) {
-                       EM_DEBUG_EXCEPTION("emstorage_rename_mailbox failed [%d]", err);
+               if ((err = emcore_rename_mailbox(input_mailbox_id, input_new_mailbox_path, input_new_mailbox_alias, true, true, handle_to_be_published)) != EMAIL_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("emcore_rename_mailbox failed [%d]", err);
                }
        }
-       else if (!emcore_notify_network_event(NOTI_RENAME_MAILBOX_FAIL, input_mailbox_id, input_new_mailbox_path, handle_to_be_published, 0)) {
-               EM_DEBUG_EXCEPTION("emcore_notify_network_event[NOTI_RENAME_MAILBOX_FAIL] failed");
-       }
 
        EM_DEBUG_FUNC_END("err [%d]", err);
        return err;
@@ -2945,22 +2758,54 @@ FINISH_OFF:
        return ret;
 }
 
-
-INTERNAL_FUNC int emcore_get_receiving_event_queue(email_event_t **event_queue, int *event_active_queue, int *err)
+INTERNAL_FUNC int emcore_get_task_information(email_task_information_t **output_task_information, int *output_task_information_count)
 {
-       if (event_queue == NULL || event_active_queue == NULL) {
-               EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM event_queue[%p] event_active_queue[%p]", event_queue, event_active_queue);
+       EM_DEBUG_FUNC_BEGIN("output_task_information[%p] output_task_information_count[%p]", output_task_information, output_task_information_count);
+       int err = EMAIL_ERROR_NONE;
+       int i = 0;
+       int count = 0;
+       int index = 0;
+       email_task_information_t *task_information = NULL;
+
+       if (output_task_information == NULL || output_task_information_count == NULL) {
+               EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM");
+               err = EMAIL_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
 
-               if (err)
-                       *err = EMAIL_ERROR_INVALID_PARAM;
+       for(i = 0; i < EVENT_QUEUE_MAX; i++) {
+               if(g_event_que[i].type != EMAIL_EVENT_NONE && g_event_que[i].status != EMAIL_EVENT_STATUS_CANCELED)
+                       count++;
+       }
 
-               return false;
+       if(count != 0) {
+               if((task_information = em_malloc(sizeof(email_task_information_t) * count)) == NULL) {
+                       EM_DEBUG_EXCEPTION("EMAIL_ERROR_OUT_OF_MEMORY");
+                       err = EMAIL_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+
+               for(i = 0; i < EVENT_QUEUE_MAX; i++) {
+                       if(g_event_que[i].type != EMAIL_EVENT_NONE && g_event_que[i].status != EMAIL_EVENT_STATUS_CANCELED) {
+                               task_information[index].handle     = i;
+                               task_information[index].account_id = g_event_que[i].account_id;
+                               task_information[index].type       = g_event_que[i].type;
+                               task_information[index].status     = g_event_que[i].status;
+                               index++;
+                       }
+               }
+       }
+       else {
+               err = EMAIL_ERROR_DATA_NOT_FOUND;
        }
 
-       *event_queue = g_event_que;
-       *event_active_queue = g_active_que;
+       *output_task_information_count = count;
+       *output_task_information       = task_information;
 
-       return true;
+FINISH_OFF:
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
 }
 
 INTERNAL_FUNC int emcore_free_event(email_event_t *event_data)
index dd41b9e..b012933 100755 (executable)
@@ -837,7 +837,7 @@ INTERNAL_FUNC int emcore_set_sync_imap_mailbox(email_internal_mailbox_t *mailbox
                                        
                                        /* if non synchronous, delete imap mailbox from db */
                                        if (!emstorage_update_mailbox(mailbox->account_id, 0, downloaded_uids[temp].mailbox_id, &mailbox_tbl, true, &err)) {
-                                               EM_DEBUG_EXCEPTION(" emstorage_update_mailbox Failed [ %d ] ", err);
+                                               EM_DEBUG_EXCEPTION(" emstorage_update_mailbox Failed [%d] ", err);
                                                goto JOB_ERROR;
                                        }
                                        
@@ -1066,9 +1066,9 @@ FINISH_OFF:
 }
 
 
-INTERNAL_FUNC int emcore_move_mailbox_on_imap_server(int input_account_id, char *input_old_mailbox_path, char *input_new_mailbox_path)
+INTERNAL_FUNC int emcore_rename_mailbox_on_imap_server(int input_account_id, int input_mailbox_id, char *input_old_mailbox_path, char *input_new_mailbox_path, int handle_to_be_published)
 {
-       EM_DEBUG_FUNC_BEGIN("input_account_id [%d], input_old_mailbox_path [%p], input_new_mailbox_path [%p]", input_account_id, input_old_mailbox_path, input_new_mailbox_path);
+       EM_DEBUG_FUNC_BEGIN("input_account_id [%d], input_mailbox_id [%d], input_old_mailbox_path [%p], input_new_mailbox_path [%p] handle_to_be_published[%d]", input_account_id, input_mailbox_id, input_old_mailbox_path, input_new_mailbox_path, handle_to_be_published);
        MAILSTREAM *stream = NULL;
        char *long_enc_path_old = NULL;
        char *long_enc_path_new = NULL;
@@ -1118,6 +1118,15 @@ INTERNAL_FUNC int emcore_move_mailbox_on_imap_server(int input_account_id, char
        }
 
 FINISH_OFF:
+
+       if (err  == EMAIL_ERROR_NONE) {
+               if(!emcore_notify_network_event(NOTI_RENAME_MAILBOX_FINISH, input_mailbox_id, input_new_mailbox_path, handle_to_be_published, 0))
+                       EM_DEBUG_EXCEPTION("emcore_notify_network_event[NOTI_RENAME_MAILBOX_FINISH] failed");
+       }
+       else {
+               if (!emcore_notify_network_event(NOTI_RENAME_MAILBOX_FAIL, input_mailbox_id, input_new_mailbox_path, handle_to_be_published, 0))
+                       EM_DEBUG_EXCEPTION("emcore_notify_network_event[NOTI_RENAME_MAILBOX_FAIL] failed");
+       }
        EM_SAFE_FREE(long_enc_path_old);
        EM_SAFE_FREE(long_enc_path_new);
 
index 269183d..2697943 100755 (executable)
@@ -2962,12 +2962,12 @@ INTERNAL_FUNC int emcore_download_body_multi_sections_bulk(void *mail_stream, in
        char *stripped_text = NULL;
        if (!emcore_strip_mail_body_from_file(mail, &stripped_text, &err) || stripped_text == NULL) {
                EM_DEBUG_EXCEPTION("emcore_strip_mail_body_from_file failed [%d]", err);
-               goto FINISH_OFF;
        }
 
        emstorage_mail_text_tbl_t *mail_text;
        if (!emstorage_get_mail_text_by_id(mail_id, &mail_text, true, &err) || !mail_text) {
                EM_DEBUG_EXCEPTION("emstorage_get_mail_text_by_id failed [%d]", err);
+               emstorage_rollback_transaction(NULL, NULL, NULL); /*  ROLLBACK TRANSACTION; */
                goto FINISH_OFF;
        }
 
@@ -4372,11 +4372,11 @@ INTERNAL_FUNC int emcore_mail_copy(int mail_id, email_mailbox_t *dst_mailbox, in
        emstorage_mailbox_tbl_t *output_mailbox;
        if (!emcore_strip_mail_body_from_file(mail, &stripped_text, &err) || stripped_text == NULL) {
                EM_DEBUG_EXCEPTION("emcore_strip_mail_body_from_file failed [%d]", err);
-               goto FINISH_OFF;
        }
 
        if (emstorage_get_mailbox_by_id(dst_mailbox->mailbox_id, &output_mailbox) != EMAIL_ERROR_NONE) {
-               EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_id failed");                       
+               EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_id failed");
+               emstorage_rollback_transaction(NULL, NULL, NULL);
                goto FINISH_OFF;
        }
 
@@ -5002,7 +5002,6 @@ INTERNAL_FUNC int emcore_update_mail(email_mail_data_t *input_mail_data, email_a
        char *stripped_text = NULL;
        if (!emcore_strip_mail_body_from_file(converted_mail_tbl_data, &stripped_text, &err) || stripped_text == NULL) {
                EM_DEBUG_EXCEPTION("emcore_strip_mail_body_from_file failed [%d]", err);
-               goto FINISH_OFF;
        }
 
        emstorage_mail_text_tbl_t *mail_text;
@@ -5564,6 +5563,7 @@ INTERNAL_FUNC void emcore_free_mail_data(email_mail_data_t *mail_data)
        EM_SAFE_FREE(mail_data->alias_recipient);
        EM_SAFE_FREE(mail_data->file_path_plain);
        EM_SAFE_FREE(mail_data->file_path_html);
+       EM_SAFE_FREE(mail_data->file_path_mime_entity);
        EM_SAFE_FREE(mail_data->preview_text);
        EM_SAFE_FREE(mail_data->eas_data);
 
index f868e09..83796cd 100755 (executable)
@@ -947,7 +947,7 @@ static int emcore_get_uids_to_download(MAILSTREAM *stream, email_account_t *acco
        for (i = 0; i < j; i++) {
                /*  EM_DEBUG_LOG("input_mailbox_tbl[%s] reserved[%d]", input_mailbox_tbl->name, downloaded_uids[i].reserved); */
                if (downloaded_uids[i].reserved == 0) {         /*  deleted on server */
-                       if (!emstorage_get_maildata_by_servermailid(input_mailbox_tbl->account_id, downloaded_uids[i].s_uid, &mail, true, &err)){
+                       if (!emstorage_get_maildata_by_servermailid(input_mailbox_tbl->mailbox_id, downloaded_uids[i].s_uid, &mail, true, &err)){
                                EM_DEBUG_EXCEPTION("emstorage_get_maildata_by_servermailid for uid[%s] Failed [%d] \n ", downloaded_uids[i].s_uid, err);
                                if (err == EMAIL_ERROR_MAIL_NOT_FOUND){
                                        continue;
@@ -1210,6 +1210,7 @@ int emcore_check_rule(const char *input_full_address_from, const char *input_sub
        size_t len = 0;
        char *src = NULL;       /*  string which will be compared with rules */
        char *from_address = NULL;
+       char *p_input_full_address_from = NULL;
        ADDRESS *addr = NULL;
 
        if (!matched || !input_full_address_from || !input_subject) {
@@ -1220,10 +1221,12 @@ int emcore_check_rule(const char *input_full_address_from, const char *input_sub
 
        *matched = -1;
 
-       rfc822_parse_adrlist(&addr, (char*)input_full_address_from, NULL);
+       p_input_full_address_from = strdup((char *)input_full_address_from);
+
+       rfc822_parse_adrlist(&addr, p_input_full_address_from, NULL);
 
        if(addr) {
-               EM_DEBUG_LOG("rule : full_address_from[%s], addr->mailbox[%s], addr->host[%s]", input_full_address_from, addr->mailbox, addr->host);
+               EM_DEBUG_LOG("rule : full_address_from[%s], addr->mailbox[%s], addr->host[%s]", p_input_full_address_from, addr->mailbox, addr->host);
 
                if (addr->mailbox)
                        len = EM_SAFE_STRLEN(addr->mailbox);
@@ -1295,6 +1298,7 @@ int emcore_check_rule(const char *input_full_address_from, const char *input_sub
 FINISH_OFF:
 
        EM_SAFE_FREE(from_address);
+       EM_SAFE_FREE(p_input_full_address_from);
 
        if (addr  != NULL)
                mail_free_address(&addr);
@@ -2828,7 +2832,7 @@ static int emcore_parse_bodystructure(void *stream, IMAPPARSEDREPLY *reply_from_
        imap_parse_body_structure(stream, p_body, (unsigned char **)&bodystructure_string, reply_from_server);
 
        /* Get the total mail size */
-       if (emcore_set_fetch_body_section(p_body, true, &p_total_mail_size, &err) < 0) {
+       if (emcore_set_fetch_body_section(p_body, false, &p_total_mail_size, &err) < 0) {
                EM_DEBUG_EXCEPTION("emcore_set_fetch_body_section failed:[%d]", err);
                goto FINISH_OFF;
        }
@@ -2872,7 +2876,7 @@ FINISH_OFF:
        return err;
 }
 
-static int emcore_update_attachment_except_inline(struct _m_content_info *cnt_info, int account_id, int mail_id, int mailbox_id, int *output_total_attachment_size, int *output_attachment_count)
+static int emcore_update_attachment_except_inline(struct _m_content_info *cnt_info, int account_id, int mail_id, int mailbox_id, int *output_total_attachment_size, int *output_attachment_count, int *output_inline_attachment_count)
 {
        EM_DEBUG_FUNC_BEGIN("cnt_info : [%p], account_id : [%d], mail_id : [%d], mailbox_id : [%d]", cnt_info, account_id, mail_id, mailbox_id);
        int err = EMAIL_ERROR_NONE;
@@ -2900,7 +2904,7 @@ static int emcore_update_attachment_except_inline(struct _m_content_info *cnt_in
        attachment_tbl.mailbox_id = mailbox_id;
        attachment_tbl.attachment_save_status = 0;
 
-       for (attachment_count = 1, attach_info = cnt_info->file; attach_info; attach_info = attach_info->next, attachment_count++) {
+       for (attachment_count = 0, attach_info = cnt_info->file; attach_info; attach_info = attach_info->next, attachment_count++) {
                if (attach_info->type == INLINE_ATTACHMENT) {
                        EM_DEBUG_LOG("INLINE ATTACHMENT");
                        inline_attachment_count++;
@@ -2918,19 +2922,23 @@ static int emcore_update_attachment_except_inline(struct _m_content_info *cnt_in
                attachment_tbl.section                          = attach_info->section;
 #endif
 
-               EM_DEBUG_LOG("attachment_count [%d]", attachment_count);
-
                if (!emstorage_add_attachment(&attachment_tbl, 0, false, &err)) {
                        EM_DEBUG_EXCEPTION("emstorage_add_attachment failed : [%d]", err);
                        goto FINISH_OFF;
                }
        }
 
+       EM_DEBUG_LOG("attachment_count : [%d], inline_attachment_count : [%d]", attachment_count, inline_attachment_count);
+
+
 FINISH_OFF:
 
        if (output_attachment_count)
                *output_attachment_count = attachment_count - inline_attachment_count;
 
+       if (output_inline_attachment_count)
+               *output_inline_attachment_count = inline_attachment_count;
+
        if (output_total_attachment_size)
                *output_total_attachment_size = total_attach_size;
 
@@ -3684,7 +3692,7 @@ static int emcore_download_bulk_partial_mail_body_for_imap(MAILSTREAM *stream, i
        int j = 0, i = 0;
        int i32_index = 0;
        int total_mail_size = 0, total_attachment_size = 0;
-       int temp_count = 0, attachment_num = 0;
+       int temp_count = 0, attachment_num = 0, inline_attachment_num = 0;
        char buf[512] = {0, };
        char *text_plain    = NULL;
        char *text_html     = NULL;
@@ -3775,7 +3783,7 @@ static int emcore_download_bulk_partial_mail_body_for_imap(MAILSTREAM *stream, i
 
                /* Check the body download status and body size */
                SNPRINTF(uid_string, sizeof(uid_string), "%ld", imap_response[i].uid_no);
-               if (!emstorage_get_maildata_by_servermailid(pbd_event[temp_count].account_id, uid_string, &mail, true, &err) || !mail) {
+               if (!emstorage_get_maildata_by_servermailid(pbd_event[temp_count].mailbox_id, uid_string, &mail, true, &err) || !mail) {
                        EM_DEBUG_EXCEPTION("emstorage_get_mail_data_by_servermailid failed : [%d]", err);
                        if (err == EMAIL_ERROR_MAIL_NOT_FOUND || !mail)
                                goto FINISH_OFF;
@@ -3787,14 +3795,15 @@ static int emcore_download_bulk_partial_mail_body_for_imap(MAILSTREAM *stream, i
                }
 
                /* Update the attachment info except inline attachment */
-               if ((err = emcore_update_attachment_except_inline(cnt_info, pbd_event[temp_count].account_id, mail->mail_id, pbd_event[temp_count].mailbox_id, &total_attachment_size, &attachment_num)) != EMAIL_ERROR_NONE) {
+               if ((err = emcore_update_attachment_except_inline(cnt_info, pbd_event[temp_count].account_id, mail->mail_id, pbd_event[temp_count].mailbox_id, &total_attachment_size, &attachment_num, &inline_attachment_num)) != EMAIL_ERROR_NONE) {
                        EM_DEBUG_EXCEPTION("emcore_update_attachment_except_inline failed : [%d]", err);
                        goto FINISH_OFF;
                }
 
                EM_DEBUG_LOG("total_mail_size:[%d], total_attachment_size:[%d], attachment_num:[%d]", total_mail_size, total_attachment_size, attachment_num);
-               mail->mail_size               = total_mail_size;
-               mail->attachment_count = attachment_num;
+               mail->mail_size            = total_mail_size;
+               mail->attachment_count     = attachment_num + inline_attachment_num;
+               mail->inline_content_count = inline_attachment_num;
 
                if (imap_response[i].body_len == 0) {
                        EM_DEBUG_LOG("BODY size is zero");
@@ -3858,8 +3867,6 @@ static int emcore_download_bulk_partial_mail_body_for_imap(MAILSTREAM *stream, i
                                        attachment_tbl.attachment_save_status           = 1;
                                        attachment_tbl.attachment_inline_content_status = 1; /*  set to 1 for inline image */
                                        attachment_tbl.attachment_mime_type             = image_data[store_file].mime_type;
-                                       mail->attachment_count++;
-                                       mail->inline_content_count++;
                                        if (!emstorage_add_attachment (&attachment_tbl, false, false, &err))
                                                EM_DEBUG_EXCEPTION("emstorage_add_attachment failed - %d", err);
                                }
@@ -3939,7 +3946,6 @@ static int emcore_download_bulk_partial_mail_body_for_imap(MAILSTREAM *stream, i
                char *stripped_text = NULL;
                if (!emcore_strip_mail_body_from_file(mail, &stripped_text, &err) || stripped_text == NULL) {
                        EM_DEBUG_EXCEPTION("emcore_strip_mail_body_from_file failed [%d]", err);
-                       goto FINISH_OFF;
                }
 
                emstorage_mail_text_tbl_t *mail_text;
index f83c040..ffa078d 100755 (executable)
@@ -528,61 +528,98 @@ FINISH_OFF:
        return ret;
 }
 
-INTERNAL_FUNC int emcore_update_mailbox(email_mailbox_t *old_mailbox, email_mailbox_t *new_mailbox, int *err_code)
+INTERNAL_FUNC int emcore_rename_mailbox(int input_mailbox_id, char *input_new_mailbox_name, char *input_new_mailbox_alias, int input_on_server, int input_recursive, int handle_to_be_published)
 {
-       EM_DEBUG_FUNC_BEGIN("old_mailbox[%p], new_mailbox[%p], err_code[%p]", old_mailbox, new_mailbox, err_code);
-       
-       int ret = false;
+       EM_DEBUG_FUNC_BEGIN("input_mailbox_id[%d] input_new_mailbox_name[%p] input_new_mailbox_alias[%p] input_on_server[%d] input_recursive[%d] handle_to_be_published[%d]", input_mailbox_id, input_new_mailbox_name, input_new_mailbox_alias, input_on_server, input_recursive, handle_to_be_published);
+
        int err = EMAIL_ERROR_NONE;
-       
-       if (old_mailbox == NULL || new_mailbox == NULL)  {
-               EM_DEBUG_EXCEPTION("old_mailbox[%p], new_mailbox[%p]", old_mailbox, new_mailbox);
-               
+       int i = 0;
+       int mailbox_count = 0;
+       emstorage_mailbox_tbl_t *target_mailbox = NULL;
+       emstorage_mailbox_tbl_t *target_mailbox_array = NULL;
+       char *renamed_mailbox_name = NULL;
+       char *old_mailbox_name = NULL;
+
+       if (input_mailbox_id == 0 || input_new_mailbox_name == NULL || input_new_mailbox_alias == NULL)  {
+               EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM");
                err = EMAIL_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
-       
-       emstorage_mailbox_tbl_t new_mailbox_tbl;
-       memset(&new_mailbox_tbl, 0x00, sizeof(emstorage_mailbox_tbl_t));
-       
-       /*  Support only updating mailbox_type */
-       new_mailbox_tbl.mailbox_type = new_mailbox->mailbox_type;
 
-       if (old_mailbox->mailbox_type != new_mailbox_tbl.mailbox_type) {
-               if (!emstorage_update_mailbox_type(old_mailbox->account_id, -1, old_mailbox->mailbox_name, new_mailbox_tbl.mailbox_type, true, &err))  {
-                       EM_DEBUG_EXCEPTION("emstorage_update_mailbox failed - %d", err);
+       if ((err = emstorage_get_mailbox_by_id(input_mailbox_id, &target_mailbox)) != EMAIL_ERROR_NONE || !target_mailbox) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_id failed. [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       EM_DEBUG_LOG("target_mailbox->mailbox_name [%s]", target_mailbox->mailbox_name);
+       old_mailbox_name = EM_SAFE_STRDUP(target_mailbox->mailbox_name);
+
+       if (input_on_server) {
+               EM_DEBUG_LOG("Rename the mailbox in Sever >>> ");
+
+               if ((err = emcore_rename_mailbox_on_imap_server(target_mailbox->account_id, target_mailbox->mailbox_id, target_mailbox->mailbox_name, input_new_mailbox_name, handle_to_be_published)) != EMAIL_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("emcore_rename_mailbox_on_imap_server failed [%d]", err);
                        goto FINISH_OFF;
                }
+               else
+                       EM_DEBUG_LOG("Rename the mailbox on server : success");
        }
 
-       new_mailbox_tbl.mailbox_id                      = old_mailbox->mailbox_id;
-       new_mailbox_tbl.account_id                      = old_mailbox->account_id;
-       new_mailbox_tbl.mailbox_name            = new_mailbox->mailbox_name;
-       new_mailbox_tbl.mailbox_type            = new_mailbox->mailbox_type;
-       new_mailbox_tbl.alias                           = new_mailbox->alias;
-       new_mailbox_tbl.mail_slot_size          = new_mailbox->mail_slot_size;
-       new_mailbox_tbl.total_mail_count_on_server = new_mailbox->total_mail_count_on_server;
-       
-       if (!emstorage_update_mailbox(old_mailbox->account_id, -1, old_mailbox->mailbox_id, &new_mailbox_tbl, true, &err))  {
-               EM_DEBUG_EXCEPTION("emstorage_update_mailbox failed - %d", err);
+#ifdef __FEATURE_RENAME_MAILBOX_RECURSIVELY__
+       if(input_recursive) {
+               /* Getting children mailbox list */
+               if(!emstorage_get_child_mailbox_list(target_mailbox->account_id, target_mailbox->mailbox_name, &mailbox_count, &target_mailbox_array, false,&err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_get_child_mailbox_list failed. [%d]", err);
+                       goto FINISH_OFF;
+               }
 
-               goto FINISH_OFF;
+               if (target_mailbox)
+                       emstorage_free_mailbox(&target_mailbox, 1, NULL);
+               target_mailbox = NULL;
        }
-       
-       if (EM_SAFE_STRCMP(old_mailbox->mailbox_name, new_mailbox_tbl.mailbox_name) != 0) {
-               if ( (err = emstorage_rename_mailbox(old_mailbox->mailbox_id, new_mailbox_tbl.mailbox_name, new_mailbox_tbl.alias, true)) != EMAIL_ERROR_NONE) {
-                       EM_DEBUG_EXCEPTION("emstorage_rename_mailbox failed [%d]", err);
-                       goto FINISH_OFF;
+       else
+#endif /* __FEATURE_RENAME_MAILBOX_RECURSIVELY__ */
+       {
+               target_mailbox_array = target_mailbox;
+               mailbox_count        = 1;
+               target_mailbox       = NULL;
+       }
+
+       /* Remove mailboxes */
+       for(i = 0; i < mailbox_count ; i++) {
+               EM_DEBUG_LOG("Rename mailbox_id [%d] mailbox_name [%s]", target_mailbox_array[i].mailbox_id, target_mailbox_array[i].mailbox_name);
+
+               if(input_mailbox_id == target_mailbox_array[i].mailbox_id) {
+                       if ((err = emstorage_rename_mailbox(target_mailbox_array[i].mailbox_id, input_new_mailbox_name, input_new_mailbox_alias, true)) != EMAIL_ERROR_NONE) {
+                               EM_DEBUG_EXCEPTION("emstorage_rename_mailbox failed [%d]", err);
+                               goto FINISH_OFF;
+                       }
+               }
+               else {
+                       EM_DEBUG_LOG("target_mailbox_array[i].mailbox_name[%s] old_mailbox_name[%s] input_new_mailbox_name [%s]", target_mailbox_array[i].mailbox_name, old_mailbox_name, input_new_mailbox_name);
+                       renamed_mailbox_name = em_replace_string(target_mailbox_array[i].mailbox_name, old_mailbox_name, input_new_mailbox_name);
+                       EM_DEBUG_LOG("renamed_mailbox_name[%s]", renamed_mailbox_name);
+
+                       if ((err = emstorage_rename_mailbox(target_mailbox_array[i].mailbox_id, renamed_mailbox_name, target_mailbox_array[i].alias, true)) != EMAIL_ERROR_NONE) {
+                               EM_DEBUG_EXCEPTION("emstorage_rename_mailbox failed [%d]", err);
+                               goto FINISH_OFF;
+                       }
+
+                       EM_SAFE_FREE(renamed_mailbox_name);
                }
        }
-       
-       ret = true;
-       
-FINISH_OFF: 
-       if (err_code)
-               *err_code = err;
-       
-       return ret;
+
+FINISH_OFF:
+       EM_SAFE_FREE(renamed_mailbox_name);
+       EM_SAFE_FREE(old_mailbox_name);
+
+       if (target_mailbox)
+               emstorage_free_mailbox(&target_mailbox, 1, NULL);
+
+       if (target_mailbox_array)
+               emstorage_free_mailbox(&target_mailbox_array, mailbox_count, NULL);
+
+       return err;
 }
 
 extern int try_auth;
index a620df7..2768c40 100755 (executable)
@@ -238,8 +238,8 @@ extern int multi_part_body_size;
 extern bool only_body_download;
 
 /* ---------------------------------------------------------------------- */
-static BODY **g_inline_list;
-static int g_inline_count;
+static BODY **g_inline_list = NULL;
+static int g_inline_count = 0;
 
 /*  Function Declaration */
 
@@ -2484,6 +2484,7 @@ static int emcore_write_response_into_file(char *filename, char *write_mode, cha
 
                        while (strstr(decoded, "cid:")) {
                                EM_DEBUG_LOG("Found cid:");
+                               EM_DEBUG_LOG("g_inline_count : [%d]", g_inline_count);
                                not_found = true;
                                if (g_inline_count) {
                                        BODY *body_inline = NULL;
@@ -4156,6 +4157,7 @@ static int emcore_get_body_part_imap(MAILSTREAM *stream, int account_id, int mai
 
        if (!is_attachment)  {  /*  Text or RFC822 Message */
                EM_DEBUG_LOG("Multipart is not attachment, body->type = %d", body->type);
+               EM_DEBUG_LOG("grab_type : [%d]", cnt_info->grab_type);
                if ((cnt_info->grab_type & GRAB_TYPE_TEXT) && (body->type == TYPEMESSAGE || body->type == TYPETEXT || body->type == TYPEIMAGE))  {
                        if (is_pbd)
                                return SUCCESS;
@@ -4194,9 +4196,12 @@ static int emcore_get_body_part_imap(MAILSTREAM *stream, int account_id, int mai
                        case TYPEAUDIO:
                        case TYPEVIDEO:
                        /*  Inline Content - suspect of crash on partial body download */
-                               if (!is_pbd) {
+                       /*      if (!is_pbd) */ {
                                        EM_DEBUG_LOG("TYPEIMAGE or TYPEAPPLICATION  :  inline content");
                                        ai = &(cnt_info->file);
+                                       
+                                       while(*ai != NULL)
+                                               ai = &(*ai)->next;
 
                                        dec_len = body->size.bytes;
                                        if ((cnt_info->grab_type & GRAB_TYPE_ATTACHMENT) &&
@@ -4567,8 +4572,11 @@ INTERNAL_FUNC int emcore_set_fetch_body_section(BODY *body, int enable_inline_li
 //     body->id = cpystr("1"); /*  top level body */
        EM_DEBUG_LOG("body->id : [%s]", body->id);
 
-       g_inline_count = 0;
-       EM_SAFE_FREE(g_inline_list);
+       if (enable_inline_list) {
+               g_inline_count = 0;
+               EM_SAFE_FREE(g_inline_list);
+       }
+
        emcore_set_fetch_part_section(body, (char *)NULL, 0, enable_inline_list, total_mail_size, err_code);
 
        if (body && body->id)
index 7e27d43..3f886c6 100755 (executable)
@@ -951,7 +951,6 @@ INTERNAL_FUNC int emcore_add_mail(email_mail_data_t *input_mail_data, email_atta
        char *stripped_text = NULL;
        if (!emcore_strip_mail_body_from_file(converted_mail_tbl, &stripped_text, &err) || stripped_text == NULL) {
                EM_DEBUG_EXCEPTION("emcore_strip_mail_body_from_file failed [%d]", err);
-               goto FINISH_OFF;
        }
 
        if (!emcore_add_mail_text(mailbox_tbl, converted_mail_tbl, stripped_text, &err)) {
index cffb5b1..9af0486 100755 (executable)
@@ -724,6 +724,8 @@ INTERNAL_FUNC void emcore_start_alert()
 {
        EM_DEBUG_FUNC_BEGIN("setting_noti_status : [%d]", setting_noti_status);
 
+       int voicerecoder_state = 0;
+
 #ifdef __FEATURE_BLOCKING_MODE__
        if (emcore_get_blocking_mode_status())
                return;
@@ -732,6 +734,16 @@ INTERNAL_FUNC void emcore_start_alert()
        if (setting_noti_status == SETTING_NOTI_STATUS_OFF)
                return;
 
+       /* skip sound alert when voice recording */
+       if (vconf_get_int(VCONFKEY_VOICERECORDER_STATE, &voicerecoder_state) != 0) {
+               EM_DEBUG_EXCEPTION("vconf_get_int failed");
+       } else {
+               if (voicerecoder_state == VCONFKEY_VOICERECORDER_RECORDING) {
+                       EM_DEBUG_LOG("voice recoder is on recording");
+                       return;
+               }
+       }
+
        ENTER_CRITICAL_SECTION(sound_mutex);
        WAKE_CONDITION_VARIABLE(sound_condition);
        LEAVE_CRITICAL_SECTION(sound_mutex);
index b8172e3..3dd7dbb 100755 (executable)
@@ -1205,7 +1205,7 @@ INTERNAL_FUNC char* emcore_get_mail_field_name_by_attribute_type(email_mail_attr
 {
        EM_DEBUG_FUNC_BEGIN("input_attribute_type [%d]", input_attribute_type);
 
-       if(input_attribute_type > EMAIL_MAIL_ATTRIBUTE_MEETING_REQUEST_STATUS || input_attribute_type < 0) {
+       if(input_attribute_type > EMAIL_MAIL_ATTRIBUTE_EAS_DATA_TYPE || input_attribute_type < 0) {
                EM_DEBUG_EXCEPTION("Invalid input_attribute_type [%d]", input_attribute_type);
                return NULL;
        }
@@ -1403,6 +1403,7 @@ int emcore_strip_mail_body_from_file(emstorage_mail_tbl_t *mail, char **stripped
 
                                if (!g_error_matches(glib_error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE)) {
                                        EM_DEBUG_EXCEPTION("g_convert failed");
+                                       *stripped_text = EM_SAFE_STRDUP(buf);
                                        goto FINISH_OFF;
                                }
 
@@ -1411,6 +1412,7 @@ int emcore_strip_mail_body_from_file(emstorage_mail_tbl_t *mail, char **stripped
                                utf8_encoded_string = (char *)g_convert(buf, byte_read, "UTF-8", encoding_type, &byte_read, &byte_written, &glib_error);
                                if (utf8_encoded_string == NULL) {
                                        EM_DEBUG_EXCEPTION("g_convert failed : byte_read[%d]", byte_read);
+                                       *stripped_text = EM_SAFE_STRDUP(buf);
                                        goto FINISH_OFF;
                                }
                        }
@@ -1747,7 +1749,7 @@ int reg_replace (char *input_source_text, char *input_old_pattern_string, char *
 
        source_text_length = EM_SAFE_STRLEN(input_source_text);
 
-       if (regcomp(&reg_pattern, input_old_pattern_string, REG_ICASE) != 0) {
+       if (regcomp(&reg_pattern, input_old_pattern_string, REG_EXTENDED | REG_ICASE) != 0) {
                EM_DEBUG_EXCEPTION("regcomp failed");
                goto FINISH_OFF;
        }
@@ -1813,26 +1815,17 @@ int emcore_strip_HTML(char *source_string)
 
        int result = EMAIL_ERROR_NONE;
 
-       /* strip out CR */
-       reg_replace(source_string, "\r", "");
-
-       /* strip out LF */
-       reg_replace(source_string, "\n", "");
+       /* strip out CR, LF */
+       reg_replace(source_string, "(\r|\n)", "");
 
        /* strip out HEAD */
-       reg_replace(source_string, "<head[^>]*>", "<head>");
-       reg_replace(source_string, "<*/head>", "</head>");
-       reg_replace(source_string, "<head>.*</head>", "");
+       reg_replace(source_string, "<head[^>]*>.*<*/head>", "");
 
        /* strip out STYLE */
-       reg_replace(source_string, "<style[^>]*>", "<style>");
-       reg_replace(source_string, "<*/style>", "</style>");
-       reg_replace(source_string, "<style>.*</style>", "");
+       reg_replace(source_string, "<style[^>]*>.*<*/style>", "");
 
        /* strip out SCRIPT */
-       reg_replace(source_string, "<script[^>]*>", "<script>");
-       reg_replace(source_string, "<*/script>", "</script>");
-       reg_replace(source_string, "<script>.*</script>", "");
+       reg_replace(source_string, "<script[^>]*>.*<*/script>", "");
 
        /* strip out ALL TAG & comment */
        reg_replace(source_string, "<[^>]*>", "");
@@ -1841,13 +1834,22 @@ int emcore_strip_HTML(char *source_string)
        reg_replace(source_string, "-->", "");
 
        /* strip out html entities */
-       /*"&(quot|#34);""&(amp|#38);""&(lt|#60);""&(gt|#62);""&(nbsp|#160);"
-         "&(iexcl|#161);""&(cent|#162);""&(pound|#163);""&(copy|#169);"*/
-       reg_replace(source_string, "&lt;", "<");
-       reg_replace(source_string, "&gt;", ">");
-       reg_replace(source_string, "&quot;", "\'");
-       reg_replace(source_string, "&nbsp;", " ");
-
+       reg_replace(source_string, "&(quot|#34|#034);", "\"");
+       reg_replace(source_string, "&(#35|#035);", "#");
+       reg_replace(source_string, "&(#36|#036);", "$");
+       reg_replace(source_string, "&(#37|#037);", "%");
+       reg_replace(source_string, "&(amp|#38|#038);", "&");
+       reg_replace(source_string, "&(lt|#60|#060);", "<");
+       reg_replace(source_string, "&(gt|#62|#062);", ">");
+       reg_replace(source_string, "&(#64|#064);", "@");
+       reg_replace(source_string, "&(lsquo|rsquo);", "'");
+       reg_replace(source_string, "&(ldquo|rdquo);", "\"");
+       reg_replace(source_string, "&sbquo;", ",");
+       reg_replace(source_string, "&(trade|#x2122);", "(TM)");
+
+       /* strip out all type of spaces */
+       reg_replace(source_string, "&(nbsp|#160);", " ");
+       reg_replace(source_string, "[[:space:]]", " ");
        reg_replace(source_string, "  +", " ");
 
        EM_DEBUG_FUNC_END();
@@ -3241,6 +3243,9 @@ INTERNAL_FUNC void emcore_set_blocking_mode_of_setting(int input_blocking_mode_o
 
 INTERNAL_FUNC int emcore_get_blocking_mode_status()
 {
+       EM_DEBUG_FUNC_BEGIN("blocking_mode_status : [%d]", blocking_mode_status);
+       EM_DEBUG_FUNC_END();
+
        return blocking_mode_status;
 }
 
index 9931add..844153e 100755 (executable)
@@ -2378,7 +2378,7 @@ INTERNAL_FUNC int emstorage_query_mail_list(const char *conditional_clause, int
                        _get_table_field_data_int(result, (int*)&(mail_list_item_from_tbl[i].eas_data_length), col_index++);
                        _get_table_field_data_blob(result, (void**)&(mail_list_item_from_tbl[i].eas_data), mail_list_item_from_tbl[i].eas_data_length, col_index++);
 
-                       mail_list_item_from_tbl[i].attachment_count = ((local_attachment_count - local_inline_content_count)>0)?1:0;
+                       mail_list_item_from_tbl[i].attachment_count = ((local_attachment_count - local_inline_content_count)> 0) ? 1:0;
                }
                EM_DEBUG_LOG(">>>> DATA ASSIGN END [count : %d] >> ", count);
                EM_PROFILE_END(emstorage_query_mail_list_loop);
@@ -2666,7 +2666,7 @@ INTERNAL_FUNC int emstorage_query_mailbox_tbl(const char *input_conditional_clau
 
        if (input_get_mail_count == 0) {        /* without mail count */
                col_index = 13;
-               SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT %s FROM mail_box_tbl AS MBT %s", fields, input_conditional_clause);
+               SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT %s FROM mail_box_tbl AS MBT %s %s", fields, input_conditional_clause, input_ordering_clause);
        }
        else {  /* with read count and total count */
                col_index = 15;
@@ -3052,9 +3052,9 @@ FINISH_OFF:
 }
 
 
-INTERNAL_FUNC int emstorage_get_maildata_by_servermailid(int account_id, char *server_mail_id, emstorage_mail_tbl_t** mail, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_maildata_by_servermailid(int mailbox_id, char *server_mail_id, emstorage_mail_tbl_t** mail, int transaction, int *err_code)
 {
-       EM_DEBUG_FUNC_BEGIN("account_id [%d], server_mail_id[%s], mail[%p], transaction[%d], err_code[%p]", account_id, server_mail_id, mail, transaction, err_code);
+       EM_DEBUG_FUNC_BEGIN("mailbox_id [%d], server_mail_id[%s], mail[%p], transaction[%d], err_code[%p]", mailbox_id, server_mail_id, mail, transaction, err_code);
 
        int ret = false, error = EMAIL_ERROR_NONE, result_count;
        char conditional_clause[QUERY_SIZE] = {0, };
@@ -3066,10 +3066,10 @@ INTERNAL_FUNC int emstorage_get_maildata_by_servermailid(int account_id, char *s
                goto FINISH_OFF;
        }
 
-       if (account_id == ALL_ACCOUNT)
+       if (mailbox_id == 0)
                SNPRINTF(conditional_clause, QUERY_SIZE, "WHERE UPPER(server_mail_id) =UPPER('%s')", server_mail_id);
        else
-               SNPRINTF(conditional_clause, QUERY_SIZE, "WHERE UPPER(server_mail_id) =UPPER('%s') AND account_id = %d", server_mail_id, account_id);
+               SNPRINTF(conditional_clause, QUERY_SIZE, "WHERE UPPER(server_mail_id) =UPPER('%s') AND mailbox_id = %d", server_mail_id, mailbox_id);
 
        EM_DEBUG_LOG("conditional_clause [%s]", conditional_clause);
 
@@ -4589,26 +4589,22 @@ FINISH_OFF:
 INTERNAL_FUNC int emstorage_get_child_mailbox_list(int account_id, char *parent_mailbox_name, int *select_num, emstorage_mailbox_tbl_t** mailbox_list, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], parent_mailbox_name[%p], select_num[%p], mailbox_list[%p], transaction[%d], err_code[%p]", account_id, parent_mailbox_name, select_num, mailbox_list, transaction, err_code);
-       if (account_id < FIRST_ACCOUNT_ID || !select_num || !mailbox_list)  {
-               EM_DEBUG_EXCEPTION("account_id[%d], parent_mailbox_name[%p], select_num[%p], mailbox_list[%p]", account_id, parent_mailbox_name, select_num, mailbox_list);
-
-               if (err_code != NULL)
-                       *err_code = EMAIL_ERROR_INVALID_PARAM;
-               return false;
-       }
 
        int ret = false;
        int error = EMAIL_ERROR_NONE;
        char conditional_clause_string[QUERY_SIZE] = {0, };
 
-       if (parent_mailbox_name)
-               SNPRINTF(conditional_clause_string, sizeof(conditional_clause_string), "WHERE account_id = %d  AND UPPER(mailbox_name) LIKE UPPER('%s/%%')", account_id, parent_mailbox_name);
-       else
-               SNPRINTF(conditional_clause_string, sizeof(conditional_clause_string), "WHERE account_id = %d  AND (mailbox_name NOT LIKE '%%/%%')", account_id);
+       if (account_id < FIRST_ACCOUNT_ID || !select_num || !mailbox_list || !parent_mailbox_name)  {
+               EM_DEBUG_EXCEPTION("account_id[%d], parent_mailbox_name[%p], select_num[%p], mailbox_list[%p]", account_id, parent_mailbox_name, select_num, mailbox_list);
+               if (err_code != NULL)
+                       *err_code = EMAIL_ERROR_INVALID_PARAM;
+               return false;
+       }
 
+       SNPRINTF(conditional_clause_string, sizeof(conditional_clause_string), "WHERE account_id = %d  AND UPPER(mailbox_name) LIKE UPPER('%s%%')", account_id, parent_mailbox_name);
        EM_DEBUG_LOG("conditional_clause_string", conditional_clause_string);
 
-       if( (error = emstorage_query_mailbox_tbl(conditional_clause_string, " ORDER BY mailbox_name", 0, transaction, mailbox_list, select_num)) != EMAIL_ERROR_NONE) {
+       if( (error = emstorage_query_mailbox_tbl(conditional_clause_string, " ORDER BY mailbox_name DESC ", 0, transaction, mailbox_list, select_num)) != EMAIL_ERROR_NONE) {
                EM_DEBUG_EXCEPTION("emstorage_query_mailbox_tbl failed [%d]", error);
                goto FINISH_OFF;
        }
@@ -5539,7 +5535,7 @@ FINISH_OFF:
        _DISCONNECT_DB;
 
        if (result && parameter_string && !emcore_notify_storage_event(NOTI_MAILBOX_FIELD_UPDATE, input_account_id, 0, parameter_string, input_value))
-               EM_DEBUG_EXCEPTION("emcore_notify_storage_event failed : NOTI_MAIL_FIELD_UPDATE [%s,%d]", input_field_name, input_value);
+               EM_DEBUG_EXCEPTION("emcore_notify_storage_event failed : NOTI_MAILBOX_FIELD_UPDATE [%s,%d]", input_field_name, input_value);
 
        EM_SAFE_FREE(mailbox_id_string_buffer);
        EM_SAFE_FREE(parameter_string);
@@ -14577,6 +14573,104 @@ FINISH_OFF:
        return ret;
 }
 
+static int _make_filter_fts_rule_string(email_list_filter_rule_fts_t *input_list_filter_rule, char **output_string)
+{
+       EM_DEBUG_FUNC_BEGIN("input_list_filter_rule [%p], output_string [%p]", input_list_filter_rule, output_string);
+
+       int   ret = EMAIL_ERROR_NONE;
+       char *field_name_string = NULL;
+       char key_value_string[QUERY_SIZE] = {0,};
+       char  result_rule_string[QUERY_SIZE] = {0,};
+
+       int rc = -1;
+       int count = 0;
+       int col_index = 0;
+       int error = EMAIL_ERROR_NONE;
+       char **result = NULL;
+       char sql_query_string[QUERY_SIZE] = {0,};
+       char sql_query_string2[QUERY_SIZE] = {0,};
+       sqlite3 *local_db_handle = NULL;
+
+       if(input_list_filter_rule == NULL || output_string == NULL) {
+               EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM");
+               return  EMAIL_ERROR_INVALID_PARAM;
+       }
+
+       field_name_string = EM_SAFE_STRDUP("body_text");
+       SNPRINTF(key_value_string, QUERY_SIZE, "%s", input_list_filter_rule->key_value.string_type_value);
+
+       switch (input_list_filter_rule->rule_type) {
+
+       case EMAIL_LIST_FILTER_RULE_INCLUDE:
+               SNPRINTF(result_rule_string, QUERY_SIZE, "WHERE %s LIKE \'%%%s%%\' ", field_name_string, key_value_string);
+               break;
+
+       case EMAIL_LIST_FILTER_RULE_MATCH:
+               SNPRINTF(result_rule_string, QUERY_SIZE, "WHERE %s MATCH \'%s\' ", field_name_string, key_value_string);
+               break;
+
+       default :
+               EM_DEBUG_EXCEPTION("Invalid rule_type [%d]", input_list_filter_rule->rule_type);
+               ret = EMAIL_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+
+       local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(true);
+       SNPRINTF(sql_query_string, QUERY_SIZE, "SELECT mail_id FROM mail_text_tbl %s", result_rule_string);
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, 0, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc && -1 != rc), {error = EMAIL_ERROR_DB_FAILURE; sqlite3_free_table(result); goto FINISH_OFF;},
+               ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
+
+       col_index = 1;
+
+       if (!count) {
+               EM_DEBUG_EXCEPTION("No mail found...");
+               ret = true;
+               error= EMAIL_ERROR_MAIL_NOT_FOUND;
+               *output_string = strdup("mail_id IN ( ) ");
+               goto FINISH_OFF;
+       }
+
+       EM_DEBUG_LOG(">>>> DATA ASSIGN START >>");
+       int i = 0;
+       int *mail_ids = NULL;
+       if (!(mail_ids = (int *)em_malloc(sizeof(int) * count))) {
+               EM_DEBUG_EXCEPTION("malloc for mail_ids failed...");
+               error = EMAIL_ERROR_OUT_OF_MEMORY;
+               goto FINISH_OFF;
+       }
+
+       for (i = 0; i < count; i++) {
+               _get_table_field_data_int(result, &(mail_ids[i]), col_index++);
+               EM_DEBUG_LOG(">>>> DATA ASSIGN [mail_id : %d] >>", mail_ids[i]);
+       }
+
+       EM_DEBUG_LOG(">>>> DATA ASSIGN END [count : %d] >>", count);
+       EM_PROFILE_END(emstorage_query_mail_list_loop);
+       sqlite3_free_table(result);
+       EMSTORAGE_FINISH_READ_TRANSACTION(true);
+
+       sqlite3_release_memory(-1);
+
+       _DISCONNECT_DB;
+
+       int cur_query = 0;
+       cur_query += SNPRINTF_OFFSET(sql_query_string2, cur_query, QUERY_SIZE, "mail_id IN ( ");
+       for (i = 0; i < count-1; i++) {
+               cur_query += SNPRINTF_OFFSET(sql_query_string2, cur_query, QUERY_SIZE, "%d, ", mail_ids[i]);
+       }
+       cur_query += SNPRINTF_OFFSET(sql_query_string2, cur_query, QUERY_SIZE, "%d ) ", mail_ids[count-1]);
+
+       *output_string = strdup(sql_query_string2);
+
+FINISH_OFF:
+       EM_SAFE_FREE(field_name_string);
+       EM_DEBUG_FUNC_END("ret [%d]", ret);
+       return ret;
+}
+
 static int _make_order_rule_string(email_list_sorting_rule_t *input_sorting_rule, char **output_string) {
        EM_DEBUG_FUNC_BEGIN("input_sorting_rule [%p], output_string [%p]", input_sorting_rule, output_string);
 
@@ -14635,6 +14729,11 @@ INTERNAL_FUNC int emstorage_write_conditional_clause_for_getting_mail_list(email
                                _make_filter_rule_string(&(input_filter_list[i].list_filter_item.rule), &result_string_for_a_item);
                                break;
 
+                       case EMAIL_LIST_FILTER_ITEM_RULE_FTS :
+                               EM_DEBUG_LOG("[%d]list_filter_item_type is EMAIL_LIST_FILTER_ITEM_RULE_FTS", i);
+                               _make_filter_fts_rule_string(&(input_filter_list[i].list_filter_item.rule_fts), &result_string_for_a_item);
+                               break;
+
                        case EMAIL_LIST_FILTER_ITEM_OPERATOR :
                                EM_DEBUG_LOG("[%d]list_filter_item_type is EMAIL_LIST_FILTER_ITEM_OPERATOR", i);
                                switch(input_filter_list[i].list_filter_item.operator_type) {
index bf1bce2..9f13ed4 100755 (executable)
@@ -47,7 +47,6 @@ int  emcore_check_send_mail_thread_status();
 INTERNAL_FUNC int          emcore_get_current_thread_type();
 INTERNAL_FUNC int          emcore_register_event_callback(email_action_t action, email_event_callback callback, void *event_data);
 INTERNAL_FUNC int          emcore_unregister_event_callback(email_action_t action, email_event_callback callback);
-INTERNAL_FUNC int          emcore_get_pending_event(email_action_t action, int account_id, int mail_id, email_event_status_type_t *status);
 INTERNAL_FUNC int          emcore_start_event_loop(int *err_code);
 INTERNAL_FUNC int          emcore_stop_event_loop(int *err_code);
 INTERNAL_FUNC int          emcore_insert_event(email_event_t *event_data, int *handle, int *err_code);
@@ -61,6 +60,7 @@ INTERNAL_FUNC int          emcore_insert_event_for_sending_mails(email_event_t *
 INTERNAL_FUNC int          emcore_get_receiving_event_queue(email_event_t **event_queue, int *event_count, int *err);
 INTERNAL_FUNC int          emcore_cancel_all_threads_of_an_account(int account_id);
 INTERNAL_FUNC int          emcore_free_event(email_event_t *event_data);
+INTERNAL_FUNC int          emcore_get_task_information(email_task_information_t **output_task_information, int *output_task_information_count);
 
 #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
 /*  Please contact -> Himanshu [h.gahlaut@samsung.com] for any explanation in code here under this MACRO */
index 533892e..ce8b1a0 100755 (executable)
@@ -67,7 +67,7 @@ INTERNAL_FUNC int emcore_sync_mailbox_list(int account_id, char *mailbox, int ha
 INTERNAL_FUNC int emcore_download_mailbox_list(void *mail_stream, char *mailbox, email_internal_mailbox_t **mailbox_list, int *count, int *err_code);
 INTERNAL_FUNC int emcore_delete_imap_mailbox(int input_mailbox_id, int *err_code);
 INTERNAL_FUNC int emcore_create_imap_mailbox(email_mailbox_t *mailbox, int *err_code);
-INTERNAL_FUNC int emcore_move_mailbox_on_imap_server(int input_account_id, char *input_old_mailbox_path, char *input_new_mailbox_path);
+INTERNAL_FUNC int emcore_rename_mailbox_on_imap_server(int input_account_id, int input_mailbox_id, char *input_old_mailbox_path, char *input_new_mailbox_path, int handle_to_be_published);
 INTERNAL_FUNC int emcore_set_sync_imap_mailbox(email_internal_mailbox_t *mailbox, int synchronous, int *err_code);
 INTERNAL_FUNC int emcore_set_mail_slot_size(int account_id, int mailbox_id, int new_slot_size, int *err_code);
 INTERNAL_FUNC int emcore_remove_overflowed_mails(emstorage_mailbox_tbl_t *intput_mailbox_tbl, int *err_code);  
index af55204..a1f721d 100755 (executable)
@@ -69,7 +69,7 @@ INTERNAL_FUNC int  emcore_create_mailbox(email_mailbox_t *new_mailbox, int on_se
 INTERNAL_FUNC int  emcore_delete_mailbox(int input_mailbox_id, int input_on_server, int input_recursive);
 INTERNAL_FUNC int  emcore_delete_mailbox_ex(int input_account_id, int *input_mailbox_id_array, int input_mailbox_id_count, int input_on_server, int input_recursive);
 INTERNAL_FUNC int  emcore_delete_mailbox_all(email_mailbox_t *mailbox, int *err_code);
-INTERNAL_FUNC int  emcore_update_mailbox(email_mailbox_t *old_mailbox, email_mailbox_t *new_mailbox, int *err_code);
+INTERNAL_FUNC int  emcore_rename_mailbox(int input_mailbox_id, char *input_new_mailbox_name, char *input_new_mailbox_alias, int input_on_server, int input_recursive, int handle_to_be_published);
 INTERNAL_FUNC int  emcore_save_local_activity_sync(int account_id, int *err_code);
 INTERNAL_FUNC int  emcore_send_mail_event(email_mailbox_t *mailbox, int mail_id , int *err_code);
 INTERNAL_FUNC int  emcore_partial_body_thd_local_activity_sync(int *is_event_inserted, int *err_code);
index 1026eae..c75d1ab 100755 (executable)
@@ -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);
index 756c3c4..bb33235 100755 (executable)
@@ -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 */
index 77142c1..d71f8e5 100755 (executable)
@@ -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;
                }
        }
index dced421..06a742c 100755 (executable)
@@ -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);
index 959a349..6c2109b 100755 (executable)
@@ -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:
index 388eba3..b963da7 100755 (executable)
@@ -73,11 +73,16 @@ EXPORT_API bool emipc_parse_stream_of_param_list(emipc_param_list *param_list, v
 {
        EM_DEBUG_FUNC_BEGIN();
        long parameter_count = *((long *)stream + eSTREAM_COUNT);
-       if(parameter_count <= 0) {
-               EM_DEBUG_EXCEPTION("INVALID_PARAM : count %d", parameter_count);
+       if(parameter_count < 0) {
+               EM_DEBUG_LOG("INVALID_PARAM : count %d", parameter_count);
                return false;
        }
 
+       if(parameter_count == 0) {
+               EM_DEBUG_LOG("count %d", parameter_count);
+               return true;
+       }
+
        int stream_len = malloc_usable_size(stream);
        int remain_len = stream_len - (sizeof(long) * eSTREAM_DATA);
        EM_DEBUG_LOG("Allocated stream size : %dbyte", stream_len);
@@ -121,16 +126,24 @@ EXPORT_API bool emipc_parse_stream_of_param_list(emipc_param_list *param_list, v
 
 EXPORT_API unsigned char *emipc_serialize_param_list(emipc_param_list *param_list, int *stream_length)
 {
-       EM_DEBUG_FUNC_BEGIN();
-       if(param_list->byte_stream)
-               return param_list->byte_stream;
+       EM_DEBUG_FUNC_BEGIN("param_list [%p] stream_length [%p]", param_list, stream_length);
+
+       if(param_list == NULL) {
+               EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM");
+               return NULL;
+       }
+
+       if(param_list->byte_stream) {
+               EM_DEBUG_LOG("param_list->byte_stream exist");
+               goto FINISH_OFF;
+       }
 
        int stream_len = emipc_sum_param_list_length (param_list);
 
        if (stream_len <= 0) {
                EM_DEBUG_EXCEPTION("stream_len error %d", stream_len);
                EM_SAFE_FREE(param_list->byte_stream);
-               return NULL;
+               goto FINISH_OFF;
        }
 
        param_list->byte_stream = (unsigned char*)calloc(1, stream_len);
@@ -139,7 +152,7 @@ EXPORT_API unsigned char *emipc_serialize_param_list(emipc_param_list *param_lis
        if (pos + (int)sizeof(param_list->param_count) > stream_len ) {
                EM_DEBUG_EXCEPTION("%d > stream_len", pos + sizeof(param_list->param_count));
                EM_SAFE_FREE(param_list->byte_stream);
-               return NULL;
+               goto FINISH_OFF;
        }
 
        memcpy((param_list->byte_stream + pos), &param_list->param_count, sizeof(param_list->param_count));
@@ -155,13 +168,13 @@ EXPORT_API unsigned char *emipc_serialize_param_list(emipc_param_list *param_lis
                if (length < 0) {
                        EM_DEBUG_EXCEPTION("index = %d, length = %d", index, length);
                        EM_SAFE_FREE(param_list->byte_stream);
-                       return NULL;
+                       goto FINISH_OFF;
                }
 
                if (pos + (int)sizeof(long) > stream_len) {
                        EM_DEBUG_EXCEPTION("%d > stream_len", pos + sizeof(long));
                        EM_SAFE_FREE(param_list->byte_stream);
-                       return NULL;
+                       goto FINISH_OFF;
                }
                /* write param i length */
                memcpy((param_list->byte_stream+pos), &length, sizeof(long));
@@ -170,7 +183,7 @@ EXPORT_API unsigned char *emipc_serialize_param_list(emipc_param_list *param_lis
                if (pos + length > stream_len) {
                        EM_DEBUG_EXCEPTION("%d > stream_len", pos + length);
                        EM_SAFE_FREE(param_list->byte_stream);
-                       return NULL;
+                       goto FINISH_OFF;
                }
                /* write param i data if length is greater than 0 */
                if( length > 0 ) {
@@ -180,7 +193,9 @@ EXPORT_API unsigned char *emipc_serialize_param_list(emipc_param_list *param_lis
        }
        *stream_length = stream_len;
 
-       EM_DEBUG_FUNC_END();
+FINISH_OFF:
+
+       EM_DEBUG_FUNC_END("param_list->byte_stream [%p]", param_list->byte_stream);
        return param_list->byte_stream;
 }
 
index 89180d5..6b571c7 100755 (executable)
@@ -180,12 +180,6 @@ EXPORT_API bool emipc_free_api_info(emipc_email_api_info *api_info);
                        case _EMAIL_API_CANCEL_JOB:\
                                        s = "_EMAIL_API_CANCEL_JOB";\
                                        break;\
-                       case _EMAIL_API_GET_PENDING_JOB:\
-                                       s = "_EMAIL_API_GET_PENDING_JOB";\
-                                       break;\
-                       case _EMAIL_API_NETWORK_GET_STATUS:\
-                                       s = "_EMAIL_API_NETWORK_GET_STATUS";\
-                                       break;\
                        case _EMAIL_API_SEND_RETRY:\
                                        s = "_EMAIL_API_SEND_RETRY";\
                                        break;\
@@ -207,9 +201,6 @@ EXPORT_API bool emipc_free_api_info(emipc_email_api_info *api_info);
                        case _EMAIL_API_RESTORE_ACCOUNTS :\
                                        s = "_EMAIL_API_RESTORE_ACCOUNTS";\
                                        break;\
-                       case _EMAIL_API_PRINT_RECEIVING_EVENT_QUEUE :\
-                                       s = "_EMAIL_API_PRINT_RECEIVING_EVENT_QUEUE";\
-                                       break;\
                        case _EMAIL_API_PING_SERVICE :\
                                        s = "_EMAIL_API_PING_SERVICE";\
                                        break;\
@@ -225,6 +216,9 @@ EXPORT_API bool emipc_free_api_info(emipc_email_api_info *api_info);
                        case _EMAIL_API_WRITE_MIME_FILE:\
                                        s = "_EMAIL_API_WRITE_MIME_FILE";\
                                        break;\
+                       case _EMAIL_API_GET_TASK_INFORMATION:\
+                                       s = "_EMAIL_API_GET_TASK_INFORMATION";\
+                                       break;\
                        default : \
                                        s = "UNKNOWN_APIID";\
                }\
index 5ba193e..f58b1da 100755 (executable)
@@ -69,7 +69,7 @@ EXPORT_API int emipc_finalize_proxy_main()
 
 EXPORT_API bool emipc_execute_api_of_proxy_main(emipc_email_api_info *api_info)
 {
-       EM_DEBUG_FUNC_BEGIN();
+       EM_DEBUG_FUNC_BEGIN("api_info [%p]", api_info);
        
        int ret;
        unsigned char *in_stream = NULL;
@@ -83,6 +83,7 @@ EXPORT_API bool emipc_execute_api_of_proxy_main(emipc_email_api_info *api_info)
        }
 
        in_stream = emipc_serialize_api_info(api_info, ePARAMETER_IN, &length);
+
        if( !in_stream ) {
                EM_DEBUG_EXCEPTION("NULL stream");
                return false;
@@ -112,6 +113,6 @@ EXPORT_API bool emipc_execute_api_of_proxy_main(emipc_email_api_info *api_info)
                EM_SAFE_FREE(ipc_buf);
        }
        
-       EM_DEBUG_FUNC_END();
+       EM_DEBUG_FUNC_END("result [%d]", result);
        return result;          
 }
index b4d8a8a..2e45c48 100644 (file)
@@ -115,7 +115,7 @@ EXPORT_API bool emipc_end_proxy_socket()
  * EMAIL_ERROR_IPC_SOCKET_FAILURE, when no IPC connection */
 EXPORT_API int emipc_send_proxy_socket(unsigned char *data, int len)
 {
-       EM_DEBUG_FUNC_BEGIN();
+       EM_DEBUG_FUNC_BEGIN("data [%p] len [%d]", data, len);
        int socket_fd = emipc_get_proxy_socket_id();
 
        /* if thread socket is not created */
@@ -134,6 +134,7 @@ EXPORT_API int emipc_send_proxy_socket(unsigned char *data, int len)
                emipc_end_proxy_socket();
        }
 
+       EM_DEBUG_FUNC_END("send_len [%d]", send_len);
        return send_len;
 }
 
@@ -154,7 +155,7 @@ EXPORT_API int emipc_get_proxy_socket_id()
                }
        }
        LEAVE_CRITICAL_SECTION(proxy_mutex);
-       EM_DEBUG_LOG("tid %d, socket_fd %d", tid, socket_fd);
+       EM_DEBUG_FUNC_END("tid %d, socket_fd %d", tid, socket_fd);
        return socket_fd;
 }
 
index 55976df..8be734a 100755 (executable)
@@ -108,7 +108,7 @@ EXPORT_API int emipc_send_email_socket(int fd, unsigned char *buf, int len)
                EM_DEBUG_LOG("WARNING: buf_size [%d] != write_len[%d]", len, write_len);
                return EMAIL_ERROR_IPC_SOCKET_FAILURE;
        }
-       EM_DEBUG_FUNC_END();
+       EM_DEBUG_FUNC_END("write_len [%d]", write_len);
        return write_len;
 }
 
index 6fed5b2..2f2f19b 100755 (executable)
@@ -223,12 +223,12 @@ CREATE TABLE mail_task_tbl
        task_parameter                   BLOB,
        date_time                        DATETIME
 );
-CREATE TABLE mail_text_tbl
+CREATE VIRTUAL TABLE mail_text_tbl USING fts4
 (
-       mail_id                         INTEGER,
-       account_id                      INTEGER,
-       mailbox_id                      INTEGER,
-       body_text                       TEXT
+       mail_id                          INTEGER,
+       account_id                       INTEGER,
+       mailbox_id                       INTEGER,
+       body_text                        TEXT
 );
 CREATE UNIQUE INDEX mail_account_idx1 ON mail_account_tbl (account_id);
 CREATE UNIQUE INDEX mail_box_idx1 ON mail_box_tbl (mailbox_id);
index 631380b..f65e426 100755 (executable)
@@ -548,15 +548,24 @@ static gboolean testapp_test_get_mail_list_ex()
        int err = EMAIL_ERROR_NONE;
        int i = 0;
 
-       filter_rule_count = 1;
+       filter_rule_count = 3;
 
        filter_list = malloc(sizeof(email_list_filter_t) * filter_rule_count);
        memset(filter_list, 0 , sizeof(email_list_filter_t) * filter_rule_count);
 
-       filter_list[0].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
-       filter_list[0].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_MAILBOX_TYPE;
-       filter_list[0].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_EQUAL;
-       filter_list[0].list_filter_item.rule.key_value.integer_type_value  = EMAIL_MAILBOX_TYPE_INBOX;
+       filter_list[0].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE_FTS;
+       filter_list[0].list_filter_item.rule_fts.target_attribute              = EMAIL_MAIL_TEXT_ATTRIBUTE_FULL_TEXT;
+       filter_list[0].list_filter_item.rule_fts.rule_type                     = EMAIL_LIST_FILTER_RULE_MATCH;
+       filter_list[0].list_filter_item.rule_fts.key_value.string_type_value  = strdup("ieee");
+
+       filter_list[1].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_OPERATOR;
+       filter_list[1].list_filter_item.operator_type                      = EMAIL_LIST_FILTER_OPERATOR_OR;
+
+       filter_list[2].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
+       filter_list[2].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_SUBJECT;
+       filter_list[2].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_INCLUDE;
+       filter_list[2].list_filter_item.rule.key_value.string_type_value   = strdup("2013");
+       filter_list[2].list_filter_item.rule.case_sensitivity              = false;
 
        /*
        filter_list[1].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_OPERATOR;
@@ -632,7 +641,7 @@ static gboolean testapp_test_get_mail_list_ex()
                testapp_print("email_get_mail_list_ex failed.\n");
        }
 
-       email_free_list_filter(&filter_list, 9);
+       email_free_list_filter(&filter_list, 3);
 
        return FALSE;
 }
index 6ad03fa..14d3dd3 100755 (executable)
 #include "email-ipc.h"
 #include "email-core-utils.h"
 
-static gboolean testapp_test_get_network_status()
-{
-       int on_sending = 0;
-       int on_receiving = 0;
-       email_get_network_status(&on_sending, &on_receiving);
-       testapp_print("\tNetwork status : \n On sending - %d \n On Receiving - %d \n", on_sending, on_receiving);
-       return FALSE;
-}
-
-static gboolean testapp_test_get_pending_job()
-{
-       int action = -1;
-       int account_id = 0;
-       int mail_id = 0;
-       int result_from_scanf = 0;
-       email_event_status_type_t status = -1;
-       testapp_print( " Enter Action \n SEND_MAIL = 0 \n SYNC_HEADER = 1 \n" \
-                           " DOWNLOAD_BODY,= 2 \n DOWNLOAD_ATTACHMENT = 3 \n" \
-                           " DELETE_MAIL = 4 \n SEARCH_MAIL = 5 \n SAVE_MAIL = 6 \n" \
-                           " NUM = 7 \n");
-       result_from_scanf = scanf("%d",&action);
-
-       testapp_print("\n > Enter account_id: ");
-       result_from_scanf = scanf("%d", &account_id);
-
-       testapp_print("\n > Enter Mail Id: ");
-       result_from_scanf = scanf("%d", &mail_id);
-
-       if( email_get_pending_job( action, account_id, mail_id, &status) >= 0)
-               testapp_print("\t status - %d \n",status);
-
-       return FALSE;
-}
-
 static gboolean testapp_test_cancel_job        ()
 {
        int account_id = 0;
@@ -123,28 +89,23 @@ static gboolean testapp_test_get_preview_text_from_file()
        return TRUE;
 }
 
-static gboolean testapp_test_print_receving_queue_via_debug_msg()
+static gboolean testapp_test_get_task_information()
 {
-       int err;
-       void* hAPI = (void*)emipc_create_email_api(_EMAIL_API_PRINT_RECEIVING_EVENT_QUEUE);
-
-       if(hAPI == NULL)
-               return EMAIL_ERROR_NULL_VALUE;
-               
-       if(emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) {
-               testapp_print("testapp_test_print_receving_queue_via_debug_msg - emipc_execute_proxy_api failed \n ");
-               if(hAPI == NULL)
-                       return EMAIL_ERROR_NULL_VALUE;
-       }
+       int i = 0;
+       int err = EMAIL_ERROR_NONE;
+       int task_information_count = 0;
+       email_task_information_t *task_information_array = NULL;
 
-       emipc_get_parameter(hAPI, 1, 0, sizeof(int), &err);
        
-       testapp_print(" >>>> RETURN VALUE : %d \n", err);
+       err = email_get_task_information(&task_information_array, &task_information_count);
+
+       testapp_print("\n======================================================================\n");
+       for(i = 0; i < task_information_count; i++)
+               testapp_print("type[%d], account_id[%d], handle[%d], status[%d]", task_information_array[i].type, task_information_array[i].account_id, task_information_array[i].handle, task_information_array[i].status);
+       testapp_print("\n======================================================================\n");
 
-       emipc_destroy_email_api(hAPI);
+       testapp_print("testapp_test_get_task_information  ..........End\n");
 
-       hAPI = NULL;
-       testapp_print("testapp_test_print_receving_queue_via_debug_msg  ..........End\n");
        return err;
 }
 
@@ -247,7 +208,7 @@ FINISH_OFF:
        return error;
 }
 
-#define LIB_EMAIL_SERVICE_PATH LIBPATH "libemail-api.so"
+#define LIB_EMAIL_SERVICE_PATH "/usr/lib/libemail-api.so"
 
 int (*Datastore_FI_EMTB)(char **);
 int (*Datastore_FI_EMSB)(char **);
@@ -421,12 +382,6 @@ static gboolean testapp_test_interpret_command (int menu_number)
        gboolean go_to_loop = TRUE;
 
        switch (menu_number) {
-               case 1:
-                       testapp_test_get_network_status();
-                       break;
-               case 2:
-                       testapp_test_get_pending_job ();
-                       break;
                case 3:
                        testapp_test_cancel_job ();
                        break;
@@ -440,7 +395,7 @@ static gboolean testapp_test_interpret_command (int menu_number)
                        testapp_test_get_preview_text_from_file();
                        break;
                case 11:
-                       testapp_test_print_receving_queue_via_debug_msg();
+                       testapp_test_get_task_information();
                        break;
                case 12:
                        testapp_test_create_db_full();
index 3b1d8ef..9daf8ef 100755 (executable)
@@ -181,13 +181,11 @@ void testapp_show_menu (eEMAIL_MENU menu)
                        testapp_print ("==========================================\n");
                        testapp_print ("   OTHERS\n");
                        testapp_print ("==========================================\n");
-                       testapp_print ("1.  Get Network Status\n");
-                       testapp_print ("2.  Get Pending Job\n");
                        testapp_print ("3.  Cancel Job\n");
                        testapp_print ("5.  Set DNET Proper Profile Type\n");
                        testapp_print ("6.  Get DNET Proper Profile Type\n");
                        testapp_print ("7.  Get preview text\n");
-                       testapp_print ("11. Print receiving event queue via debug msg\n");
+                       testapp_print ("11. Get task information\n");
                        testapp_print ("12. Create DB full\n");
                        testapp_print ("13. Encoding Test\n");
                        testapp_print ("14. DTT Test\n");