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;
}
int err = EMAIL_ERROR_NONE;
if(account_id <= 0) {
- EM_DEBUG_LOG("invalid parameters");
+ EM_DEBUG_EXCEPTION("invalid parameters");
return EMAIL_ERROR_INVALID_PARAM;
}
/**
-
* @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.
*
/**
-
* @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.
*
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.
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);
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;
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);
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);
/* #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 */
#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
/* 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;
_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,
_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,
} 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,
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 {
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 {
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;
EMAIL_SORT_ORDER_DESCEND = 1
} email_list_filter_sort_order_t;
+
typedef struct {
email_mail_attribute_type target_attribute;
bool force_boolean_check;
} 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
#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
#endif
-#define EVENT_QUEUE_MAX 32
-
typedef struct EVENT_CALLBACK_ELEM
{
email_event_callback callback;
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++;
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;
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)
/* 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;
}
}
-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;
}
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);
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;
}
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;
}
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;
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);
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;
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) {
*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);
FINISH_OFF:
EM_SAFE_FREE(from_address);
+ EM_SAFE_FREE(p_input_full_address_from);
if (addr != NULL)
mail_free_address(&addr);
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;
}
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;
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++;
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;
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;
/* 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;
}
/* 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");
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);
}
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;
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;
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 */
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;
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;
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) &&
// 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)
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)) {
{
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;
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);
{
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;
}
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;
}
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;
}
}
source_text_length = EM_SAFE_STRLEN(input_source_text);
- if (regcomp(®_pattern, input_old_pattern_string, REG_ICASE) != 0) {
+ if (regcomp(®_pattern, input_old_pattern_string, REG_EXTENDED | REG_ICASE) != 0) {
EM_DEBUG_EXCEPTION("regcomp failed");
goto FINISH_OFF;
}
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, "<[^>]*>", "");
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, "<", "<");
- reg_replace(source_string, ">", ">");
- reg_replace(source_string, """, "\'");
- reg_replace(source_string, " ", " ");
-
+ 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, "‚", ",");
+ 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();
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;
}
_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);
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;
}
-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, };
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);
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;
}
_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);
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);
_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) {
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);
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 */
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);
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);
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);
}
#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();
}
#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 */
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);
int err = EMAIL_ERROR_NONE;
email_event_t event_data;
- email_account_t* ref_account = NULL;
memset(&event_data, 0x00, sizeof(email_event_t));
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;
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();
}
}
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;
}
}
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.
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);
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();
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();
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;
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);
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;
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:
{
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);
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);
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), ¶m_list->param_count, sizeof(param_list->param_count));
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));
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 ) {
}
*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;
}
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;\
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;\
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";\
}\
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;
}
in_stream = emipc_serialize_api_info(api_info, ePARAMETER_IN, &length);
+
if( !in_stream ) {
EM_DEBUG_EXCEPTION("NULL stream");
return false;
EM_SAFE_FREE(ipc_buf);
}
- EM_DEBUG_FUNC_END();
+ EM_DEBUG_FUNC_END("result [%d]", result);
return result;
}
* 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 */
emipc_end_proxy_socket();
}
+ EM_DEBUG_FUNC_END("send_len [%d]", send_len);
return send_len;
}
}
}
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;
}
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;
}
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);
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;
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;
}
#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;
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;
}
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 **);
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;
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();
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");