summaryrefslogtreecommitdiff
path: root/email-common-use
diff options
context:
space:
mode:
authorMinsoo Kim <minnsoo.kim@samsung.com>2013-04-12 10:55:15 +0900
committerMinsoo Kim <minnsoo.kim@samsung.com>2013-04-12 10:55:15 +0900
commit6a8e93a8dcdec88628560de64cbced6a534f4063 (patch)
tree0554277f0fed822fc017c776aced826588e2d3d3 /email-common-use
parentfe4c0288642939dbe5414bb465e50cae0a9787f4 (diff)
downloademail-service-6a8e93a8dcdec88628560de64cbced6a534f4063.tar.gz
email-service-6a8e93a8dcdec88628560de64cbced6a534f4063.tar.bz2
email-service-6a8e93a8dcdec88628560de64cbced6a534f4063.zip
apply removal of mailbox_name field
Diffstat (limited to 'email-common-use')
-rwxr-xr-xemail-common-use/email-convert.c75
-rwxr-xr-xemail-common-use/email-utilities.c60
-rwxr-xr-xemail-common-use/include/email-convert.h5
-rwxr-xr-xemail-common-use/include/email-internal-types.h27
-rwxr-xr-xemail-common-use/include/email-types.h33
5 files changed, 154 insertions, 46 deletions
diff --git a/email-common-use/email-convert.c b/email-common-use/email-convert.c
index fd9ae77..340b678 100755
--- a/email-common-use/email-convert.c
+++ b/email-common-use/email-convert.c
@@ -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);
diff --git a/email-common-use/email-utilities.c b/email-common-use/email-utilities.c
index 1bb6ec2..fe52ddb 100755
--- a/email-common-use/email-utilities.c
+++ b/email-common-use/email-utilities.c
@@ -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;
diff --git a/email-common-use/include/email-convert.h b/email-common-use/include/email-convert.h
index 39d5553..9dcbcf3 100755
--- a/email-common-use/include/email-convert.h
+++ b/email-common-use/include/email-convert.h
@@ -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);
diff --git a/email-common-use/include/email-internal-types.h b/email-common-use/include/email-internal-types.h
index 9d37cb2..9e207b9 100755
--- a/email-common-use/include/email-internal-types.h
+++ b/email-common-use/include/email-internal-types.h
@@ -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;
diff --git a/email-common-use/include/email-types.h b/email-common-use/include/email-types.h
index fd2c11a..8659284 100755
--- a/email-common-use/include/email-types.h
+++ b/email-common-use/include/email-types.h
@@ -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